Skip to content

[Bug]: TAE incremental dedup treats rewritten rows as concurrent inserts #26162

Closed

Description

@XuPeng-SH

Description

TAE dedup can report a false duplicate when a TN flush or merge physically rewrites rows after an inserting transaction starts.

A TN-created nonappendable object gets a new catalog create timestamp even though the rewrite is not a logical insert. Selecting it by the physical timestamp can mistake preserved old rows for concurrent inserts.

This was observed in TestDelete3 as Phase_PrePrepare: Duplicate entry 0 after delete/reinsert activity overlapped a background flush.

Failing CI: https://github.com/matrixorigin/matrixone/actions/runs/30116607234/job/89558737596?pr=26160

Reproduction

A deterministic reproducer can:

  1. Commit old rows.
  2. Start a dedup transaction and stage matching primary keys.
  3. Flush appendable objects into a TN-created multi-block nonappendable object after the transaction start.
  4. Run incremental/pre-prepare dedup.

Before the fix, the physical rewrite can be treated as new logical data. The same reproducer fails on both 153c318f52adf511b6d7033e6ea80336afa58424 and its parent, so that commit did not introduce the underlying bug.

Required contract

The resolution must preserve both modes:

  • Default pessimistic CheckIncremental: CN primary-key locking and version checks are the correctness boundary, so TN may skip TN-created physical rewrites. Appendable and CN-created objects remain checked, with no new commit-TS I/O on this hot path.
  • CheckAll / SkipWorkspace: TN must inspect rewrites using the preserved per-row commit timestamp so old rows are ignored but truly concurrent same-PK rows still conflict.

Commit-TS loading should be lazy, bounded to once per candidate block, and released on all exits.

Implemented by #26163.

Activity

  1. added a commit that references this issue on Jul 26, 2026
    3128259
  2. added 3 commits that reference this issue on Sep 17, 2026
    6e08788
    4bd0609
    0a443aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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