Repository navigation
fix(disttae): preserve inherited deletes when rewriting cloned objects - #33405
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? |
|
This pull request is merged. |
|
mo-bot review · Commit: PR closed or head changed |
a65afe3 to
f79318c
Compare
|
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: f79318cb2f4565ed3a4f8c002df21e8507a4183e
Assessment: request_changes
The fix reuses the existing table-scoped tombstone tracker and snapshot-aware reader. An independent two-CN probe passed and reproduced the original failure with the base rewrite restored. The committed regression does not include the peer-CN post-commit oracle required by the linked issue.
Model: gpt-6.1-terra / max
Session: 01a21d47-1533-7fb1-84e0-377223542f45 · slot 0 · generation 25
- P2
test/distributed/cases/pessimistic_transaction/clone/clone_delete_ownership.sql:60: After a clone with inherited persisted deletes is rewritten and committed, the regression checks the clone only through the creating session.
Impact: A regression in how another CN observes the committed source or replacement object could pass this test. The independent two-CN probe passed, so this is a maintained-coverage gap, not an observed candidate failure.
Evidence: Linked issue #33079 requests full post-commit row sets from another CN. The added case has no peer session, and the new unit test exercises the tombstone helper rather than a CN. Add the source and rewritten-clone assertions to a maintained two-CN regression, reusing an existing fixture where practical, and run the applicable BVT comparison.
Validation:
-
Private /tmp and loopback preflight passed; receipt 1795804584252184189-2.json and preflight.log.
-
TestWorkspaceRewriteTombstoneOffsets passed with the assigned executor; receipt 1795804901843552582-2.json and go-rewrite-tombstones.log.
-
The complete disttae package passed with -count=1; receipt 1795805209555441462-2.json and go-disttae-package.log.
-
A temporary two-CN SQL probe passed the source, clone, and sibling row-set checks before and after commit; receipt 1795804915621373064-2.json and go-review-clone-multicn.log.
-
The same probe with the base txn_table.go overlaid failed as expected: the clone returned [1, 2, 4] instead of [1, 4]; receipt 1795805033675994549-2.json and go-review-clone-baseline.log.
Limitations:
-
The changed mo-tester case was not run in normal comparison mode because mo-tester was unavailable locally. The reviewer-owned two-CN probe is not a maintained regression.
-
The PR's reported race, multi-block, and timing runs were not independently verified from retained command and exit receipts.
f79318c to
b18bd6a
Compare
|
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: b18bd6abe1f75c33361dd88352c39e9fa2212a6d
Assessment: approve
The rewrite preserves inherited deletions by reusing the table-scoped tombstone index and existing snapshot-aware reader. The previous review’s peer-CN coverage concern is resolved by the maintained two-CN regression. No actionable defects remain.
Model: gpt-6.1-terra / max
Session: 01a21d48-fe75-7291-ad0f-2597b59d3ead · slot 1 · generation 28
Validation:
-
On the assigned head, TestCloneDeleteOwnershipAfterCommitTwoCN passed with the isolated executor, including both writer-CN and reader-CN assertions. Receipt: checks/1795809859814087032-2.json; log: go-multicn-test.log.
-
Private-runtime preflight, native build provenance verification, and git diff --check passed.
-
On the earlier f79318c head, the focused tombstone test and complete disttae package passed. An independent two-CN probe passed and failed with the base rewrite overlaid. The relevant rewrite and existing regression files are unchanged; receipts and logs are retained under prior-review/.
Limitations:
-
The SQL mo-tester comparison was not independently rerun. The PR reports two successful runs, but their logs were not supplied in the local validation evidence.
-
Relevant CI checks were still in progress in the frozen evidence.
gouhongshen
left a comment
There was a problem hiding this comment.
Codex automated review
Reviewed #33405 at head b18bd6a against origin/main, including both existing reviews (no inline comments exist). The prior review's only finding — peer-CN post-commit coverage — was resolved by the author with TestCloneDeleteOwnershipAfterCommitTwoCN and is not restated here. The fix is correct: a clone registers its borrowed tombstone files as DELETE workspace entries under the destination table ID (dstRel.Delete in clone()), so workspaceFlushedTombstones indexes them; rewriteObjectByDeletion previously filtered only the current transaction's pending in-txn offsets, which resurrected rows deleted before the clone in the replacement object. The new gate (txn.isCloneTxn, also set by the LOAD TABLE dump-restore path, which registers restored tombstones the same way) matches exactly the class of transactions whose INSERT entries carry borrowed committed objects, and the compaction pass only rewrites objects recorded as the transaction's own INSERT entries, so ordinary transactions are unaffected and remain free of the lookup. mergeTombstoneOffsets mirrors the previously vetted reader path (LocalDisttaeDataSource.applyWorkspaceFlushedS3Deletes): the same GetTombstonesByBlockId/snapshot semantics, with the object-TS prefix prefilter being conservative (RowidPrefixEq is a min/max intersection, so false positives are eliminated by the per-row block evaluation and no candidate file is missed). Error handling, concurrency, and resource handling check out from code: mergeTombstoneOffsets errors propagate through the callback to the atomic compaction back-out; the index is read under RLock released before file IO, and all index mutations are serialized under the transaction lock the merge already holds; the reusable bitmap is released on every path and auto-extends on adds; ToI64Array resets the scratch so per-block reuse carries no stale offsets; the input slice contracts hold (input deletes are never mutated, the scratch result is consumed synchronously per block). The add-on unit test covers table scoping, object-prefix pruning, merge order/dedup, per-block isolation, context cancellation, and the missing-file failure path, and the BVT .result additions correspond statement-for-statement to the new SQL. Limitation: I could not execute the Go tests in this checkout because the prebuilt third-party artifacts are absent (go build of pkg/vm/engine/disttae fails at cgo compile: usearch.h, roaring.h, xxhash.h, jemalloc.h not found under thirdparties/install, which this checkout has not built; build log retained), so the mo-tester comparison and the two-CN/unit Go tests could not be run locally; the conclusion rests on static verification plus the author's and mo-bot's recorded passing runs of both new tests and the regression suite on this head. No blocking or non-blocking findings to report.
|
mo-bot review · Commit: New discussion was assessed; the previous review remains unchanged. |
…ned objects (#33406) ## 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 #33079 on `4.2-dev`. The corresponding main fix is #33405. ## What this PR does / why we need it: Rewriting a CLONE object in the transaction that created the clone used to apply only the pending DELETE offsets. Inherited tombstones still pointed to old RowIDs, allowing deleted rows copied into a replacement to become visible. Stream the union of the destination table's live tombstones and pending offsets through each rewritten block. Existing zone maps select candidate tombstone files. Reuse a block-sized scratch slice per worker and the existing bounded object registry for uploads. Once metadata is published in the workspace, it owns the replacement. The originals remain live until every rewrite succeeds. The 4.2 workspace can have applied maintenance to earlier statements when a rewrite fails. Use the existing full transaction rollback path in that case. Preserve the storage error and old workspace marks until rollback. The object registry retains unadopted uploads and retries transient cleanup failures. ## Review follow-up The regression now uses the serialized `pkg/embed.RunBaseClusterTests` fixture. It connects directly to two distinct CNs over MySQL, flushes the source data and source delete, and creates and rewrites the clone in one transaction. After COMMIT, the test waits for each CN to apply the writer's commit and compares the complete ordered `(id, a)` rows in both tables on both CNs. Cleanup rolls back the writer and drops the test database on a separate session before the fixture unlocks. [Shared fixture review](#33406 (review)) · [Cross-CN visibility review](#33406 (review)) ## Validation on `4de762f6107031e5def4ec53b0cdea15462d946a` - Base `4.2-dev` is `78fe31d619bd88b0e7638d6178fa904125b23533`. Only the embedded regression changed relative to `fb76588`. - Built the exact `pkg/embed` test target with `-tags matrixone_test`. `TestCloneRewriteKeepsPersistedDeletesAcrossCNs` and `TestCloneDatabaseForeignKeySourceInventory` passed five repetitions in the same process. Five separate pre-COMMIT interruption probes also verified that both CNs saw no remaining test database after rollback and cleanup. Work returned `EPERM` for Unix socket creation, so the local embedded test runs selected the TCP listener in a temporary startup overlay. - Ran the checked-in `clone_delete_ownership.sql` and `.result` with `mo-tester` at `309a0ca650e0c55e90292767fd61e4976818d66d` in normal comparison mode. All 68 statements passed with zero ignored. - The existing `TestWorkspaceRewriteTombstoneOffsets` and `TestCloneRewriteFailureRequiresFullRollback` each passed five repetitions on this source tree. Both injected failure paths retained the originals, reclaimed replacement objects, and exercised reclamation retry for the ambiguous upload. - `git diff --check` passed. [Hosted CI on this head](https://github.com/matrixorigin/matrixone/actions/runs/46066246766) is pending. ## Previous validation on `fb76588` - The original two-CN integration fixture passed four executions, including a repeat after fetching its published source tree. The rollback and reclamation tests each passed ten times. The SQL fixture passed 68 statements with zero ignored using ordinary `mo-tester` comparison. - The shared build, ARM64 SCA, x86 UT, proxy and pessimistic Compose BVT, Shanghai OSS/COS, and Coverage Group 0 passed on this previous head. Coverage Group 1 was cancelled. [Previous-head CI](https://github.com/matrixorigin/matrixone/actions/runs/46057272242) · [Shanghai coverage artifact](https://github.com/matrixorigin/matrixone/actions/runs/46057272242/artifacts/15226923362) ## Earlier hosted CI - The ARM64 SCA setup, x86 UT setup, shared build, Shanghai OSS/COS setup, proxy Compose launch, and pessimistic Compose launch each stopped after repeated HTTP 504 responses downloading ONNX Runtime. The failures occurred before analysis or test execution in those jobs. The Compose coverage steps also lacked the outputs of the failed launch. The new base includes the ONNX download fallback from #33408. [Previous CI run](https://github.com/matrixorigin/matrixone/actions/runs/46049955761) - Coverage Group 1's selector received HTTP 403 reading and revoking worker metadata. The worker also hit a separate assertion in `TestIvfCreateStart_Error/Invalid_params_json`, and the coverage aggregate stopped because a required profile was unavailable. The failing test and Sonic dependency match the base. A local decoder probe with the same malformed input returned `Syntax error` on Go 1.26.4 and `unexpected EOF` when Go 1.27.1, the worker version, selected Sonic's standard-library fallback. [Selector](https://github.com/matrixorigin/matrixone/actions/runs/46049955761/job/140678968449) · [Worker](https://github.com/matrixorigin/matrixone/actions/runs/46050113266/job/140679041824) · [Coverage aggregate](https://github.com/matrixorigin/matrixone/actions/runs/46049955761/job/140699827183) ## Earlier validation on `3fbe98e` - On two CNs, all 57 rows in the clone ownership fixture and 20 more transaction observations matched, including source and sibling isolation, a same-transaction source DELETE, rollback and an empty replacement. - The 32,768-row multi-block probe resurrected two rows on the base and zero on the candidate. In 18 timed samples per case, including actual rewrite at the next statement boundary, median latency was 0.651 → 0.569 ms for ordinary DELETE, 23.759 → 21.282 ms for a clean clone and 23.727 → 21.526 ms for a clone with inherited tombstones. These timings are from the same local setup. - Failure injection covered a missing tombstone and an upload that wrote its file but returned an error. Full rollback preserved the original objects and reclaimed the recorded replacement. The registry reclaimed the unadopted upload after an injected delete failure. - The full `disttae` package passed under `-race`. Incremental SCA reported zero issues. Hosted CI runs separately. --------- Co-authored-by: Codex <[email protected]>
What type of PR is this?
Which issue(s) this PR fixes:
Addresses #33079 on
main. The 4.2-dev workspace is handled in a separate backport.What this PR does / why we need it:
CLONE can share a data object and its tombstones. A DELETE later in the same transaction rewrites the object. The old rewrite filtered only new offsets, which could copy an already deleted row into a new RowID.
Apply the destination table's live workspace tombstones to each rewritten block before writing surviving rows. Existing RowID zone maps prune candidate files. The rewrite retains the existing snapshot, staged publication and rollback contracts. Ordinary writes and compaction outside clone transactions acquire no tombstone lookup.
Validation
mainat226f575cfe360b14e6d24cb26fc97de037d940ea.TestCloneDeleteOwnershipAfterCommitTwoCNto the maintained SQL integration suite for review #6092250895. It uses the shared fixture, connects directly to both SQL frontends, and waits for the reader CN's logtail to reach the writer's commit. Both CNs then compare the full ordered source[1, 3, 4]and clone[1, 4]row sets. Both runs passed.txn_table.gorestored from the verifiedmainbase reproduced the defect on both CNs. Each returned clone IDs[1, 2, 4].clone_delete_ownership.sqltwice against the same test cluster in normal mo-tester comparison mode (-n -g -o -p). Both runs passed all 59 statements with zero skipped. Verified database cleanup after each run.TestWorkspaceRewriteTombstoneOffsetsand five existing clone, compaction, and publish-failure tests passed. The fulldisttaerun was stopped after the environment refused the Unix socket used byTestWaitServerReady/ok.git diff --checkand Go formatting checks passed.