Skip to content

[4.2-dev] fix(disttae): transfer tombstones only for deleted objects - #27880

Merged
XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/backport-27879-4.2-dev
Aug 31, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
XuPeng-SH:codex/backport-27879-4.2-dev

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Aug 31, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #27878

Backport of #27879 to 4.2-dev.

What this PR does / why we need it:

CN tombstone transfer must move a RowID only when its source object belongs to the exact set deleted in the current (start, end] window. Absence from the persisted-object index is not evidence of deletion because live appendable objects are intentionally absent. Violating this invariant can make large indexed DML fail commit-time RowID cardinality validation and roll back.

This backport:

  • uses exact deleted-object membership for tombstone transfer;
  • aligns in-memory and persisted transfer windows to (start, end];
  • preserves the same boundary for PK-conflict object discovery, including an object transition committed at from.Next();
  • keeps ZoneMap/Bloom pruning and the cardinality guard;
  • batches at most eight source blocks with an 8 MiB soft limit, without adding goroutines, worker pools, or concurrent S3 I/O.

The three commits were cherry-picked cleanly from #27879. Their stable patch IDs match the source commits exactly; no 4.2-specific production-code adaptation was needed.

Validation

Deterministic tests and build

  • Exact selected regression tests were listed and executed on the backport head:
    • TestPartitionState_TransferObjectWindowBoundaries
    • TestDeletedObjectFilterUsesExactTransferWindow
    • TestTransferBatchLimit
    • TestTransferFlowBatchesAcrossObjectBlocks
    • TestTransferFlowStagesOnlyObjectsDeletedInWindow
  • CGo-controlled owning-package tests passed:
    • ./pkg/vm/engine/disttae/logtailreplay
    • ./pkg/vm/engine/disttae
  • make build-with-prebuilt-native passed with libmo.dylib built from the 4.2-dev worktree's own source.

Real 50M black-box QA on this backport head

Validated commit 235ad329ce37a4dbc3c3da1847ebe7a7855f0164 with a newly built mo-service, a fresh data directory, and an isolated SQL port. The database was populated from scratch; no prior data was reused.

QA procedure:

  1. Create one table with a BIGINT primary key, an indexed col3, and a unique indexed col4.
  2. Populate exactly 50,000,000 rows by doubling inserts plus the final bounded insert.
  3. Execute UPDATE write_100m SET col3 = col3 + 1 so the update rewrites every base row and its secondary-index entry while background merges can replace source objects.
  4. Check the base-table count/range/checksums and every row predicate.
  5. Check public secondary-index predicates and unique-index point lookups.
  6. Query both generated hidden index tables directly for index cardinality.
  7. Stop the service cleanly, restart a new process on the same data directory, and repeat all correctness/index checks.

Observed results:

  • Full fresh-data load + UPDATE + first verification: 214.15s.
  • 50M-row UPDATE: 162.644668s.
  • Base table before and after restart:
    • rows: 50,000,000
    • id range: 1..50,000,000
    • col3 range: 2..2
    • sum(id) = sum(col4) = 1,250,000,025,000,000
    • rows violating id = col4 AND col3 = 2: 0
  • Secondary-index predicates before and after restart:
    • col3 = 2: 50,000,000
    • col3 = 1: 0
  • Direct hidden-index cardinality after restart:
    • secondary index table: 50,000,000
    • unique index table: 50,000,000, key range 1..50,000,000
  • Unique-index point lookups for 1, 8192, 8388608, 33554432, and 50000000 returned the exact expected rows after restart.
  • Restarted verification completed in 6.60s.
  • Transfer phases observed on the updated base/index objects completed in 33.99s and 90.76s.
  • No TRANSFER-ROWIDS-ERROR, panic, or fatal log was emitted.

No BVT is added: the public failure requires large data plus background-merge timing, while the violated object-lifecycle and exact-window contracts are covered deterministically by the focused tests. The real 50M procedure above is the scale/regression acceptance evidence for this backport.

@XuPeng-SH
XuPeng-SH requested a review from gouhongshen as a code owner August 31, 2026 01:16
@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

Copy link
Copy Markdown
Contributor Author

Completed a fresh-data 50M black-box validation on backport head 235ad329ce37a4dbc3c3da1847ebe7a7855f0164. The 50M UPDATE completed in 162.644668s; base-table invariants, both hidden index cardinalities, unique-index point lookups, and clean-restart persistence all passed. No transfer error, panic, or fatal log was emitted. Exact procedure and evidence are now recorded in the PR body.

@gouhongshen gouhongshen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Codex automated review

Reviewed the exact PR head, diff, transfer lifecycle, and all existing PR/source reviews and comments; no code findings.

@XuPeng-SH
XuPeng-SH merged commit 8802a98 into matrixorigin:4.2-dev Aug 31, 2026
27 checks passed
@XuPeng-SH
XuPeng-SH deleted the codex/backport-27879-4.2-dev branch August 31, 2026 02:51

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

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.

3 participants