Skip to content

feat(txn)!: DB_TXN_SNAPSHOT is now serializable snapshot isolation (SSI); remove DB_TXN_SNAPSHOT_SAFE - #133

Merged
gburd merged 2 commits into
masterfrom
feat/snapshot-is-ssi
Aug 3, 2026
Merged

feat(txn)!: DB_TXN_SNAPSHOT is now serializable snapshot isolation (SSI); remove DB_TXN_SNAPSHOT_SAFE#133
gburd merged 2 commits into
masterfrom
feat/snapshot-is-ssi

Conversation

@gburd

@gburd gburd commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

BREAKING (ABI, deliberate). DB_TXN_SNAPSHOT now provides serializable snapshot isolation (SSI) — snapshot isolation + Cahill serializable conflict detection — and the separate DB_TXN_SNAPSHOT_SAFE flag (0x800) is removed. This drops the awkward _SAFE flag name in favor of the natural DB_TXN_SNAPSHOT, at the cost of an ABI break the maintainer accepted.

There is no longer a plain, non-serializable SI mode via the public API: every snapshot transaction gets SSI, may be aborted with DB_SNAPSHOT_UNSAFE / DB_SNAPSHOT_CONFLICT, and cannot be 2PC-prepared.

Engine

  • txn.c: DB_TXN_SNAPSHOT (and env-wide DB_ENV_TXN_SNAPSHOT) now set both the internal TXN_SNAPSHOT substrate and TXN_SNAPSHOT_SAFE (SSI) states; removed DB_TXN_SNAPSHOT_SAFE from the txn_begin OK_FLAGS mask; prepare() message updated.
  • dist/api_flags + regenerated api_flags.in + build_windows/db.h: flag definition removed, 0x800 freed. db.in: internal TXN_SNAPSHOT comment clarified.
  • lang/tcl: -snapshot_safe kept as a compat alias for -snapshot (both now SSI) so existing SSI tests run unchanged.
  • The internal TXN_SNAPSHOT_SAFE state + all SSI machinery (SIREAD markers, lock.c GC, db_meta.c) are unchanged.

Docs / RFC / bench

  • docs_src: txnbegin.md merges the two entries into one SSI DB_TXN_SNAPSHOT; isolation/transaction guides, envset_flags, program_errorret, and the flag-reconcile doc updated with a stock-BDB-vs-fork note.
  • README.md, RFC 0003 (Amendment note), INDEX.md updated.
  • test/bench/ssi_abort_bench.c uses DB_TXN_SNAPSHOT (builds clean).

Verified

Builds clean; ssi001ssi009, txn001/003, test001 btree/hash all pass; docs build clean; bench builds.

gburd added 2 commits August 3, 2026 14:05
BREAKING (ABI): DB_TXN_SNAPSHOT now provides serializable snapshot isolation
(SSI) -- snapshot isolation plus Cahill serializable conflict detection -- and
the separate DB_TXN_SNAPSHOT_SAFE flag (0x800) is REMOVED.  There is no longer a
plain, non-serializable SI mode via the public API: every snapshot transaction
gets SSI and may be aborted with DB_SNAPSHOT_UNSAFE / DB_SNAPSHOT_CONFLICT, and
cannot be prepared for two-phase commit.  This drops the awkward _SAFE flag name
in favor of the natural DB_TXN_SNAPSHOT, at the cost of a deliberate ABI break
(the maintainer accepted this).

- txn.c: DB_TXN_SNAPSHOT (and the env-wide DB_ENV_TXN_SNAPSHOT) now set both the
  internal TXN_SNAPSHOT substrate and TXN_SNAPSHOT_SAFE (SSI) states; removed
  DB_TXN_SNAPSHOT_SAFE from the txn_begin OK_FLAGS mask; prepare() rejection
  message updated to name DB_TXN_SNAPSHOT.
- dist/api_flags + regenerated src/dbinc_auto/api_flags.in + build_windows/db.h:
  DB_TXN_SNAPSHOT_SAFE definition removed; its 0x800 bit is freed.
- db.in: internal TXN_SNAPSHOT comment clarified (substrate, always with SSI).
- lang/tcl: -snapshot_safe kept as a compat alias for -snapshot (both now SSI)
  so existing SSI tests keep working unchanged.

The internal TXN_SNAPSHOT_SAFE state and all SSI machinery (SIREAD markers, the
lock.c GC, db_meta.c conflict recording) are unchanged.

Verified: builds clean; ssi001-009, txn001/003, test001 btree/hash all pass.
Follow the DB_TXN_SNAPSHOT_SAFE removal through the rest of the tree:
- docs_src: txnbegin.md merges the two flag entries into one DB_TXN_SNAPSHOT
  (SSI) description; envset_flags.md, the isolation + transaction-read guides,
  and program_errorret.md updated; a compatibility note explains the fork's
  change vs stock Oracle BDB. flag-reconcile.md records the removal.
- README.md: the SSI bullet now says DB_TXN_SNAPSHOT is serializable + notes the
  ABI break.
- rfc/0003 (SSI): an Amendment note records the API simplification; INDEX updated.
- test/bench/ssi_abort_bench.c: uses DB_TXN_SNAPSHOT (the removed _SAFE flag
  would not compile); builds clean.

TCL -snapshot_safe stays a compat alias (prior commit); the .tcl SSI tests are
unchanged and pass. Docs build clean.
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Coccinelle convention checks

No new violations. ✅

Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in.
rule_mutex_unbalanced|MUTEX_UNBALANCED|src/crypto/mersenne/mt19937db.c|return (ret);
rule_mutex_unbalanced|MUTEX_UNBALANCED|src/mp/mp_register.c|return (ret);

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

ABI diff vs v5.3.33 (libabigail — authoritative)

Removed exported symbols (nm -D, _NNNN version suffix normalized)

None.


Advisory: libabigail/nm is the authoritative binary-ABI check; Coccinelle is complementary source-level early warning. See dist/cocci/README.md.

@gburd
gburd merged commit bf2cb43 into master Aug 3, 2026
54 of 56 checks passed
@gburd
gburd deleted the feat/snapshot-is-ssi branch August 3, 2026 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant