Skip to content

[tx] Files can join a transaction's page set after the commit lock set is computed #4937

Closed

Description

@lvca

Severity: HIGH (enabler for aborted-tx WAL replay)

Location: TransactionContext.java:644-674 (lock set computed at :652, updateRecordNoLock at :665), serializer/BinarySerializer.java:975,1166 (EXTERNAL property values written to the paired external bucket during phase-1 serialization), index/lsm/LSMTreeIndex.java:515 (during phase 1 status==COMMIT_1ST_PHASE, so indexer.updateDocument writes directly into index pages, incl. indexes created mid-tx that were absent from indexChanges at lock time), TransactionIndexContext.java:248-282 (addFilesToLock omits LSMVectorIndexs companion graph file).

Pages of these late-joining files pass phase-1 checkPageVersion without their file lock held, making the aborted-tx WAL-replay interleaving reachable and producing surprise phase-2 CMEs. Reachable with (a) EXTERNAL properties updated via the deferred path in two concurrent txns, (b) vector-index graph-file writes.

Also note deferred updates apply index mutations twice (directly at :665-673, then via putReplay at :689) - benign for lookups but doubles LSM garbage/compaction.

Fix: after updateRecordNoLock + indexChanges.commit(), assert every file in modifiedPages/newPages is locked; if not, release, re-lock the union, and re-validate (bounded retry). Add the vector graph file id in addFilesToLock.


Filed from an internal engine deep-audit (2026-07). Traced to source; verify against current main before fixing and add a regression test.

Activity

  1. added
    audit
    concurrency
    on Jul 3, 2026
  2. added this to the 26.8.1 milestone on Jul 4, 2026
  3. self-assigned this
    on Jul 6, 2026
  4. added theissue type on Jul 6, 2026
  5. added a commit that references this issue on Jul 7, 2026
  6. lvca commented on Jul 7, 2026

    @lvca
    MemberAuthor

    Fixed in #5053 (merged), two layers:

    1. Multi-file indexes now contribute ALL their component files to the commit lock set: addFilesToLock consumes getFileIds() (plural) and LSMVectorIndex.getFileIds() includes the companion graph file (it returned only the mutable file). This also fixed the latent add(-1) for composite TypeIndex ids.
    2. A generic phase-1 safety net verifies - AFTER all page-set mutation (updateRecordNoLock, indexChanges.commit) - that every file in modifiedPages/newPages is locked, releasing and re-acquiring the UNION in lock order when a late joiner is found (allocation-free fast path on the common no-late-joiner case). In explicit-lock mode an uncovered late joiner (EXTERNAL-property paired bucket, index created inside the transaction) is surfaced as the 'not all the modified resources were locked' contract violation instead of silently expanding the user's lock set - red-first verified via the EXTERNAL-property path.

    This closed the enabler for #4936's aborted-transaction WAL replay.

  7. added a commit that references this issue on Jul 7, 2026
  8. added a commit that references this issue on Aug 14, 2026
  9. added a commit that references this issue on Aug 21, 2026
  10. added a commit that references this issue on Sep 10, 2026
  11. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

auditbugconcurrency

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions