fix(plan): honor invisible indexes in optimizer - #26881
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
fengttt
left a comment
There was a problem hiding this comment.
WAIT. WHY would not consider using these invisible indices? If it is available, why not use it?
04204b3 to
3fda153
Compare
LeftHandCold
left a comment
There was a problem hiding this comment.
Re-reviewed the exact updated head 89d034f. The previous publication DDL-sync blocker is closed: newly added invisible indexes now retain INVISIBLE after the complete ADD statement is generated, while default-visible indexes remain unchanged. The regression covers regular, unique, fulltext, IVFFLAT, and HNSW forms and reparses each generated ALTER statement to verify the AST visibility value. I also rechecked the full visibility lifecycle (legacy metadata migration, create/alter persistence, optimizer eligibility across regular/master/spatial/fulltext/vector/join/hints, maintenance/unique enforcement, SHOW CREATE/deep copy/publication) and found no remaining merge blocker.
Treat index visibility as optimizer eligibility without changing physical index maintenance or uniqueness semantics. Persist an explicit visibility marker for upgrade-safe legacy defaults, filter every index rewrite path, reject invisible hints, and preserve the state through metadata and SHOW CREATE.
89d034f to
cd0e9dd
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Re-reviewed the exact current head cd0e9dd after the latest rebase. Verdict: no remaining merge blocker found. GitHub does not allow the PR author account to submit an approval, so this is recorded as a review comment.
Range-diff against the previously approved head 89d034f shows no semantic change in the four PR commits; the only context shift is in apply_indices_test.go after integrating the encoded regular-index cost work.
I rechecked the complete visibility lifecycle: legacy metadata reconciliation, CREATE/ALTER persistence, protobuf/deep-copy compatibility, mo_indexes, SHOW CREATE and publication DDL, optimizer eligibility across master/regular/spatial/fulltext/vector/join/hint paths, and the intentionally unchanged maintenance and uniqueness paths. The previous publication ADD INVISIBLE blocker remains closed.
Focused changed tests, all eight owning packages, build, vet, protobuf regeneration, diff checks, and index-plugin dispatch guards pass. The latest main merge is conflict-free and its remaining production changes are isolated to timewin.
Fixes #26862.
Invisible indexes are physical/constraint metadata, not optimizer candidates. This change introduces an explicit visibility-initialized marker so legacy proto3 defaults remain visible after upgrade, then enforces eligibility across regular, master, spatial, fulltext, vector, join, and index-hint paths.
It preserves index maintenance and unique enforcement, persists visibility through CREATE/ALTER, mo_indexes metadata, deep-copy and SHOW CREATE/restore, and fixes publication DDL visibility default handling.
Validation: