Repository navigation
fix(plan): invalidate prepared plugin-index plans after DDL - #26359
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? |
47fb716 to
05eb2e7
Compare
05eb2e7 to
cbf11bc
Compare
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review completed at cbf11bc1c20417b47017462956759fcd2610cae7, including the linked issue discussion. In particular, I used the issue author's clarification that same-session DROP/CREATE is already masked by session DDL generation and that the real regression is cross-session/CN invalidation after an index-only rewrite removes the TABLE_SCAN.
The explicit Query.catalog_dependencies channel preserves the base and plugin hidden-table identities before that scan disappears, retains snapshot/subscription/version identity, survives serialization and deep copy, and is merged into normal query, prepared DDL SELECT-source, and transient SET validation. The FULLTEXT and vector rewrite entry points are covered, and the in-place vector-plugin applied detection now stops dispatch after the successful rewrite. I found no blocking correctness issue.
Local validation: complete pkg/sql/plan non-race tests, focused dependency/index-only tests under -race -count=100, build-through-test, vet, protobuf serialization coverage, and git diff --check pass. Exact-head CI is green and the PR is mergeable.
Merge Queue Status
This pull request spent 41 minutes 2 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #26359 has been dequeued Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.
Failing checks:
HintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Tick the box to put this pull request back in the merge queue (same as
|
…igin#26359) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#25625 ## What this PR does / why we need it: Prepared FULLTEXT and vector plans can rewrite away the TABLE_SCAN that originally carried their base-table and hidden-index catalog identities. ResetPreparePlan previously inferred dependencies only from the final plan shape, so index DDL on another session or CN could leave a prepared statement bound to deleted or stale hidden tables. This PR: - adds an explicit catalog dependency channel to Query for rewrite-owned objects; - records the base table and plugin hidden tables before vector rewrites can remove the scan, and after successful FULLTEXT rewrites; - merges explicit dependencies into prepared schema validation, including DDL SELECT sources and transient SET subqueries; - preserves snapshot, subscription, and catalog-version identity while deduplicating inferred and explicit dependencies; - fixes vector plugin applied detection for in-place rewrites so dispatch stops after the first successful plugin; - adds an IVF index-only regression covering a final plan with FUNCTION_SCAN and no reachable TABLE_SCAN, plus serialization, snapshot, atomic-failure, and transient-query coverage. Validation: - focused prepared/plugin regressions: race x100 each; - pkg/sql/plan: full race and non-race package suites; - go build and go vet for pkg/sql/plan and pkg/pb/plan; - dependent pkg/frontend prepared-cache regressions under race; - local launch-with-proxy two-CN verification: - IVF DROP/CREATE and ALTER REINDEX lists=2 to lists=3; - FULLTEXT prepared SELECT and UPDATE after cross-CN DROP/CREATE. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…igin#26359) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#25625 ## What this PR does / why we need it: Prepared FULLTEXT and vector plans can rewrite away the TABLE_SCAN that originally carried their base-table and hidden-index catalog identities. ResetPreparePlan previously inferred dependencies only from the final plan shape, so index DDL on another session or CN could leave a prepared statement bound to deleted or stale hidden tables. This PR: - adds an explicit catalog dependency channel to Query for rewrite-owned objects; - records the base table and plugin hidden tables before vector rewrites can remove the scan, and after successful FULLTEXT rewrites; - merges explicit dependencies into prepared schema validation, including DDL SELECT sources and transient SET subqueries; - preserves snapshot, subscription, and catalog-version identity while deduplicating inferred and explicit dependencies; - fixes vector plugin applied detection for in-place rewrites so dispatch stops after the first successful plugin; - adds an IVF index-only regression covering a final plan with FUNCTION_SCAN and no reachable TABLE_SCAN, plus serialization, snapshot, atomic-failure, and transient-query coverage. Validation: - focused prepared/plugin regressions: race x100 each; - pkg/sql/plan: full race and non-race package suites; - go build and go vet for pkg/sql/plan and pkg/pb/plan; - dependent pkg/frontend prepared-cache regressions under race; - local launch-with-proxy two-CN verification: - IVF DROP/CREATE and ALTER REINDEX lists=2 to lists=3; - FULLTEXT prepared SELECT and UPDATE after cross-CN DROP/CREATE. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…igin#26359) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: Fixes matrixorigin#25625 ## What this PR does / why we need it: Prepared FULLTEXT and vector plans can rewrite away the TABLE_SCAN that originally carried their base-table and hidden-index catalog identities. ResetPreparePlan previously inferred dependencies only from the final plan shape, so index DDL on another session or CN could leave a prepared statement bound to deleted or stale hidden tables. This PR: - adds an explicit catalog dependency channel to Query for rewrite-owned objects; - records the base table and plugin hidden tables before vector rewrites can remove the scan, and after successful FULLTEXT rewrites; - merges explicit dependencies into prepared schema validation, including DDL SELECT sources and transient SET subqueries; - preserves snapshot, subscription, and catalog-version identity while deduplicating inferred and explicit dependencies; - fixes vector plugin applied detection for in-place rewrites so dispatch stops after the first successful plugin; - adds an IVF index-only regression covering a final plan with FUNCTION_SCAN and no reachable TABLE_SCAN, plus serialization, snapshot, atomic-failure, and transient-query coverage. Validation: - focused prepared/plugin regressions: race x100 each; - pkg/sql/plan: full race and non-race package suites; - go build and go vet for pkg/sql/plan and pkg/pb/plan; - dependent pkg/frontend prepared-cache regressions under race; - local launch-with-proxy two-CN verification: - IVF DROP/CREATE and ALTER REINDEX lists=2 to lists=3; - FULLTEXT prepared SELECT and UPDATE after cross-CN DROP/CREATE. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #25625
What this PR does / why we need it:
Prepared FULLTEXT and vector plans can rewrite away the TABLE_SCAN that originally carried their base-table and hidden-index catalog identities. ResetPreparePlan previously inferred dependencies only from the final plan shape, so index DDL on another session or CN could leave a prepared statement bound to deleted or stale hidden tables.
This PR:
Validation: