Skip to content

fix: prune tombstones using merge snapshot - #27173

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/issue-26804-systemic
Aug 14, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
XuPeng-SH:fix/issue-26804-systemic

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Summary

Fixes #26804.

Tombstone merge now prunes a target row only when the target object was committed as dropped at the merge transaction snapshot. A later object drop is retained for a subsequent merge, preventing concurrent data-object generations from losing tombstones.

Adds a deterministic regression covering both snapshot cases.

Validation

  • Focused test and full pkg/vm/engine/tae/db/test pass.
  • Focused race stress (-race -count=100) passes.
  • Full owning-package race test passes.
  • Build and vet pass.
  • On machine 55, the pre-fix baseline regression fails and the fixed version passes.

@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 →

@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.

Deep self-review at 9641014: no blocking code-level issue found.

The production invariant is closed. Tombstone merge still reads the latest catalog entry, but now only prunes a committed target drop when dropTS <= mergeStartTS. This matches TAE delete-version visibility (a committed delete is visible when End <= txn start); uncommitted, rolled-back, and post-snapshot drops are retained. A later merge can reclaim the deferred tombstone. Missing catalog targets keep the existing conservative-GC behavior.

Concurrency/lifecycle review found no new ownership, wait, goroutine, or accumulation risk. The hot path keeps the existing catalog lookup and HasDropCommitted check; the only added work is one TS comparison for committed drops plus one immutable GetStartTS read per block.

Local evidence:

  • focused regression: pass, count=10;
  • focused race regression: pass, count=100;
  • restoring the old HasDropCommitted-only predicate makes the regression fail at CreatedObjs (expected 1, got 0);
  • full pkg/vm/engine/tae/db/test: pass in 94.128s;
  • focused go vet: pass;
  • diff/whitespace checks: clean.

Non-blocking coverage suggestion: add an explicit dropTS == mergeStartTS case. The current integration test covers > and <; I verified that mutating LE to LT still passes it. LE is correct, but the equality boundary is common because a new local txn starts from MaxCommittedTS and deserves a direct regression.

GitHub does not allow this account to approve its own PR, so this is recorded as a COMMENT review. Remote CI was still running and was not used as a substitute for the code review.

@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.

Follow-up for current head 8ebea28: the head change during review is a pure merge of origin/main (parents 9641014 and 09ecd8e). The two PR-owned files are byte-for-byte unchanged from the reviewed parent, and the three merged main commits do not touch the TAE merge path. I re-ran the focused regression with -race -count=10 on 8ebea28; it passes. The prior no-blocker conclusion and equality-boundary test suggestion therefore remain unchanged.

@XuPeng-SH
XuPeng-SH requested a review from LeftHandCold August 14, 2026 16:15
@XuPeng-SH
XuPeng-SH merged commit e7e0818 into matrixorigin:main Aug 14, 2026
24 checks passed
VioletQwQ-0 pushed a commit to VioletQwQ-0/matrixone that referenced this pull request Sep 17, 2026
## Summary

Fixes matrixorigin#26804.

Tombstone merge now prunes a target row only when the target object was
committed as dropped at the merge transaction snapshot. A later object
drop is retained for a subsequent merge, preventing concurrent
data-object generations from losing tombstones.

Adds a deterministic regression covering both snapshot cases.

## Validation

- Focused test and full `pkg/vm/engine/tae/db/test` pass.
- Focused race stress (`-race -count=100`) passes.
- Full owning-package race test passes.
- Build and vet pass.
- On machine 55, the pre-fix baseline regression fails and the fixed
version passes.

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
## Summary

Fixes matrixorigin#26804.

Tombstone merge now prunes a target row only when the target object was
committed as dropped at the merge transaction snapshot. A later object
drop is retained for a subsequent merge, preventing concurrent
data-object generations from losing tombstones.

Adds a deterministic regression covering both snapshot cases.

## Validation

- Focused test and full `pkg/vm/engine/tae/db/test` pass.
- Focused race stress (`-race -count=100`) passes.
- Full owning-package race test passes.
- Build and vet pass.
- On machine 55, the pre-fix baseline regression fails and the fixed
version passes.

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
## Summary

Fixes matrixorigin#26804.

Tombstone merge now prunes a target row only when the target object was
committed as dropped at the merge transaction snapshot. A later object
drop is retained for a subsequent merge, preventing concurrent
data-object generations from losing tombstones.

Adds a deterministic regression covering both snapshot cases.

## Validation

- Focused test and full `pkg/vm/engine/tae/db/test` pass.
- Focused race stress (`-race -count=100`) passes.
- Full owning-package race test passes.
- Build and vet pass.
- On machine 55, the pre-fix baseline regression fails and the fixed
version passes.

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Failed ADD UNIQUE resurrects UPDATE versions and creates duplicate primary keys

2 participants