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? |
1 of 7 tasks
2 of 7 tasks
Closed
1 task done
This was referenced Sep 9, 2026
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
…n#27792) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27487 ## What this PR does / why we need it: An INSERT plan can share an `ObjectRef` between its target-table scan and write context. Marking that shared reference as `NotLockMeta` caused the write target to omit its shared metadata lock, so a concurrent CREATE INDEX could backfill before the INSERT committed and permanently miss the committed row. This change deep-copies scan references before applying the scan-local `NotLockMeta` flag. The write target now retains its metadata lock while INSERT ... SELECT source scans continue to skip metadata locking. Regression coverage uses separate CNs and an exact writer-transaction metadata-lock probe. It verifies both regular secondary indexes with FORCE/IGNORE INDEX and fulltext indexes with MATCH/LIKE, including the row committed while CREATE INDEX is waiting. The pessimistic DDL atomicity BVT now explicitly commits the INSERT transaction before ADD/DROP FOREIGN KEY requests take the referenced table's exclusive metadata lock, preserving the intended lock handoff without a test-runner lock timeout. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
…n#27792) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27487 ## What this PR does / why we need it: An INSERT plan can share an `ObjectRef` between its target-table scan and write context. Marking that shared reference as `NotLockMeta` caused the write target to omit its shared metadata lock, so a concurrent CREATE INDEX could backfill before the INSERT committed and permanently miss the committed row. This change deep-copies scan references before applying the scan-local `NotLockMeta` flag. The write target now retains its metadata lock while INSERT ... SELECT source scans continue to skip metadata locking. Regression coverage uses separate CNs and an exact writer-transaction metadata-lock probe. It verifies both regular secondary indexes with FORCE/IGNORE INDEX and fulltext indexes with MATCH/LIKE, including the row committed while CREATE INDEX is waiting. The pessimistic DDL atomicity BVT now explicitly commits the INSERT transaction before ADD/DROP FOREIGN KEY requests take the referenced table's exclusive metadata lock, preserving the intended lock handoff without a test-runner lock timeout. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
VioletQwQ-0
pushed a commit
to VioletQwQ-0/matrixone
that referenced
this pull request
Sep 17, 2026
…n#27792) ## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: issue matrixorigin#27487 ## What this PR does / why we need it: An INSERT plan can share an `ObjectRef` between its target-table scan and write context. Marking that shared reference as `NotLockMeta` caused the write target to omit its shared metadata lock, so a concurrent CREATE INDEX could backfill before the INSERT committed and permanently miss the committed row. This change deep-copies scan references before applying the scan-local `NotLockMeta` flag. The write target now retains its metadata lock while INSERT ... SELECT source scans continue to skip metadata locking. Regression coverage uses separate CNs and an exact writer-transaction metadata-lock probe. It verifies both regular secondary indexes with FORCE/IGNORE INDEX and fulltext indexes with MATCH/LIKE, including the row committed while CREATE INDEX is waiting. The pessimistic DDL atomicity BVT now explicitly commits the INSERT transaction before ADD/DROP FOREIGN KEY requests take the referenced table's exclusive metadata lock, preserving the intended lock handoff without a test-runner lock timeout. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This was referenced Oct 8, 2026
XuPeng-SH
added a commit
that referenced
this pull request
Oct 8, 2026
…9749) ## What type of PR is this? - [x] BUG - [x] Improvement - [x] Test and CI ## Which issue(s) this PR fixes: Fixes #29715 for `4.2-dev`. The corresponding ownership corrections already exist on main (#27792 and #28265). ## What this PR does / why we need it: Concurrent ODKU and `ALTER TABLE ... DROP INDEX` can lose write-target metadata protection on 4.2. INSERT scans share ObjectRefs with write contexts, so marking a scan `NotLockMeta` in place also suppresses the base/index write targets' metadata locks. Restoring those locks alone is insufficient: ALTER's nested `DROP TABLE` then acquires child metadata after parent metadata, reversing DML admission order. A controlled public SQL test reproduces deadlock 20701 when only that old nested path is restored. - Copy scan ObjectRefs before setting the scan-local flag. Base and hidden-index write targets retain their existing metadata admission and retry behavior. - Reuse the existing parent-owned DROP INDEX child cleanup sequence from both ALTER and standalone DROP INDEX. Preserve auto-increment cleanup, transactional deletion, temporary aliases and error propagation; remove the duplicate CDC drop call and redundant relation lookup. - Stop COPY and INPLACE ALTER as soon as parent/table admission requests a plan rebuild, before looking up hidden relations from the stale plan. Public concurrent DROP/ADD regressions verify schema and data; an unchanged missing child still terminates with 1146. - Close the historical standalone DROP INDEX admission gap: after resolving the parent, acquire its existing catalog Exclusive and storage definition-change locks before reading constraints, draining CDC or deleting index children. Either retry code immediately requests a fresh logical plan; terminal errors retain their identity. Optimistic transactions keep their prior path and IF EXISTS no-op remains early. No new state machine or per-row DML work is introduced. - Isolate the strict privilege-cache zero-allocation assertion in a bounded child process running the same race/coverage-instrumented test binary. This prevents preceding frontend tests' background workers from contributing to process-wide allocation counts; assertion failures and child coverage counters propagate to the parent. - Add two existing-session commit waits to the DDL atomicity BVT now that the missing metadata protection is restored. - Reuse serialized metadata keys within the existing LockMeta owner until its dependency set changes. Invalidate both key vectors on new membership and before freeing their expression executors; publish the pair only after both evaluations succeed. Preserve each catalog Relation.Reset, both lock admissions, ordering, single-database policy, retry behavior and Batch.SetVector allocation policy. Use one local borrowed batch view without adding persistent fields. Complete production delta is +130/-101 (net +29 lines). This optimization itself removes six net production lines and adds 175 focused test/benchmark lines. It affects the shared metadata admission owner used by write paths, not only INSERT. No successful-lock cache, skipped catalog Reset, blanket missing-table retry or new lifecycle framework is introduced. ### Performance Standalone pessimistic DROP now pays two necessary parent admission gates; this fixes exclusion and stale-generation correctness, and is not advertised as a DROP latency improvement. SELECT/DML do not execute these new gates. The shared metadata preparation optimization remains unchanged. Compared with the preceding PR revision `66b7d318`, isolated warm metadata preparation removes 4–5 allocations and 256–384 bytes per call for 1/2/8 dependencies. Median preparation time decreases approximately 5–6%; this is an owner microbenchmark, not SQL throughput. Actual three-CN SQL benchmarks use eight independent ABBA processes, split by local versus remote catalog-lock ownership, with stable binding guards and final row/value checks. Local-lock write-path latency medians improve 0.2–2.4%; SELECT changes +0.7%. Remote-lock writes show no material regression, but untouched SELECT also improves 3.4%, so remote gains cannot all be attributed to this change. Initial mixed-owner results are invalidated, not used for acceptance. These measurements do not establish fleet, high-concurrency or tail-latency performance. ### Validation Validated on Linux/amd64, Go 1.26.4, against target base `2e24395c2e6e25d32a628abe663826178feff0a7`, with this worktree's native CGo libraries. - Original diagnostic workload: 10 rounds, two concurrent writers × 100 ODKU each; correct 20 rows and sum(v)=200 each round. The same probabilistic test also passed unfixed baseline, so causal evidence comes from the deterministic controls below. - Public three-CN regression for both ALTER and standalone DROP INDEX: commit, rollback, late writer admission/replan, and DDL admitted first; verify exactly-once results, removed unique-index catalog entry and continued operation of a neighboring regular index. Qualified ALTER and standalone DROP without a session database also pass. - Negative controls: unfixed baseline misses the held writer's base metadata lock; restoring only nested DROP makes the new DDL-first test fail with deadlock 20701. - Cleanup UT exercises relation lookup failure, auto-increment failure, delete failure, temporary success and persistent success, preserving unrelated aliases. The fixture uses a minimal process and starts no auto-increment background service. - `go test -race` passes the new public tests and existing fulltext cancel/retry and prepared-statement replan consumers. - Full compile-package race run has three pre-existing Parquet assertion failures, reproduced identically with all four changed compile source/test files restored to the target baseline. No race report occurred. The full package passes `-race` when excluding exactly `TestCompileExternScanParquetLoadUsesRowGroupFanoutWithEmptyFiles`, `TestCompileExternScanParquetRowGroupFanoutValidatesEmptyFileColumnCount`, and `TestCompileExternScanParquetLoadUsesFileFanoutMainPath`. - Both stale-plan COPY ADD COLUMN and INPLACE ADD INDEX pass public multi-CN tests under `-race`: a concurrent DROP commits before the old plan reaches parent admission, the ADD replans successfully, existing rows survive, and the removed unique constraint is not resurrected. The same tests require terminal 1146 for an unchanged parent with a missing child and roll back the diagnostic deletion. Each case also passes three repetitions for fixture/retry cleanup reuse. - QA continuation also passes after canceling a metadata-blocked ALTER and rolling back the writer: subsequent ADD COLUMN succeeds with the original row intact. Temporary-table shadowing and DDL rollback remain isolated from the persistent table. - Frontend owning-package race and atomic-coverage runs pass. The isolated allocation assertion passes ten coverage repetitions; injected real allocations fail all 12 cells and propagate a nonzero child exit. The final coverage profile records 12,120 executions each of cache lookup and invalidation (10 × 12 × 101), proving child counters are included. Ten subprocess invocations take 0.465s locally; no production allocation or synchronization is added by this test fix. - Actual mo-tester run of the complete `pessimistic_transaction/ddl_atomicity.sql` passes 100% golden validation. - Incremental SCA: `go vet` passes; configured golangci-lint v2.6.2 reports 0 new issues; molint exits 0 with the same six recover diagnostics (five compile, one frontend) as a separate pristine baseline worktree, and no new diagnostics. - Final frozen-source validation reruns compile normal/race with the same three explicit baseline exclusions; focused metadata reuse/failure coverage passes `-race -count=100`. Tests decode actual serialized keys, check duplicate/new membership, separate account owners, Reset failure, either executor failure, complete-pair publication and owner cleanup/rebuild. - Public normal/race consumers, INSERT SELECT self-scan/foreign-key/rollback, fulltext child cleanup and cross-database prepared UPDATE after schema refresh pass. The actual complete DDL atomicity BVT and incremental vet/configured lint/molint are rerun successfully on the final source. Existing unchanged frontend coverage/race evidence above is reused. The tests change +1006/-1 lines across focused alias/cleanup UTs and one shared public cluster fixture; production net size and test size were reviewed separately. Design and final overall review use explicitly selected gpt-6.1-sol/xhigh. Local evidence is complete; CI for the updated revision remains pending and has not been awaited. ### Standalone admission completion The previous reviewed revision and an exact production-baseline overlay both reproduce the historical failure when standalone DROP commits after COPY/INPLACE ALTER already owns parent metadata: COPY panics with 20101 and INPLACE fails with internal delete-rowid duplicate 1062. Updated deterministic public tests now verify that DROP actually queues behind that parent before release, then both operations complete correctly. A separate pre-admission order still verifies stale-plan rebuild. Four COPY/INPLACE/order cases, schema/index/data checks and unchanged-parent missing-child 1146 are retained. Focused gate UT covers both retry codes at either gate, terminal errors, real temporary aliases, qualified database and optimistic behavior. Additional QA exercises standalone temporary-index rollback/shadowing, server KILL QUERY while metadata-blocked (verifying waiter departure before writer release), subsequent DDL progress and IF EXISTS reuse. New concurrency tests use the existing three-CN fixture and lock-state probes, with bounded workers and cleanup joins. New exact race repetitions pass: parent gate/error UT ×100, standalone admission ×25 and eight-order ODKU ×20, using measured per-test durations and a 30-second adaptive stress budget (cluster startup adds overhead). A client context cancellation alone is not treated as proof of server rollback; the cancellation oracle explicitly kills the server query and observes lock-wait termination. The complete DDL atomicity mo-tester BVT passes twice on the same embedded instance, explicitly disabling fault injection, dropping db1 and verifying catalog absence after each round. Final source fingerprints cover all ten changed files; prior unchanged frontend coverage and metadata benchmarks are reused explicitly.
XuPeng-SH
added a commit
that referenced
this pull request
Oct 9, 2026
) ## What type of PR is this? - [x] Test and CI ## Which issue(s) this PR fixes: Related to #29715, reported on 4.2. This adds main regression coverage; it does not close the 4.2 issue or backport its existing fix. ## What this PR does / why we need it: ODKU concurrent with DROP INDEX must preserve write metadata admission and rebuild a stale plan before touching a removed hidden index. Main already contains #27792's scan ObjectRef copying correction. This PR guards that ownership boundary and the public ALTER TABLE DROP INDEX path. - Extend the existing compiler ownership UT with a hidden unique-index scan/write alias and verify both write metadata dependencies. - Reuse the authenticated two-CN fixture with one seeded row. Check DROP waiting on the writer's base metadata lock under commit and rollback, and force DROP to commit between writer compilation and metadata admission. - Bind the CN-wide hook to the public autocommit writer's connection and active transaction. Reuse existing identity matching with an identity-only projection from locked transaction UUID getters, avoiding mutable session status reads. - Exercise an unrelated CN0 transaction before writer launch and while it is paused. Its real INSERT/UPDATE statements must complete without capturing the barrier or increasing writer admission counts. - Retain exactly-once row/value checks, dropped-index catalog checks, and a later ODKU that reuses the formerly unique value. Register bounded cancellation, barrier release, worker joining and hook/resource cleanup before the first hooked statement. The probe adds one row/table to the existing cluster; late admission took 0.08s in the focused normal run, excluding shared-cluster setup. Production behavior and runtime overhead are unchanged. The exact historical failing stack/first bad commit remain unproved; the controlled isolation test does not depend on actual cron scheduling. ### Validation Base: 83d82b8. Go 1.27.1, darwin/arm64, repository CGo runner with fresh worktree-native artifacts. - Compiler ownership/metadata controls, all three public DROP orderings, identity adapter UT, and existing concurrent CREATE INDEX/DDL-consistency controls pass in normal and race modes. - Exact public regression passes -race -count=3 in one process: nine subscenarios, one shared-cluster setup. - Removing only the writer identity predicate makes late admission fail at the competing INSERT's bounded deadline; commit/rollback controls still pass and cleanup terminates. - Final incremental formatting, diff check, go vet, pinned molint and configured golangci-lint 2.14.0 pass on both owning packages. No new molint diagnostics; existing compiler diagnostics are in source identical to the base. - gpt-6.1-sol / xhigh design and final overall review evidence is retained in the task record. Historical author-reported Linux main diagnostics at this base observed no hidden-table 1146 under the frozen workload, and scan-copy-removal overlays failed ownership assertions. These remain historical evidence, separate from the current checks above. Focused reproduction: .agents/skills/mo-dev/scripts/mo-cgo-test -race -count=3 -timeout=180s -run '^TestIssue29715ODKUConcurrentDropIndex$' ./pkg/tests/issues CI has not been awaited for this update.
Closed
1 task done
2 of 4 tasks
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #27487
What this PR does / why we need it:
An INSERT plan can share an
ObjectRefbetween its target-table scan and write context. Marking that shared reference asNotLockMetacaused the write target to omit its shared metadata lock, so a concurrent CREATE INDEX could backfill before the INSERT committed and permanently miss the committed row.This change deep-copies scan references before applying the scan-local
NotLockMetaflag. The write target now retains its metadata lock while INSERT ... SELECT source scans continue to skip metadata locking.Regression coverage uses separate CNs and an exact writer-transaction metadata-lock probe. It verifies both regular secondary indexes with FORCE/IGNORE INDEX and fulltext indexes with MATCH/LIKE, including the row committed while CREATE INDEX is waiting.
The pessimistic DDL atomicity BVT now explicitly commits the INSERT transaction before ADD/DROP FOREIGN KEY requests take the referenced table's exclusive metadata lock, preserving the intended lock handoff without a test-runner lock timeout.