Repository navigation
Conversation
…page
Fixes a silent write-skew miss under DB_TXN_SERIALIZABLE: on a multi-level
B-tree, two transactions whose read and write records sit on different leaves
could both commit a non-serializable history, with no error returned.
Root cause: __lock_get_internal's SIREAD scan had a branch that, when a writer
write-locked an object on which it already held its OWN SIREAD marker, REMOVED
that marker ("upgrading my own read to a write"). Conflict detection is at PAGE
granularity, so holding a WRITE lock on a page does NOT mean the transaction
wrote the record it had read there: a point update of key X write-locks X's
leaf, and the B-tree write descent can also write-lock a different leaf that
carries the transaction's SIREAD from an earlier read of key Y. Dropping that
marker erased the record of "this transaction read key Y", so a later writer of
Y's page by another transaction found no marker and never recorded the
rw-antidependency -- both transactions committed a write skew.
Fix: keep the transaction's own SIREAD marker and merely skip it for
self-conflict purposes (a transaction never forms an rw-edge with itself). The
marker persists exactly like any committed reader's and is reclaimed by the
normal GC (__lock_sicommit at commit, __lock_siclean_obj once its snapshot is no
longer visible), which also balances si_ref -- so the issue-#137 accounting the
old eager drop maintained is preserved by the ordinary path, not lost.
FAIL-before / PASS-after gate: test/isolation/ssi_multiread_skew (0/40 skews at
every tree depth and timing after this change; 20-40/40 before). No format/ABI
change. Backport candidate for lts/2026.10.7.
Workstream S1.
(cherry picked from commit cced5c4)
Add test/isolation/ssi_multiread_skew.c (the deterministic FAIL-before/ PASS-after gate for the cross-leaf SSI write-skew fix) and wire it into the isolation tier's SSI gates and test/MANIFEST. It must PASS at every B-tree depth and both commit timings. Companion to the cherry-picked engine fix on this branch.
Coccinelle convention checksNo new violations. ✅ Resolved since baseline (3) -- update dist/cocci/baseline.txt to lock these in. |
ABI diff vs
|
|
Lead: see #246. The lock.c fix is good to backport, but the second SSI miss, write skew with many records per leaf, is pre-existing on this line too. Hold this PR until S2 lands the second fix, so LTS ships both together. |
Update the qualification verdict now that the second miss is fixed: - verdict -> production-ready on B-tree (both the cross-leaf miss and the lazy-read_lsn / skipped-scan second miss are closed); - deliverable (a) -> PASS, with the before/after cycle-checker numbers and the note that the old CYC_VALPAD=1500 default hid the bug (overflow values put every key on one leaf); - false-abort (d): state the cost plainly -- realistic multi-leaf ~1.0% -> ~2.4% (genuine edges the old code missed), dense single-leaf high but all legitimate; the fix rests on page-granularity MVCC only ever ADDING aborts; - #247 (cross-leaf-only LTS backport) is superseded by the combined LTS backport.
|
Superseded by #258. This PR backported only the cross-leaf write-skew fix ( Recommend closing this PR in favour of #258. (Leaving the branch for the lead to close/delete per the backport cleanup rule.) |
|
Superseded by #258, which carries this PR's lock.c fix (cherry-picked with -x) plus the second-miss and livelock fixes and their progress gates. |
…-miss [2026.10.7] Backport: SSI write-skew fixes (both misses) — supersedes #247
[2026.10.7] Backport: SSI cross-leaf write-skew fix
Backport of the SSI serializability fix from
master(PR #246) to the LTS line.The bug
On a multi-level B-tree,
DB_TXN_SERIALIZABLEsilently admitted a writeskew between records on different leaf pages (both transactions committed a
non-serializable history, no error). Reproduced on this LTS line by the lead and
by
test/isolation/ssi_multiread_skew. Root cause:__lock_get_internal's SSISIREAD scan dropped a transaction's own SIREAD marker when it write-locked a
page it had only read a different key on (page-granularity). Fix: keep the
marker, skip it for self-conflict.
Cherry-pick
One hunk in
src/lock/lock.c. No region/ABI/on-disk/log format change; nothingfrozen moves.
LTS gates
0xe67a9de8== fixed0xe67a9de8(Debian, identical
--enable-diagnostic --enable-test --enable-tclconfigure,same host).
run_handle_sizes.shPASS (6/6);.textdiffers only in
lock.o(36007 → 35655), the one fixed object.ssi_multiread_skew→ 40/40 skews on thebase tag, 0/40 with the fix, at every B-tree depth and both timings.
within tolerance.
run.shgreen (scenarios 0-unexpected at both levels × bothpartition counts; cross-leaf gate 0/40 at both partition counts; GC-pressure;
crash-pivot).
Draft — for lead review and merge.