Repository navigation
fix: refresh ALTER COPY after concurrent source writes - #31435
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? |
…9198cec6deb08a9a8a65355b180f47689e578c3
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 063f25a4c338f171acc90c9786121a867319d386
Assessment: approve
Reviewed the complete six-file delta, linked issue and frozen discussion. The single refresh reuses established admission, snapshot, preparation and cleanup owners, preserves caller-local writes, and prevents further COPY retries after refresh failure. No actionable unresolved findings remain.
Model: gpt-6-astra / xhigh
Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1
Validation:
-
Reused frozen exact-head successes for Ubuntu UT, arm64 SCA, shared build, UT coverage, proxy and pessimistic multi-CN BVT, and CI Required.
-
Reviewed three focused helper tests, 19 deterministic integration scenarios, and the SQL/result additions covering defaults, rollback, partition indexes and allocator progression.
-
Saved discussion-assessment.json covering both informational discussion items; no prior substantive findings or rebuttals exist.
-
Source/evidence audit passed with unchanged source. Receipt: /home/xupeng/.local/state/mo-bot/jobs/4e76de6c731dcec1ed7d558c/attempt-1/checks/1793100839365771007-4.json; corresponding review-audit.log and check-ledger.json are retained.
Limitations:
-
No local product tests were rerun. Frozen CI metadata lacks per-test logs; additional author-reported race repetitions and BVT runs were not independently certified.
-
The original large-load reproduction was not repeated. Recovery deliberately performs one additional full copy under the lifecycle gate; its latency and resource costs were not benchmarked.
❌ Left the queue ·
|
| Condition | Required by | |
|---|---|---|
| ✅ | #review-threads-unresolved = 0 |
GitHub branch protection |
| ✅ | github-review-approved |
GitHub branch protection |
The batch, tested in place
| Condition | Required by | |
|---|---|---|
| ❌ | any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required |
GitHub branch protection |
Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).
- Requeue this pull request
Times in UTC · dashboard · how the merge queue works
…9198cec6deb08a9a8a65355b180f47689e578c3
…9198cec6deb08a9a8a65355b180f47689e578c3
## What type of PR is this? - [ ] API-change - [x] BUG - [ ] Improvement - [ ] Documentation - [ ] Feature - [ ] Test and CI - [ ] Code Refactoring ## Which issue(s) this PR fixes: - #31401 ## What this PR does / why we need it: Follow-up to merged #31435. Its source refresh lets the first ALTER succeed after an in-flight LOAD commits, but the extra full preparation holds the global SNAPSHOT exclusive lifecycle gate and delays unrelated lifecycle operations. Certify pure scalar ADD COLUMN in the planner and revalidate source, target, private ownership, FK/history and the actual nested CREATE before allowing shared admission through refresh and publication. Preserve preparation before source locking, caller-local writes, allocator state and bounded generations. Carry the retained-ownership FastFail policy through component/name admission; fresh/private-only owners still wait. Late protection uses FastFail promotion/domain acquisition; definition races remain terminal. Existing primary keys and auto-increment columns are supported. Complex, indexed, partitioned, FK and protected-history tables retain the previous broad path and its cost. Shared admission still delays exclusive owners; this change does not remove the extra copy or claim a numeric latency/IO improvement. Validation: deterministic old-code convoy counterexample; real frontend same-/cross-account and prepared progress, LOAD, transaction/rollback/cancellation/failure and late-protection controls; owning compile normal/race and planner normal; focused adaptive race repetitions; scoped vet/lint. Existing `ddl/alter_copy_add_index` passed normal mo-tester comparison twice on one embedded two-CN instance, 95/95 statements each, with teardown checks. Full Linux/compose CI remains pending. Exact MySQL return-latency parity was not measured. Leave the issue open for reporter verification after merge. CI repair validation (`7906a005f7f5abc8bec6c79eba5d54e911a6e937`): the [PROXY BVT](https://github.com/matrixorigin/matrixone/actions/runs/40570011042/job/122427364748) and [pessimistic BVT](https://github.com/matrixorigin/matrixone/actions/runs/40570011042/job/122427364772) exposed deterministic scalar CREATE certification failures. Recognize NOT NULL encoded in `Default.NullAbility` and normalize only nested expression `Type.Table` lineage on cloned trees; preserve default values, nullability, bound function IDs, column coordinates and semantic types. Coverage and CI Required failed downstream of these BVT failures. New checks: both added regression groups fail before their respective fixes; full compile package (`mo-cgo-test -v -count=1 -timeout=180s ./pkg/sql/compile`) passes. All four Issue31401 integration tests pass, including the strengthened NOT NULL refresh/progress case, retained locks, transaction cleanup and LOAD. All ten failed BVT scripts pass normal comparison on one embedded two-CN instance (2808 executed statements, 10 existing ignored); expression-default and SHOW CREATE scripts also pass twice on the same instance, with expression-case database teardown verified. Scoped `go vet` and `golangci-lint` pass for compile/issues; formatting, license headers and delivery artifact checks pass. Prior unchanged functional evidence is reused. Local validation is Darwin/arm64, not Linux Compose/PROXY parity; full CI for this repair is pending. The preceding exact-head run passed Linux UT, UT coverage and SCA, including the earlier license repair. --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
What type of PR is this?
Which issue(s) this PR fixes:
What this PR does / why we need it:
ALTER COPY prepares before its lifecycle gate. When an in-flight LOAD commits while ALTER waits, the prepared copy is stale and the first ALTER currently fails with a transaction write conflict.
For pessimistic RC transactions, retire the complete transaction-owned private generation and prepare once more at the locked fresh frontier in the same transaction. Keep caller-local writes, allocator generations, partition indexes and lineage consistent; preserve real source-definition and lock conflicts. Errors after refresh, including publication retries, remain terminal so COPY cannot restart a third time.
Normal ALTER still prepares once before the gate. Recovery adds one full copy and index preparation while holding the gate, which can delay other lifecycle DDL.
Validation: owning compile package in normal and race modes; deterministic LOAD/ALTER and transaction regressions (PK/no-PK, commit/rollback/borrowed writes, cancellation, private-generation and publication failures, partitions/allocator, plugin task isolation, lineage, FK/GRANT); existing ordering/FastFail/tombstone controls; focused race repetition; scoped static checks. Extended alter_copy_add_index BVT passed ordinary comparison twice on the same instance, 95/95 statements each with teardown checks. Full Linux/distributed CI remains pending.
Leave the issue open for the reporter to verify after merge.