Fix write committed transactions replay when UDT setting toggles (#13121)
commit 282f5a4 ↗ · facebook/rocksdb · · committed Nov 7, 2024 · +473−38 · base 2ba4dceb4c39
Agent prompt
what a new run launched now would send
WriteCommitted TransactionDB WAL recovery breaks when a column family’s user-defined timestamp (UDT) setting is toggled on or off between DB sessions (reopen without deleting, WAL still present).
Reproduction shape:
1. Open a WriteCommitted TransactionDB with a CF that has UDT enabled (or disabled).
2. Leave unflushed WAL records for several transaction outcomes: a named no-op transaction, a prepared-but-uncommitted transaction, a prepared-and-committed transaction (with commit timestamp when UDT is on), a commit-without-prepare, and a rolled-back transaction — spanning default and non-default CFs as appropriate.
3. Reopen without deleting data after flipping that CF’s UDT setting (enable↔disable), still replaying the WAL.
Expected behavior after reopen:
- Prepared-but-uncommitted transactions are still recoverable by name and can be committed; their keys become visible as appropriate for the new UDT setting.
- Already-committed keys remain readable; rolled-back keys stay absent; no-op named transactions do not reappear.
- The same correctness holds for both UDT-enabled→disabled and UDT-disabled→enabled reopen paths.
- Changing write policy away from WriteCommitted while also disabling UDT with a non-empty WAL must continue to fail open (WAL must be emptied for unsupported policy combinations).
Also keep existing timestamp-size consistency/reconciliation behavior for ordinary WriteBatch contents intact when UDT sizes differ.
Interface contract — the change must expose exactly this surface:
HandleWriteBatchTimestampSizeDifference(const WriteBatch*, const UnorderedMap<uint32_t,size_t>& running_ts_sz, const UnorderedMap<uint32_t,size_t>& record_ts_sz, TimestampSizeConsistencyMode check_mode, bool seq_per_batch, bool batch_per_txn, std::unique_ptr<WriteBatch>* new_batch = nullptr); TimestampRecoveryHandler(..., bool seq_per_batch, bool batch_per_txn). Call sites that recover/verify WAL batches must pass the DB’s seq_per_batch / batch_per_txn (or the established false/true defaults where those flags are unavailable).
Work only inside this repository checkout. Make the code change the task
describes, keeping the diff focused — no drive-by refactors.
When you are done, leave your changes committed or in the working tree;
they are collected automatically.
Stay on this snapshot checkout (`task/ycb_rocksdb_c282f5a463ba0`). Never checkout, pull, or rebase onto `main`. That branch is a README-only orphan.
Stay on this HEAD. Do not fetch another default branch. Push only on the Cursor-created `crazy-cursor/…` side branch from this HEAD.
Some past runs of this task were launched with a different prompt (the prompt template changed since, or those runs predate this benchmark's stored prompt). Each run persists the exact prompt it sent at launch — that per-launch record is the audit trail; this page shows only the current one.
Reference diff
The task commit's diff against its first parent — the judge's comparison target.