Skip to content

[4.2-dev] fix(disttae): isolate clone deletes by logical table - #33043

Merged
XuPeng-SH merged 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/32500-42
Nov 21, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/32500-42

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Fixes #32500

What this PR does / why we need it:

CLONE can share a physical CN object across multiple logical tables. The 4.2 workspace keyed pending deletes and object metadata by physical ID alone. A DELETE against a source or a clone could therefore be hidden on the target and applied to a sibling clone after commit.

Adapt #32555 to the 4.2 workspace. Include the logical table ID in object lookups, deleted-row collections, and compaction jobs. Use the existing workspace entry lifecycle to track file-backed tombstones per table as well. This also fixes a related case where cloning a table with a persisted delete could hide the same row on the original table inside the clone transaction.

Validation

  • Reproduced the issue on both CNs of an unmodified 4.2-dev cluster using pessimistic READ COMMITTED.
  • Validated the original repro, two-target DELETE, indexed-column UPDATE, rollback, and cross-CN reads after commit on a patched two-CN cluster.
  • Ran every statement in the new SQL regression against the patched service and compared its results with the checked-in fixture, including the persisted tombstone case.
  • Passed disttae unit tests with and without race, two focused engine regressions, and incremental lint.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 3c1bd331c5d72eca505c927f905980123dbb6413

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 3c1bd331c5d72eca505c927f905980123dbb6413

Assessment: approve

The 4.2-dev backport isolates pending deletes and compaction by logical table. File-backed tombstones follow the existing workspace entry lifecycle, and garbage collection preserves objects still referenced by another clone. The fix requires no storage-format or protocol change.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • All 423 top-level disttae tests passed with and without race detection.

  • The checked-in SQL fixture passed through the MySQL frontend twice on the same embedded cluster. Each run checked 21 result sets and repeated 13 post-transaction queries from a second CN. Session restoration and database teardown were verified. A separate run with race detection also passed.

  • Runtime preflight, native input hash verification, and git diff --check passed. The matching receipts and retained logs are indexed in review-evidence.md.

Limitations:

  • The SQL replay used the embedded cluster and Go MySQL driver. The frozen evidence did not include a completed mo-tester comparison.

@XuPeng-SH
XuPeng-SH merged commit 6c05e42 into matrixorigin:4.2-dev Nov 21, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/32500-42 branch November 21, 2026 16:40
XuPeng-SH added a commit that referenced this pull request Nov 21, 2026
## What type of PR is this?

- [x] BUG

## Which issue(s) this PR fixes:

Related to #32500

## What this PR does / why we need it:

Follow up on #32555 and #33043. When a transaction clones a table that
already contains a persisted delete, the clone's file-backed tombstone
can also hide the row on another table that shares the same physical
data block.

Scope the existing flushed workspace tombstone index by logical table
and update it through workspace-entry accounting. Both local scans and
tombstone collection now read only their table's records, with duplicate
live entries tracked until the final reference is released. Staged
publication and physical-file cleanup keep their existing owners.

Validation on Go 1.27.1, Darwin arm64:

- Reproduced on unmodified `main` at `f1ffbaaff35d`: the original table
lost `id=1` in the transaction after the second clone was created.
- Verified the extended clone SQL regression, including rollback, a
fresh clone, and commit, on both CNs in a local pessimistic READ
COMMITTED cluster.
- Ran `disttae` unit tests, race tests, focused engine tests and
incremental lint.


Additional validation on Go 1.27.1, Linux amd64:

- Published a real tombstone through the workspace write path. With two
tables sharing a data block, both tombstone collection and local row
filtering respected table ownership. Releasing one duplicate
registration kept the delete visible, and releasing the last removed it
from both read paths.
- The full `disttae` package passed under `-race`. Incremental
formatting, vet, molint and golangci-lint checks passed.

This branch was previously deployed

1 inactive deployment
ci — 3c1bd331 Deployed Nov 21, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants