Skip to content

[Bug]: lineage snapshot advance can resurrect RC deletes after TN flush/merge #29540

Closed

Description

@XuPeng-SH

Observed behavior

While investigating the Ubuntu UT failure in #29535, a PICK transaction updated one SNAPSHOT registry row, then updated two rows after a registry flush and failed its uniqueness guard.

Discovery: https://github.com/matrixorigin/matrixone/actions/runs/36755422383/job/110024440694?pr=29535

Root cause and scope

A lifecycle UPDATE, including a no-op UPDATE, deletes the old Rowid and inserts its replacement. TN flush/merge can relocate the committed row. Advancing only TxnOperator.UpdateSnapshot bypasses the workspace RC tombstone transfer: the old tombstone no longer hides the relocated row, so the transaction sees both that row and its own replacement.

Restoring only the old timestamp with SetSnapshotTS after tombstone transfer also leaves the workspace and snapshot inconsistent and can resurrect deletes.

The affected lineage snapshot paths include COPY ALTER, TRUNCATE, internal PITR, CLONE and snapshot creation. This is independent of the IVF changes in #29535.

Controlled reproduction

  1. Commit rows with distinct primary keys.
  2. In an RC transaction, delete committed rows and insert replacements using the same keys.
  3. Force TN flush/merge to relocate committed rows.
  4. Advance using raw TxnOperator.UpdateSnapshot, bypassing workspace transfer.
  5. Read the exact keys and row count in that transaction.

Expected: each primary key appears once and transaction deletes remain effective.

PR #29539 records an isolated old-behavior mutation of its deterministic regression: expected 10 rows, actual 20, for both in-memory and persisted tombstones. Its original-behavior probes also reproduce resurrection after timestamp-only rewind. These are recorded implementation validation results, not newly rerun during this issue's creation. A public SQL one-liner cannot guarantee the required flush timing.

Proposed fix and verification

Reuse Workspace.AdvanceSnapshot, which already owns RC tombstone relocation; remove timestamp-only rewind after transfer. Preserve the existing physical historical boundary and publication write barrier, without introducing another transfer path or state machine.

Implementation: #29539.

Regression: TestRCLineageSnapshotPreservesUniqueReplacements, using the existing forced-flush harness, covers both tombstone modes, exact key sets, repeated advances and rollback. Existing PICK and statement rollback tests provide integration coverage. The PR records owning-package race validation and public SQL checks; partial transfer I/O failure injection and scale benchmarking remain outside that evidence.

Activity

  1. self-assigned this
    on Oct 1, 2026
  2. added a commit that references this issue on Oct 1, 2026
    7b3d0c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions