Repository navigation
fix(disttae): bound long-transaction workspace maintenance and close orphan-cleanup ownership - #30988
Conversation
06c583c to
a1aefd5
Compare
…iles The SCA license job of run 39994645622 failed on this PR: license-eye reported 12 files added by PR matrixorigin#30988 without a valid Apache-2.0 header. Nine files (the relay/admission sources, their tests and txn_issue25590_test.go) carried no header at all; the three r33/r34 disttae tests carried a header with a noncanonical license URL (http://www.apache.org/licenses-2.0 instead of .../LICENSE-2.0), one also reflowing the "either express or implied" clause. All 12 now carry the repository's canonical Matrix Origin Apache-2.0 header, byte-identical to sibling table_meta_reader_r32_test.go which passes the same check. Verified with the pinned CI tool (license-eye v0.4.0): the header check over the 12 files reproduces the CI failure on the pre-fix head (12 invalid, exit 1) and passes after the fix (12 valid, exit 0); the full-tree header check reports 0 invalid files (exit 0). Comment-only change: gofmt -l and parse checks over the 12 files are clean.
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 921be87c932825c4d30dff0af7b0dfcbeb2aefa6
Assessment: request_changes
Prior runtime concerns are resolved. One repository-required delivery cleanup remains; the latest approval does not address this artifact requirement.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
docs/design/20261021-issue-25590-workspace-scaling-and-cleanup-ownership.md:4657: The committed design includes extensive per-run CI/review narratives, although the preexisting repository review contract explicitly excludes review attestations and one-off proof narratives from tracked delivery.
Impact: Obsolete test-run details and transient evidence become maintained documentation, obscuring the operative design and violating the delivery-artifact requirement. This is a policy finding, not a demonstrated runtime failure.
Evidence: .agents/skills/mo-self-review/SKILL.md:65–74 establishes the requirement at both base and head. This section records CI jobs, reproduction results and /tmp logs for removed receiver-refusal/R15 tests. Remove or externally archive that chronology while retaining the current design, substantive decisions and compact approval trace.
Validation:
-
Static audit passed: checks/1793304223628960872-4.json matches review-audit.log and the clean frozen head.
-
All 74 discussion entries accounted for in discussion-assessment.json.
-
Reconciled current-head CI successes and supplied author validation; details retained in review-evidence.json.
Limitations:
-
No new Go tests were run for this source-established delivery finding.
-
CI status metadata and author reports were available; their raw execution logs were not supplied.
aunjgr
left a comment
There was a problem hiding this comment.
My earlier failed-delete ownership finding is fixed: failed accepted batches now transfer to the retry queue without releasing capacity. One required delivery-artifact cleanup remains.
|
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: 921be87c932825c4d30dff0af7b0dfcbeb2aefa6
Assessment: request_changes
The failed-delete ownership fix is present. The existing delivery-artifact finding remains; runtime approval does not resolve that requirement.
Model: gpt-6-astra / xhigh
Session: 01a1869d-999c-7481-b340-ae4a63e8cee4 · slot 1 · generation 2
- P2
docs/design/20261021-issue-25590-workspace-scaling-and-cleanup-ownership.md:4657: The committed design retains extensive per-run CI and review narratives, including a removed receiver-refusal test.
Impact: This violates the repository’s delivery-artifact requirement and obscures the operative design. Externalize transient chronology while retaining current invariants, meaningful decisions and a compact approval trace.
Evidence: .agents/skills/mo-self-review/SKILL.md:65–74 excludes review attestations and one-off proof narratives; the rule is identical at base and head. The CI records beginning at lines 4657 and 4718 remain. This confirms the existing policy finding, not a runtime defect.
Validation:
-
Static audit passed: checks/1793357253562126284-2.json matches review-audit.log and the clean frozen head.
-
All 78 discussion keys accounted for exactly once in discussion-assessment.json.
-
Reconciled current-head successful UT, SCA, coverage and multi-CN BVT metadata; receipt and log details retained in validation-ledger.json.
Limitations:
-
This contextual follow-up reused supplied same-head runtime coverage; no new Go tests or exhaustive runtime audit were performed.
-
Raw CI and author execution logs were not supplied.
…ed design record The 2026-10-30 delivery review of PR matrixorigin#30988 (P2 at the r15 record) enforced the repository's delivery-artifact contract (.agents/skills/mo-self-review/SKILL.md): per-run CI/review evidence - CI run and job identities, local reproduction log narrations, per-head red/green execution records and review attestations - is excluded from tracked delivery. The operative design text (§1-§9), every revision's findings, decisions and supersessions, and the compact approval trace are retained unchanged; each implementation round keeps its finding, its trigger analysis, its decision and its maintained regression coverage, and now references the executed evidence through the external archive and GitHub's CI artifacts. The complete pre-maintenance document is preserved byte-identical outside the tracked repository with the loop controller (snapshot at head 921be87, sha256 5276bf5f6da64802189ac7cfbd3b38830816d3752212a3fc69dd122c9e165e70). No design decision, invariant, or validation requirement changes.
|
@XuPeng-SH — delivery-cleanup round (P2 at Your finding re-checked against the contract first: Disposition at
Static verification for the artifact requirement: the diff is the single design document (332 insertions/885 deletions at review time; LF-only, no trailing whitespace or tabs), the PR head moved |
|
@aunjgr — thanks for both confirmations. You verified at head That cleanup is delivered at the freshly pushed head
The full disposition (with the post-edit audit: zero |
|
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: c7b40fabac7bef97c517f2323601328ced3256c0
Assessment: approve
Prior ownership, capacity, cleanup and lifecycle findings are resolved. The documentation cleanup closes the remaining delivery concern. No actionable unresolved findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Reviewed affected ownership paths, failure recovery, remote settlement, regression oracles and all 84 discussion entries; saved discussion-assessment.json.
-
Static audit passed: 73 changed paths and 191 hunks match frozen sources; source remains clean; 64 Go files pass gofmt parsing/format checks; new single-row SQL expectations match independent transaction arithmetic.
-
Receipt checks/1793503442746065635-3.json reconciled with review-audit.log and validation-reconciliation.json.
-
Frozen CI metadata reports successful build, UT, coverage, static analysis and two multi-CN BVT lanes.
Limitations:
-
No local Go tests, race tests, BVT or benchmarks were run. Raw CI and author execution logs were not supplied.
-
The documented crash-mid-queue orphan limitation remains within the accepted design scope.
aunjgr
left a comment
There was a problem hiding this comment.
The previous accepted-worker deletion failure is now routed into the retry owner without falsely settling capacity. I traced the current queue/reservation/recorded-holder ownership, statement-boundary staging and remote adoption/ACK settlement paths. One verified failure-path test cleanup blocker remains inline. This review does not claim a new local runtime/race run or a complete fresh implementation PASS; green CI and the supplied validation are reused.
|
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: c7b40fabac7bef97c517f2323601328ced3256c0
Assessment: request_changes
New discussion changes the prior approval: one P2 test-cleanup defect is confirmed. Previously resolved production and design concerns remain closed.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
- P2
pkg/vm/engine/disttae/txn_issue25590_test.go:2339: After Rollback schedules orphan cleanup, a fatal assertion at lines 2344–2351 exits the test before closeDeleteGate runs.
Impact: The drain worker can remain blocked indefinitely, retaining fixture state beyond teardown. Pool release and context cancellation cannot unblock the private channel receive.
Evidence: Delete waits at line 1604 on <-gate without cancellation; the sole release is at line 2354, with no registered fallback cleanup. This confirms review_comments:4440766469 and violates the repository's assertion-failure cleanup contract. Register an idempotent release immediately and boundedly join the drain before pool/file-service teardown.
Validation:
-
Read and classified all 88 discussion entries; saved discussion-assessment.json.
-
Static audit confirmed the frozen head, unchanged source, matching patch and failure-path control flow: checks/1793613230783136383-3.json and review-audit.log.
-
Receipt, log and artifact reconciliation passed: checks/1793613275218976177-4.json and validation-reconciliation.json.
Limitations:
-
No new Go, race or BVT tests ran; the finding is established by source analysis.
-
Reused review 5726235176 for unchanged coverage. Its original artifacts and raw CI/author logs were unavailable; supplied CI successes are status metadata only.
…d cleanup TestIssue25590RollbackHandsOrphanCleanupToEngineGC released its gated, context-blind Delete only through the body's explicit call after the synchronous assertions, so a failing require exited through FailNow and leaked the parked GC worker and the fixture's storage - pool.Release cannot end a channel wait. gateDeletesAfter now closes through a sync.Once (idempotent, matching armDeleteBlock/armDeleteIgnoreCtxBlock), issue25590RegisterDeleteGateRelease registers the release immediately at the arming - t.Cleanup runs it first, ahead of the pool and fixture teardown, and joins the engine queue's drain boundedly after the release - and the explicit body release stays the ordering oracle. The new TestIssue25590DeleteGateCleanupReleasesParkedWorker ends its body at exactly the FailNow state so a teardown-order witness pins the failure path red/green; the round-62 design record carries the trail.
|
Combined disposition for the two (a) The 2026-11-02T09:55:22Z review (review id 5734755552, generation 2, head (b) The 1. The generation-1 frozen head is disconnected, pre-rebase. 2. The specific P2 text it quotes was mid-flight state, long superseded. At the frozen head, doc lines 2678–2681 carry "r11 is submitted for independent design review; this handler does not self-approve the design gate, and implementation proceeds only after the reviewer's PASS on r11." At the current head, the same subjects carry the recorded outcomes instead:
3. The approval artifacts exist and are identified. The r17 PASS artifact and the full |
|
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: fce13c950cc6dbb7a62ad578c616e23bcf8c5a10
Assessment: approve
The outstanding test-cleanup finding is resolved: gate release is idempotent, registered before fatal assertions, and exercised by a cleanup-only regression. Verified unchanged production and design coverage remains applicable. No actionable findings remain.
Model: gpt-6-astra / xhigh
Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2
Validation:
-
Verified frozen head, clean source, complete change map, and two-file increment since the prior approved head.
-
Three focused cleanup tests passed normally and under the race detector.
-
Both affected concurrency tests passed separate race-enabled runs of 100 repetitions each.
-
Isolation preflight, native-library provenance qualification, git diff --check, and formatting checks for 64 Go files passed.
-
Reconciled all 93 discussion entries. Commands, terminal receipts, logs, and source fingerprints are recorded in validation-evidence.json and final-validation-receipt.json.
Limitations:
-
Prior full-review coverage was reused after source comparison; its original raw artifacts were unavailable.
-
Frozen CI statuses were inspected without raw CI logs. Full-suite, cluster SQL, restart, and performance checks were not rerun for the test-only increment.
Merge origin/main (523ab21) to clear the base conflict. The only textual conflict was pkg/vm/engine/disttae/txn.go: main's matrixorigin#32076 copies borrowed vector data before in-place mutation and propagates allocation failures through shrinkWorkspaceEntryBatchLocked, deleteBatch and their callers, while this branch retires fully-superseded workspace entries through the same functions (issue matrixorigin#25590). The resolution keeps both contracts: - shrinkWorkspaceEntryBatchLocked returns (retired bool, err error): every vector's borrowed data is copied into writable storage before any row is shrunk and an allocation failure propagates before mutation, leaving the entry's accounting and pending selections untouched (upstream matrixorigin#32076), while an entirely-superseded batch is still retired through releaseWorkspaceEntryBatchLocked with the branch's statement-dump ordering (matrixorigin#25590). - mergeTxnWorkspaceLocked propagates the shrink error; upstream's failure oracle (TestBorrowedWorkspacePreparationFailurePreservesState) now also asserts that a failed preparation retires nothing. - The branch's nine deleteBatch test call sites take two values with an explicit NoError check on the now-fallible path. - All other overlapped hunks merged cleanly with both sides' guarantees intact: fileservice's concurrent-deletion IsNotExist swallow lives inside main's deleteLocalFile helper; sinker keeps the capacity-hook plumbing around main's fetchBuffer/pushStaged/WriteOwned error-path ownership fixes; s3WriterDelegate layers main's ShrinkByMask error and taken-ownership-on-error semantics over the branch's delegate rebind; multi_update's filterTargetRows keeps the reused-delegate workspace rebind around main's shrink-failure cleanup; CommitWaitInjected runs through scoped fault triggers preserving the branch's commit-barrier selectors. Focused disttae regressions (upstream failure oracle plus the branch's retirement, rollback and mixed-ownership families) pass on the merged tree.
|
mo-bot review · Commit: Review discussion changed before publication; a fresh contextual review is queued. |
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Follow-up review of head a077925, which adds exactly one merge commit (origin/main 523ab21) over the previously reviewed head fce13c9. Disposition of prior blocking topics: (1) aunjgr's P1 successful-transfer remote-workspace leak — fixed earlier via the FinalizeRemoteFragmentWorkspace teardown and unchanged by this merge; (2) aunjgr's accepted-GC-worker unproven-deletion settlement — fixed via requeueFailedGCUnpublishedPending, present at this head; (3) aunjgr's design-doc chronicle — compacted at c7b40fa, untouched by the merge; (4) the context-blind deletion-barrier test cleanup (aunjgr P2, confirmed by mo-bot review 5734755552) — fixed at fce13c9 with an idempotent sync.Once release registered through issue25590RegisterDeleteGateRelease; its regression TestIssue25590DeleteGateCleanupReleasesParkedWorker passes here. The mo-bot approved fce13c9; no prior blocker remains open. New-surface review: the merge's remerge-diff confines manual resolution to pkg/vm/engine/disttae/txn.go plus three test files. The resolution keeps both contracts: upstream #32076's borrowed-vector copy with pre-mutation allocation-failure propagation, and the branch's issue-#25590 fully-superseded-entry retirement (shrinkWorkspaceEntryBatchLocked now returns (retired, err); mergeTxnWorkspaceLocked propagates the error and already discarded the retired flag at the previous head, so no behavior change). Merged deleteBatch is byte-identical to upstream; all 5 production and 11 test call sites handle the new error return. Clean-merge overlap areas named in the commit message (fileservice deleteLocalFile IsNotExist swallow, sinker capacity hook, s3WriterDelegate rebind, multi_update filterTargetRows, CommitWaitInjected scoped faults) compose correctly with the PR's changes intact, and no code references upstream-removed fields (tnID, clusterByIdx). Verification: built the bundled native libs with the documented make cgo target; go build passes for disttae, colexec, compile, objectio and fileservice; 20 focused tests pass on the merged tree — 11 conflict-area tests including upstream's failure oracle TestBorrowedWorkspacePreparationFailurePreservesState plus the retirement/rollback/mixed-ownership families, 2 delete-scan tests, and 7 multi_update delegate capacity/rebind tests. No findings.
|
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: a07792564a7fb807b34c5ebdc38e5116086e7f82
Assessment: approve
Prior findings are resolved or superseded. Workspace retirement and cleanup accounting coherently reuse existing owners; separate reservation, workspace and GC claims preserve distinct lifecycle obligations. The merge preserves borrowed-vector failure handling and empty-entry retirement. No actionable findings remain.
Model: gpt-6.1-sol / max
Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0
Validation:
-
Reconciled all 73 paths and 97 discussion entries. Reused prior approved coverage after verifying 60 identical source blobs and 69 unchanged file deltas.
-
Formatting passed for all 64 changed Go files. Static audit passed for source/patch identity, discussion coverage, receipt reconciliation and independent SQL-result arithmetic. Records are retained in validation-evidence.json.
-
Frozen-head CI reports 13 successful contexts, including build, UT, coverage, static analysis and both multi-CN BVT lanes; 14 skipped and 2 neutral contexts were not counted as passes.
Limitations:
-
No fresh Go, race, native-build, SQL/BVT or benchmark execution occurred locally.
-
Raw CI and historical execution artifacts were unavailable; reused evidence retains that qualification.
-
The documented crash-mid-queue restart limitation remains accepted.
aunjgr
left a comment
There was a problem hiding this comment.
Follow-up review at a077925. My earlier deletion-barrier cleanup blocker is resolved: release is guarded by sync.Once and registered before the fatal assertions, and the added cleanup-only regression leaves release to teardown rather than relying on the normal body. The earlier remote-transfer teardown and failed accepted-GC batch requeue fixes remain present.
I reused my prior review of the workspace/queue/reservation/recorded-holder and remote adoption/ACK closures, then inspected the two first-parent updates: the focused cleanup repair and main merge. The manual txn.go resolution preserves both empty-entry retirement and borrowed-vector preparation/error propagation before shrink/accounting mutation; callers now propagate the fallible shrink/delete contract. No new blocker found in this follow-up. The approved r17 design remains the governing contract; I am not reopening superseded mixed-version requirements.
Validation: reused current-head successful build, UT, SCA, coverage and both BVT lanes, plus scoped author post-merge regression evidence. No new local runtime/race run, and this is not represented as an entirely fresh full-PR audit.
✅ Merged into
|
What type of PR is this?
Which issue(s) this PR fixes:
Related to #25590
What this PR does / why we need it:
Long explicit transactions repeatedly updating the same primary-key rows rescan superseded workspace history at statement boundaries and during reads. This PR keeps incremental per-table views and compacts superseded entries so maintenance follows the live working set. The issue's UPDATE, REPLACE and DELETE+INSERT cases are covered by focused workspace tests and SQL cases.
Persistence and compaction also need a complete ownership contract: every unpublished object must reserve bounded capacity and remain owned until publication or cleanup. The implementation centralizes that contract in the workspace/engine, retains failed cleanup work, and drains it with bounded batches/backoff and a single shutdown budget. Local writers and remote fragments share the same same-version admission contract running on one build; remote ownership transfer proves the coordinator's intake adoption through the run's own batch-flow sequence/ack/drain barrier, installed in both stream modes (negotiated windowed and no-window alike), and clone-borrowed objects retain their existing owner. No per-feature protocol version, peer-capability gate or legacy fallback exists anywhere in the diff (the design document's
r16/r17records record that removal). Main's #26796 key-index/envelope ownership and Engine.Close shutdown ordering are preserved.The versioned design carries the operative r17 design, the decision log, the per-round review records with their approval trace, and the per-invariant validation criteria (§7).
Delivered behavior
Validation
Focused deterministic regressions cover each contract in its owning packages (
pkg/vm/engine/disttae,pkg/sql/colexecwithmulti_update/insert/deletion,pkg/sql/compile,pkg/objectio/ioutil) and at the engine level (pkg/vm/engine/test), with-racelegs for every synchronization-bearing change and counterexample-red/green proofs run during review. The context-blind deletion barrier's own failure path is pinned the same way: its release and bounded drain join run through the test's registered cleanup (idempotent against the explicit ordering-oracle release), andTestIssue25590DeleteGateCleanupReleasesParkedWorkerproves the state a failing assertion leaves behind holds no parked worker. SQL-visible behavior is pinned bytest/distributed/cases/dml/{update,delete,replace}_workspace.*andupdate_remote_fragment_capability.{sql,result}; every generated result was inspected against the intended semantics. The maintained per-invariant coverage spine and its criteria are recorded in the design document's §7.Review and validation history
Each review round's finding, repair decision, and outcome is recorded in the design document's review records, with the compact approval trace in that document's header. This description previously carried the per-round execution chronicle as well; it was removed on 2026-10-30 after the delivery review's P2 on the same class in the design document (the repository's review contract excludes per-run evidence and review attestations from tracked delivery). The pre-cleanup design document and description are archived byte-identical outside the tracked repository with the loop controller; per-run CI evidence remains available through GitHub's run artifacts.
CONFLICTINGbase state by mergingorigin/mainat523ab21543(upstream Protect borrowed vector data during in-place mutation #32076 among other advances). The single conflict,pkg/vm/engine/disttae/txn.go, resolved to the union of [Bug] AI-WALK (Txn workspace): repeated mutations degrade super-linearly in long transactions #25590's superseded-entry retirement and Protect borrowed vector data during in-place mutation #32076's borrowed-vector protection:shrinkWorkspaceEntryBatchLockednow returns(retired bool, err error)— borrowed vector data is copied into writable storage before any in-place shrink, an allocation failure propagates before mutation and retires nothing, and a fully-superseded batch still retires through the statement-dump-ordered release.mergeTxnWorkspaceLockedpropagates the shrink error, upstream's failure oracle now also asserts that a failed preparation retires nothing, and the branch'sdeleteBatchtest call sites assert the now-fallible path. Post-merge validation: the focused disttae regressions (upstream failure oracle plus the retirement/rollback/mixed-ownership families), the fullTestIssue25590*regression family, themulti_updateandobjectio/ioutilpackage suites, andgo vetacross the changed closure all pass through the repository's CGo wrapper.Known limitations
TestCrossTargetUpgradeRecoveryhang) — with reproduction records posted there; this PR's CI record is evaluated against them.