Repository navigation
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Deep review of 63021cb, including issue #28286, the metadata-lock/DDL-watermark path, snapshot refresh and Compile.Run replanning, fault-barrier cleanup, and ordinary-query overhead.
The stale-plan repair direction is sound: validate before pipeline execution, use the existing definition-changed retry rather than sleeps, and preserve the actual missing-index error. The current cross-CN regression passes. However, the new classifier also enables metadata locking for already-rewritten ordinary FULLTEXT predicates because it examines unreachable optimizer nodes. This violates the stated narrow scope and introduces avoidable locking/waiting on the common path. See the reproduced P2 below.
Executed on this head with controlled macOS CGo/native inputs:
- TestSelectMetaLockRequirement and matching TestLockMeta tests: PASS.
- TestIssue27487ConcurrentInsertIsIncludedInNewIndex in a disposable embedded two-CN cluster: PASS (12.893 s package execution).
- Added review-only tests using mysql.Parse + plan.BuildPlan and the existing docs_ft mock catalog: bare MATCH predicate and COUNT(*) variants reproduce the false-positive classifier; projection score, wrapped predicate, and ORDER BY controls pass. The only remaining placeholder is in an unreachable FILTER node, not in the executable graph.
- git diff --check: PASS.
No production changes were made. This review does not claim a production performance benchmark or complete historical incident reproduction. Please constrain the classifier to executable plan nodes and protect it with real optimizer-output tests, then retain the existing stale-plan cross-CN test as the positive control.
aunjgr
left a comment
There was a problem hiding this comment.
Review of commit 63021cb141f6eea6b2f1a4b6b9938dea67cbf12d.
No blocking finding in the reviewed change. Unresolved FULLTEXT placeholders enable the existing pre-execution metadata validation/retry path, and the deterministic cross-CN regression covers a stale plan resuming after CREATE FULLTEXT INDEX commits. Ordinary SELECT and genuine missing-index controls are retained.
Evidence: source review and existing passing CI for this commit; no new local test run was performed for this review.
aptend
left a comment
There was a problem hiding this comment.
Deep-reviewed exact head 63021cb141f6eea6b2f1a4b6b9938dea67cbf12d. The deterministic cross-CN regression passes, but the production classifier introduces a blocking false positive for already-rewritten indexed FULLTEXT queries. I reproduced it with a real parser + optimizer plan; details are inline. Validation: focused compile tests PASS; cross-CN TestIssue27487ConcurrentInsertIsIncludedInNewIndex PASS; focused race test PASS (100 runs); go vet PASS. The complete pkg/sql/compile suite also ran, with five pre-existing parquet fanout failures in unrelated scope_test.go tests.
|
Addressed both reviews in 02a5a17. I verified the finding independently. The optimizer retains the original FILTER containing fulltext_match after rewriting bare MATCH and COUNT(*) queries to use the FULLTEXT index. Scanning all Query.Nodes therefore added metadata locking to valid, already-rewritten queries. The classifier now traverses the executable graph from Query.Steps through Children and SourceStep indirections, with visited-node deduplication and node/step bounds checks. Abandoned filters no longer trigger metadata locking. Added real parser/optimizer tests for bare MATCH, COUNT(*), score projection, wrapped predicates and score ordering. The first two explicitly assert that the abandoned MATCH remains in optimizer storage while the classifier reports no lock and no unresolved expression, directly guarding the reported false positive. Graph tests cover reachable placeholders, LOCK_OP, shared/cyclic edges, nil nodes and invalid references. The original two-CN test still covers stale-index retry and the genuine missing-index error. Validation passed:
This corrects the scope of the original fix: only an executable unresolved FULLTEXT expression requests the additional metadata validation. |
aptend
left a comment
There was a problem hiding this comment.
Deep re-review of exact head 9613b78d031a839f276a338fa8b48a9fe4669cf3, including the increment from my previous reviewed head 02a5a178d5d755cf2272ff9d2e0152e4121991b0 and the complete three-file diff against base f14eb824df4c74fb341ebecd46d2da3358503a95. I read all historical reviews, inline comments, author replies and resolved/outdated thread states.
Both prior findings are closed. The executable graph walk continues to exclude abandoned optimizer nodes, and the classifier now checks ORDER BY plus other executable expression slots, including nested window expressions. The real planner regression covers the original unindexed ORDER BY counterexample, while indexed MATCH/COUNT negative controls retain abandoned filters without requesting metadata locks. DML already enables metadata validation independently, so its separate expression slots do not require this SELECT classifier.
The existing pre-pipeline lock and definition-changed retry path remains the owner of catalog validation, snapshot advancement and replanning. The fault barrier is context-aware and has bounded cleanup. No new resource, lock-order or correctness blocker was found.
Validation on this exact head: native dependencies and cgo built successfully; complete pkg/sql/compile tests passed (4.499s); focused classifier/planner tests with -race passed (1.256s); the two-CN TestIssue27487ConcurrentInsertIsIncludedInNewIndex passed (13.191s), including WHERE, ORDER BY and genuine missing-index controls. GitHub required checks are green. Worktree is clean and git diff --check passes.
Merge Queue Status
This pull request spent 31 minutes 30 seconds in the queue, with no time running CI. Waiting for
All conditions
ReasonPull request #28289 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
|
…origin#28289) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Enhancement - [ ] refactoring - [ ] pkg-wasm - [ ] user-interface ## Which issue(s) this PR fixes: Fixes matrixorigin#28286 ## What this PR does / why we need it: A `MATCH ... AGAINST` statement can be planned on one CN with a table definition that predates a concurrent `CREATE FULLTEXT INDEX` committed by another CN. The planner rewrites `fulltext_match` only when the local `TableDef.Indexes` already contains a usable FULLTEXT index. With the stale definition, the unresolved runtime placeholder remains in the plan. Ordinary SELECT plans previously enabled the pre-pipeline `mo_tables` metadata lock only when they contained a `Node_LOCK_OP`, so this plan skipped the existing catalog-version validation and executed the placeholder, returning error 20105 even though the DDL had already committed and populated the hidden index table. This change recognizes unresolved `fulltext_match` and `fulltext_match_score` expressions in SELECT plans and enables the existing metadata validation path. If a DDL committed after the plan snapshot, lockservice's retained table commit watermark causes the RC snapshot to advance and returns `ErrTxnNeedRetryWithDefChanged`, rebuilding the plan with the current index definition. The scope is intentionally narrow: - Successfully rewritten FULLTEXT plans contain no unresolved placeholder and take no additional metadata lock. - Ordinary SELECT behavior is unchanged. - A genuine MATCH query without a FULLTEXT index still returns the original 20105 error. - This does not change lock protocols, catalog formats, DDL transaction semantics, or index data paths. The regression test deterministically reproduces the production ordering across two CNs: 1. A query CN compiles a stale unresolved FULLTEXT plan and pauses before metadata validation. 2. Another CN commits `CREATE FULLTEXT INDEX`. 3. The query resumes only after the DDL is fully committed. 4. Metadata validation forces retry/replan, and MATCH succeeds on the non-DDL CN. Disabling only the new `needLockMeta` decision makes the same test fail deterministically with the incident's 20105 error after the DDL has committed. Local validation: - `go test ./pkg/sql/compile -count=1 -timeout=15m` - `go test ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$' -count=3 -timeout=8m` - `go test -race ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$/fulltext_index$' -count=1 -timeout=10m` - `git diff --check` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…origin#28289) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Enhancement - [ ] refactoring - [ ] pkg-wasm - [ ] user-interface ## Which issue(s) this PR fixes: Fixes matrixorigin#28286 ## What this PR does / why we need it: A `MATCH ... AGAINST` statement can be planned on one CN with a table definition that predates a concurrent `CREATE FULLTEXT INDEX` committed by another CN. The planner rewrites `fulltext_match` only when the local `TableDef.Indexes` already contains a usable FULLTEXT index. With the stale definition, the unresolved runtime placeholder remains in the plan. Ordinary SELECT plans previously enabled the pre-pipeline `mo_tables` metadata lock only when they contained a `Node_LOCK_OP`, so this plan skipped the existing catalog-version validation and executed the placeholder, returning error 20105 even though the DDL had already committed and populated the hidden index table. This change recognizes unresolved `fulltext_match` and `fulltext_match_score` expressions in SELECT plans and enables the existing metadata validation path. If a DDL committed after the plan snapshot, lockservice's retained table commit watermark causes the RC snapshot to advance and returns `ErrTxnNeedRetryWithDefChanged`, rebuilding the plan with the current index definition. The scope is intentionally narrow: - Successfully rewritten FULLTEXT plans contain no unresolved placeholder and take no additional metadata lock. - Ordinary SELECT behavior is unchanged. - A genuine MATCH query without a FULLTEXT index still returns the original 20105 error. - This does not change lock protocols, catalog formats, DDL transaction semantics, or index data paths. The regression test deterministically reproduces the production ordering across two CNs: 1. A query CN compiles a stale unresolved FULLTEXT plan and pauses before metadata validation. 2. Another CN commits `CREATE FULLTEXT INDEX`. 3. The query resumes only after the DDL is fully committed. 4. Metadata validation forces retry/replan, and MATCH succeeds on the non-DDL CN. Disabling only the new `needLockMeta` decision makes the same test fail deterministically with the incident's 20105 error after the DDL has committed. Local validation: - `go test ./pkg/sql/compile -count=1 -timeout=15m` - `go test ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$' -count=3 -timeout=8m` - `go test -race ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$/fulltext_index$' -count=1 -timeout=10m` - `git diff --check` --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
…origin#28289) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Enhancement - [ ] refactoring - [ ] pkg-wasm - [ ] user-interface ## Which issue(s) this PR fixes: Fixes matrixorigin#28286 ## What this PR does / why we need it: A `MATCH ... AGAINST` statement can be planned on one CN with a table definition that predates a concurrent `CREATE FULLTEXT INDEX` committed by another CN. The planner rewrites `fulltext_match` only when the local `TableDef.Indexes` already contains a usable FULLTEXT index. With the stale definition, the unresolved runtime placeholder remains in the plan. Ordinary SELECT plans previously enabled the pre-pipeline `mo_tables` metadata lock only when they contained a `Node_LOCK_OP`, so this plan skipped the existing catalog-version validation and executed the placeholder, returning error 20105 even though the DDL had already committed and populated the hidden index table. This change recognizes unresolved `fulltext_match` and `fulltext_match_score` expressions in SELECT plans and enables the existing metadata validation path. If a DDL committed after the plan snapshot, lockservice's retained table commit watermark causes the RC snapshot to advance and returns `ErrTxnNeedRetryWithDefChanged`, rebuilding the plan with the current index definition. The scope is intentionally narrow: - Successfully rewritten FULLTEXT plans contain no unresolved placeholder and take no additional metadata lock. - Ordinary SELECT behavior is unchanged. - A genuine MATCH query without a FULLTEXT index still returns the original 20105 error. - This does not change lock protocols, catalog formats, DDL transaction semantics, or index data paths. The regression test deterministically reproduces the production ordering across two CNs: 1. A query CN compiles a stale unresolved FULLTEXT plan and pauses before metadata validation. 2. Another CN commits `CREATE FULLTEXT INDEX`. 3. The query resumes only after the DDL is fully committed. 4. Metadata validation forces retry/replan, and MATCH succeeds on the non-DDL CN. Disabling only the new `needLockMeta` decision makes the same test fail deterministically with the incident's 20105 error after the DDL has committed. Local validation: - `go test ./pkg/sql/compile -count=1 -timeout=15m` - `go test ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$' -count=3 -timeout=8m` - `go test -race ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$/fulltext_index$' -count=1 -timeout=10m` - `git diff --check` --------- 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 #28286
What this PR does / why we need it:
A
MATCH ... AGAINSTstatement can be planned on one CN with a table definition that predates a concurrentCREATE FULLTEXT INDEXcommitted by another CN.The planner rewrites
fulltext_matchonly when the localTableDef.Indexesalready contains a usable FULLTEXT index. With the stale definition, the unresolved runtime placeholder remains in the plan. Ordinary SELECT plans previously enabled the pre-pipelinemo_tablesmetadata lock only when they contained aNode_LOCK_OP, so this plan skipped the existing catalog-version validation and executed the placeholder, returning error 20105 even though the DDL had already committed and populated the hidden index table.This change recognizes unresolved
fulltext_matchandfulltext_match_scoreexpressions in SELECT plans and enables the existing metadata validation path. If a DDL committed after the plan snapshot, lockservice's retained table commit watermark causes the RC snapshot to advance and returnsErrTxnNeedRetryWithDefChanged, rebuilding the plan with the current index definition.The scope is intentionally narrow:
The regression test deterministically reproduces the production ordering across two CNs:
CREATE FULLTEXT INDEX.Disabling only the new
needLockMetadecision makes the same test fail deterministically with the incident's 20105 error after the DDL has committed.Local validation:
go test ./pkg/sql/compile -count=1 -timeout=15mgo test ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$' -count=3 -timeout=8mgo test -race ./pkg/tests/issues -run '^TestIssue27487ConcurrentInsertIsIncludedInNewIndex$/fulltext_index$' -count=1 -timeout=10mgit diff --check