Skip to content

docs(rfc): Couchbase storage backend - #1184

Open
suravarjjala wants to merge 25 commits into
ExtendDB:mainfrom
suravarjjala:rfc/couchbase-backend
Open

suravarjjala wants to merge 25 commits into
ExtendDB:mainfrom
suravarjjala:rfc/couchbase-backend

Conversation

@suravarjjala

@suravarjjala suravarjjala commented Nov 19, 2026 •

Copy link
Copy Markdown

RFC: Couchbase storage backend

Tracking issue: #1183

This RFC proposes Couchbase Server as an ExtendDB storage backend, following RFC-0002 (Backend Plugin Policy) and mapping every criterion of RFC-0003 (Backend Acceptance Criteria) to the mechanism that meets it and the test that proves it.

What it covers

  • A crates/storage-couchbase workspace crate installed through extenddb_storage::Backend behind a couchbase feature, with no changes to the engine, server, auth or core crates; [storage.couchbase] settings in main's convention; one server per catalog; Experimental tier.
  • How Couchbase KV, SQL++, GSIs and query-service ACID transactions map onto the Storage trait and DynamoDB's behavioral invariants: KV point reads, tid-scoped SQL++ Query/Scan, derived index keys inside the item document, CAS-guarded conditional writes with a sub-document fast path, in-process query-service transactions, one lease document per item on every table through which plain writes and transactions exclude each other, explicit stream records whose sequence number is taken from a per-shard KV counter before the commit (a reader stops at an unresolved number and resolves it by a transactional read), TTL through the delete path.
  • Code-based catalog and data migrations through extenddb_storage::migrations in the shape crates/storage-mongodb uses: a MigrationBackend for the catalog and data scopes, ledgers, m0001_baseline, the shared resource-tag migration, a migration lock, serving registrations, released checksums and devtools/check-couchbase-*.
  • The port from the v0.1.x pin the backend was built against to the Storage contract on main: migrations, secret keys and the key ring, stream lineage, SnapshotEngine/BackupCatalog/RestoreEngine, the metrics account dimension.

Evidence and its sources. A complete implementation exists at https://github.com/couchbaselabs/extenddb-couchbase (private today; a new read invitation was sent to the first reviewer on 2026-12-01 and it expires after 7 days (pending on 2026-12-03); the repository goes public before FCP). Until a reviewer has read it, every docs/, scripts/ and tests/ path, QE id, commit id, pass count and timing that comes from it is a claim only it can show, and the RFC marks each one [ref-repo] (front matter). That covers the upstream conformance figures (the suite at e41f370 and at the pin 7b828b0) and the 343-case QE plan. The multi-node YCSB figures are not from that repository: they come from Couchbase's performance CI (runs of 2026-10-22 to 2026-11-01), which the front matter names as a second source, and each is marked [perf-ci], not [ref-repo]. No reviewer can repeat those runs yet. Upstream test files (upstream/tests/) are not marked; edits to files on main (the README row, docs/differences-from-dynamodb.md, tests/test_gsi_multi_range_query.py, tests/test_fgac_leading_keys.py) are not marked either.

What changed in revision 12 (2026-12-04)

Revision 12 answers the round-10 review. It changes text only: no code changed and no live run was made for it (one unit test was run in a scratch export, with and without a tolerance mutation, and cargo tree was run offline on an export of 5e58bea). The code is that of revision 11 below (tip 71939c0 of the revision-11 branch; the private main 5e58bea merged it as #247 after revision 11 was written, with the same tree: git diff 71939c0 5e58bea is empty; #248, ea21e46, was merged after it). The live probes ran on earlier images (8d6d8ac) and the unit tests at 71939c0.

  • Staged-number residual. The RFC now says that if the second read of a staged number gives a different double that equals the item's pre-commit value, the two reads agree and the settle can pass early (revision 11 lines 1597, 1658, 1729 and 2229, which are lines 1620, 1713, 1799 and 2300 in revision 12; rows 4.4 and 15 already kept this open).
  • The float_roundtrip check. backend/Cargo.toml:38 is under [dependencies]; the check is cargo tree -e normal,features -i serde_json (no dev-dependency edges), and the RFC says that kv_get reads through kv_get_cas and content_as.
  • What pins the comparison call sites. The RFC names the test with the one-ulp pair (image_compare_is_exact_without_a_tolerance) for the visibility wait and the identical-image rule, and says the pinned-image path of a single-item write has no test of its own.
  • The 444 probes (revision 11 line 1624; revision 12 lines 1664 to 1690). The count was mislabelled: "staged" meant other keys of the kill transaction were staged, not the probed item, whose own document had no xattr and equal KV and transactional images in all 444; the probes had no condition. The commit is inferred from other keys becoming visible through the transactional read, not read from the ATR, and why the own document unstaged before the other keys is unknown, which limits what the inference shows. The run did not test conditional writes on an item's own staged change. 5 acknowledged writes had a staged own document in the snapshot before them and an unstaged one after; they are unresolved ("none of the 444" holds by the definition of the 444: the own document had already unstaged). The 53 probes that answered 400 against a staged own document were TransactionConflict answers (46 TransactWriteItems cancellations and 7 plain writes, from the recorded error names); why a 400 and not a 503 I have not determined. The 6 ADD samples on 119b91f remain the only evidence for (b). That stays open under rows 4.4 and 15 (b), with a test (gate_own.py) designed and not yet run; it has no date and may never meet a staged own document, which would leave (b) open.
  • Row 4.1 lists a fourth difference from RFC-0003 4.1: a lease insert of a TransactWriteItems or TransactGetItems that landed and whose answer is an error such as a timeout (no guard; an insert that answers "exists" is read and a lease under the caller's own id is adopted). A plain write then answers TransactionConflictException at once while a TransactWriteItems lease is there (up to 10 s); behind a TransactGetItems read lease it waits up to its own 10 s CAS_DEADLINE and answers 503 only if the lease is still there. That assumes the read lease has the same 10 s TTL as the write lease (it does in the code at 5e58bea). Read from the code, not tested; no test shows either outcome.
  • Test accounting. The full-suite run at 71939c0 is out of the "Not run live" list; what was not run is a repeat on a memory-healthy cluster and a run on a fault-hooks image.
  • Upstream main 5826e1be (2026-12-03). The pin 7b828b0 is 376 commits behind it; of the twelve commits since 1be10124, fix(engine): describe a DELETING table with the members the service keeps #1411 (c8e66fb5) changes tests/test_table_operations.py, which row 10.3 cites (the description says "none changes a cited test file" in revision 11, and that was wrong), and fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 (5826e1be) adds tests/test_scan_segments.py and moves a helper out of tests/test_read_paging.py. fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087 is a port item: hash the partition key alone for a parallel-scan segment (the reference code hashes the partition and sort keys together); row 7.3 cites the new file. Not run against this backend.
  • Row 4.4 (d) and row 15 now carry the clause that a retry of a failed restore under the same lease id is handled only by the revision-11 code.

What changed in revision 11 (2026-12-03)

Revision 11 answers the round-9 review (one required change and five smaller comments). It changes text and code. The revision-11 code is the revision-11 branch of the private repository (pull request #247, tip 71939c0; merged into the private main as 5e58bea after revision 11 was written, with the same tree as 71939c0: git diff 71939c0 5e58bea is empty; #248, ea21e46, was merged after it), on top of the commits of the round-10 branch (a local branch, not pushed; all its commits are in the revision-11 branch) (its first commit is d43712b), which is on top of the revision-10 branch (tip fb97722, backend code of cdf2b37). The runs are under "Runs behind revision 11" in the RFC. In short:

  • The settle's parse is correctly rounded (the required change; comment on line 1387). backend/Cargo.toml enables serde_json's float_roundtrip (d43712b). Cargo.lock holds one serde_json (1.0.151) and cargo tree -e features -i serde_json shows the feature on it, so both reads of the settle use it: the KV read (the SDK's content_as, conn.rs:1447, type inferred) and the query-service read (the transaction client's resp.json(), conn.rs:498). The plain-decimal text and the exponent text of one double now parse to the same double. The counts of revision 10, "62 of 350" random doubles one ulp off and "52 of 350" doubles parsed differently by text form, describe the parser before d43712b; the RFC labels them so. Evidence: two unit tests (5,000 random doubles in both spellings and the next double must parse correctly rounded, json_parse_of_both_spellings_of_a_double_is_correctly_rounded; one double in two spellings must agree in the settle and a one-ulp neighbour must not, in all four pairings, settle_images_agree_is_exact_across_spellings); my run of the first test without the feature failed it; a review probe on a scratch copy (not committed) of 981,660 texts, 0 wrong, against 8% to 23% wrong without the feature. A different spelling of one double therefore cannot change the settle's verdict; a different double could, and no run has shown one (the residual stays open, smaller, not closed: 146 probes on 6 tracks, parsed doubles only, the wire text not recorded; the count is from run notes of the reference repository, the probe files are scratch).
  • The 4-ulp tolerance is gone. FLOAT_CLOSE_ULPS, images_match, json_equivalent, floats_close and ulps_apart are deleted (fcdac00); the settle, the visibility wait, the identical-image rule and the check of a single-item write against its pinned image all use exact_images_match (engine.rs:1656). Its stated reason was the one-ulp parse difference, which d43712b removes; a real change of one ulp is now a change in all four places (9007199254740993 against 9007199254740992.0 and 0.0 against 5e-324 are unequal as well). "Exact" means exact on the parsed f64, not on the token: two tokens of one double compare equal, and a document edited from the Couchbase side (XDCR, SQL++, Eventing) can carry such tokens, so the claim holds for the documents this backend writes (native_number keeps two native tokens from colliding). A visibility wait that never matches runs to its 15 s bound and leaves the lease committed, the safe side; its cost is availability. A consequence of float_roundtrip in storage: some 16- and 17-digit decimals that used to be stored as exact strings now round-trip and are stored native (item.rs:1823); old documents decode as before; performance was not measured.
  • Acquisition after a lease write fails (comment on the acquisition paragraph). The RFC now says: the request ends with an error; a new attempt takes a new id. In take_plain_lease_opts the id is drawn once per call (engine.rs:7630), the insert (engine.rs:7659) and the takeover CAS (engine.rs:7764) are followed by ?, so an error that may hide a landed write returns at once and the still-armed guard ends the lease; the loop reuses the id after Ok(false) (the write did not apply, or it reported "exists" or a CAS mismatch, which may hide a landed write), and then reads the lease. This is read from the code, not tested beyond the two fault-hook tests that pause after a clean write. A gap found by review of revision 11, fixed in 71939c0, partly tested: before it, the guard was disarmed on every Ok(false) before the kv_get_cas ... ? read (engine.rs:7676), the next deadline check and the backoff, so a write that landed and was reported as failed was unguarded if that read failed, the request was dropped or the deadline fired. Now the guard stays armed through the read and is disarmed only when the read shows the lease is not ours (AcquireState::disarm_unless_ours, engine.rs:2361, called at engine.rs:7677); the takeover CAS's Ok(false) no longer disarms (engine.rs:7770). Tested by a unit test of the helper (not of the call-site order; it fails on a mutant of the helper) and by a live fault-hook test (tests/test_fault_hooks.py:1549; a hook turns a landed insert into "not written", the client gives up) that fails on a mutant image (r11g-mut, the old behaviour) and passes on the fixed one (r11g). Not tested: a takeover CAS that landed with its answer lost (no hook), a failing read after Ok(false), the deadline path with the guard armed. A known residual: the acquisition of a TransactWriteItems (acquire_leases_as) and of a TransactGetItems (acquire_read_leases) has no guard, so a landed insert whose answer is lost, or whose following read fails, leaves a lease that lapses after TXN_LEASE_TTL (10 s); a known residual.
  • What pins the settle to the exact compare (comment on item_unstaged). item_unstaged is async over a live connection and is not called in a unit test. It now calls a pure function, settle_images_agree, and the two tests above call it. A third test, item_unstaged_settles_with_the_exact_compare, is a text scan of the source (the settle must reach exact_images_match, no tolerance symbol may exist); it is not behavioural, and the RFC says so. My mutation checks: the tolerance put back failed 3 tests, an integer through f64 failed 4, and settle_images_agree changed back to a tolerant function failed the scan (a weak mutation: the reintroduced function was an alias). Live, the U trackers at d43712b (24 of 24) and on the merged image (20 of 20), and the 17-digit cycle (29 of 29, 18 of 18 with exponent-spelled pairs, 16 consistent and 0 inconsistent on the merged image), were consistent, with refusals at a median of about 2.0 s (the settle's bound). At aaaac8b the U trackers were consistent too, so these outcome checks do not tell the builds apart, and no live run was made against a build with the tolerance.
  • The full-suite sentence names its run (comment on the full-suite sentence; the status line and the last row of the full-suite table now name the run). The previous full run of the upstream suite was at fb97722, whose backend code is that of cdf2b37: 1248 passed, 41 failed, 16 skipped, 0 differences in status against the 9843eeb run. The full upstream suite at 71939c0: 1245 passed, 41 failed, 3 setup errors, 16 skipped, 1 xfailed; 3 differences in status against the run at 9843eeb, all in tests/test_fgac_leading_keys.py::TestLeadingKeys (CreateTable answered 500 with Couchbase code 2120 while ns_server was killed (exit 137) on the cluster nodes; the three tests passed 9 of 9 on a quiet cluster; the cause is a correlation from the logs, not shown to be the backend and not proven to be the cluster; the suite was not repeated on a memory-healthy cluster; the other 41 failures are the same 41 test ids as in the baseline).
  • Two nits. "Whose own guard, where it has one, then takes over" (a plain PutItem, DeleteItem or UpdateItem has no guard of its own once the acquisition returns its lease). The two windows of revision 8 are named where they were called "the other two": a server process that dies between a takeover and the taker's committing mark, and a restore that fails twice.
  • Other changes in the code (not asked for in round 9). (1) A lease found under the request's own id after a write that reported failure is adopted, with the marker it carries: in take_plain_lease_opts (engine.rs:7683) and in acquire_leases_as (engine.rs:8400); before, by reading the code of fb97722, the plain path waited on its own lease and answered 503, and the TransactWriteItems path counted a taker's lease as clean-held and would later have deleted the marker. The helper own_lease has a unit test; the two call sites have no test. (2) A failed read of the operating system's randomness fails the request when a lease id is drawn (engine.rs:1795), where every request used to get the same lease id; the other users are unchanged (leader::node_id and catalog_cas_backoff ignore a failure, cas_backoff falls back to the clock, two sites panic). (3) The first run of the fault-hook file on the merged image failed one test, a regression of fcdac00 (the acquisition guard was disarmed before the after_takeover_cas fault point); 5aba553 restores the order and the second run passed. (4) 220301c merges origin/main of the reference repository (feat(sqlite): vector search index #244 and fix(postgres): restore must not report ACTIVE before the data copy co… #246) into the branch; cdea5d0 and 8d6d8ac restore a field and an ESCAPE clause that the conflict resolution dropped. (5) 71939c0 keeps the acquisition guard armed after a lease write that answered "not written" until the read of the lease shows that the lease is not ours (the gap described under "Acquisition after a lease write fails").
  • Text corrections from review (no code). "Closed" and "exact" claims are weaker where the evidence is: (e) is closed in the revision-8 code on the premise that a ConditionCheck stages no document, which is inferred (from a 25 ms acknowledgement) and not shown; the two windows of revision 8 are "addressed in code", not "closed by design" (SIGKILL at one point is tested; no run fails without the change); the numeric probe that showed the defect on 119b91f is one pair (about 450 ulps), shown live for that pair and, by unit test, for the comparison function; the plain-lease guard's decision function acts only on our plain lease, with no live test of leaving another writer's lease alone; "fixed" is not used for anything untested. The DynamoDB behaviours named in the text (the cancellation answer, a read that fails against a plain write, TrimmedDataAccessException) are stated as observations without a cited source. The 4 MB transaction size is not enforced upstream (docs/dynamodb-limits.md:89 at b6c85950). The sentence "not re-read here" about the developer-guide quote is gone: the passage is as a review fetched the page on 2026-12-03, not fetched by me. Bounds are stated at the default txtimeout (a stream-table lease lives txtimeout + 20 s: 21 s at 1 s, 620 s at 600 s). Drawbacks (5) gains the clause that a KV outage that caused the ambiguous error also defeats the cleanup. The upgrade path of legacy access-key secrets is stated as open: migrate does not yet convert them, serve does not report them at start, the runbook has no step (none of it built or tested).
  • Retargeted to upstream main b6c85950 (2026-12-03; history: revision 12 refreshes this to 5826e1be, says that fix(engine): describe a DELETING table with the members the service keeps #1411 changes a cited test file, and adds fix(storage-sqlite): keep each partition key in one parallel Scan segment #1087). The pin 7b828b0 is 375 commits behind it (364 at 1be10124, 373 at c0576603); the eleven commits since 1be10124 do not change a trait signature or a cited test file; ac0c581c (fix(query): refuse key condition values over the key size limits #481, key-size validation in Query), c8e66fb5 (fix(engine): describe a DELETING table with the members the service keeps #1411, optional creation_date_time) and bcba8118 (fix(core): count an index name in characters and report its member path #1137, index names in characters) are added to the port items.
  • Runs. cargo test --lib at 71939c0: 383 passed, 387 with fault-hooks (382 and 386 at 8d6d8ac; the difference is the one unit test of the guard fix; scripts/lint-storage-invariants.sh passes at 71939c0; counts and lint from the run notes of the commit, not rerun while drafting); the fault-hook file at 30 s on the image r11g: 36 passed, 0 failed, 3 skipped, and the SIGKILL test alone passed. The live probes ran on the image of 8d6d8ac, not on 71939c0, which differs from it only by the guard fix: gate_num17 40 trials, 5 gate trials, 13 trackers, 13 of 13 consistent, all unstaged (the longest about 120 s), O never acknowledged; gate_ident variant U 9 trials, 7 gate trials, 28 trackers, 28 of 28 consistent, all unstaged (the longest about 130 s), 444 probes acknowledged while other keys of the kill transaction were still staged (the probed item's own document was not staged in any of them, and the probes had no condition, so this run did not test conditional writes on an item's own staged change; 5 more acknowledged writes met a staged own document in the snapshot before them and are unresolved; that stays open under rows 4.4 and 15 (b), with a test designed and not yet run), all consistent. In the earlier gate_num17 run on the merged image (before 5aba553) one A tracker unstaged only after 731.7 s and one D tracker never unstaged inside its window; neither reproduced when I reran both harnesses on the image of 8d6d8ac (the longest of 41 trackers was 129.8 s), and the probe gaps of the earlier run (about 300 s) match the idle sleep of the Mac that ran the containers, against its power log (an explanation from those gaps; I did not reproduce a host sleep). The spread of about 14 s to about 130 s is Couchbase's own transaction cleanup (a 60 s window and a 15 s attempt expiry), which is the availability cost of the exact settle: the item answers 503 ("committed, not yet visible") until the cleanup unstages it. The full upstream suite at 71939c0: 1245 passed, 41 failed, 3 setup errors, 16 skipped, 1 xfailed; 3 differences in status against the run at 9843eeb, all in tests/test_fgac_leading_keys.py::TestLeadingKeys (CreateTable answered 500 with Couchbase code 2120 while ns_server was killed (exit 137) on the cluster nodes; the three tests passed 9 of 9 on a quiet cluster; the cause is a correlation from the logs, not shown to be the backend and not proven to be the cluster; the suite was not repeated on a memory-healthy cluster; the other 41 failures are the same 41 test ids as in the baseline). The run before it was at fb97722 (backend code of cdf2b37; 1248 passed, 41 failed, 16 skipped, no difference in status from the 9843eeb run). Not tested: the two adoption call sites, the pinned-image path of a single-item write, performance, the live probes on 71939c0 itself, and the three paths of the guard fix named above.

What changed in revision 10 (2026-12-03) (history: revision 11 supersedes what this section says about the 4-ulp tolerance that the visibility wait and the identical-image rule kept, about the absence of float_roundtrip, and about the counts 62 of 350 and 52 of 350; those describe the code before d43712b)

Revision 10 answers the round-8 review (10 inline comments and the consistency point in its body). It changes text and code. The revision-10 code is the revision-10 branch of the private repository, on top of the revision-9 branch, tip fb97722 (pushed 2026-12-03); the backend code is that of cdf2b37, and the runs are under "Runs at cdf2b37" and "Runs at 9843eeb" in the RFC. In short:

  • The taker's settle compares numbers exactly (comment on line 1299; as of revision 10, before d43712b: revision 11 supersedes the statements about the tolerance, the missing float_roundtrip and the two counts in this bullet). item_unstaged compares the KV image with the transactional read exactly (exact_images_match): integers exact, doubles by f64 equality (-0 equals 0), an integer equals a double only when the double is integral, below 1.8e19 and exactly that integer, key order ignored. The visibility wait and the identical-image rule keep the 4-ulp tolerance (FLOAT_CLOSE_ULPS), because serde_json without float_roundtrip parses some 17-digit tokens one ulp off (62 of 350 random doubles), and they compare the backend's own document with a KV read. The measurement behind it (Couchbase 8.0.0, committed unstaged documents): 350 raw documents (including 1.0000000000000002, 5e-324, 1.7976931348623157e308, subnormals and odd tokens), 442 documents written through the API and 140 staged writes, read after their commit, showed 0 differences in bits or tokens between a KV read and a whole-document read through the query service (a projection turned -0.0 into 0 for 3 values and prints plain decimal text, and its plain-decimal and exponent texts parse to different serde_json values for 52 of 350 doubles, a different count from the 62 of 350 above); the API read paths agreed where observed: GetItem, Scan, TransactGetItems 442 of 442 documents, Query 261 (221 of the plain table, 40 of the 221 of the stream table), the read of a ConditionCheck 120 (60 per table), with no ProjectionExpression; which statement shapes the backend generates for each read was not checked. The normalisation pair of the unit tests was a hand-written literal and was never observed. A real change within 4 ulps now keeps the lease committed and the next taker's exact settle waits for the unstaging (no new poll after 2 s, then 503, TransactionConflict or a skip): measured live at cdf2b37, 253 probes met a staged own document, 6 were acknowledged after the unstaging, 247 were refused, none computed on the pre-commit image; a live cycle with 17-digit doubles was consistent (20 trackers). Only partly measured: the number form that a second transaction reads from a committed document that is still staged (146 probes on 6 tracks (3 of the 17-digit cycle, 3 of the numeric probe) in which a transactional read saw the staged value gave a value identical to the final KV value in bits and in the Python repr of the parsed double, 0 different; parsed doubles only (the raw wire text was not recorded), 3 + 3 distinct values; a transaction's own view of its own staged write differed in text from the post-commit KV token for 97 of 140 staged writes; the 453 and 230 probes of those runs on tracks with a later acknowledged write are not covered; a smaller residual, not closed); if it differed, the settle would only wait, which is the safe side, and if it differed permanently the item would be refused (503) until it is unstaged (an availability cost). "Exact" means exact on parsed f64: this build has no float_roundtrip, and a one-ulp change counts as a change only because native_number (item.rs) stores a native number only if serialise, parse and canonicalise reproduce it, which a document edited from the Couchbase side (XDCR, SQL++, Eventing) bypasses; the live proof used 7 hand-picked pairs. The 4-ulp residual of revisions 8 and 9 is gone from the settle; the staged number form stays open as said (smaller, not closed); neither is under Gap A (b) or Gap A (e).
  • Gap A (b), the ordering, and the new track (comment on line 2692). The second kill-harness run shows the refusal and the settle, not the ordering: every acknowledged takeover wrote after its document had unstaged. The ordering was observed only in 6 ADD samples on 119b91f. In the fourth run (harness 37ed569, at aaaac8b: 67 trials, 40 gate trials, 160 tracks, all consistent) no taker met a staged document of a ConditionCheck or identical-image Put item by that route, as far as any read shows (they stage nothing that any read shows: an inference from a 25 ms acknowledgement, not proof), so they do not exercise (b); a one-ulp Put does leave the item's own document staged: 142 probes met it, 7 were acknowledged, each after the document unstaged (0.67 to 11 s; that shows the refusal and not the ordering), 135 were refused, 0 were lost. 9 answers of 500 coincided with the kill of another trial's query node. At cdf2b37 the exact settle may wait that case out, which would mask it (the rerun does not show whether it does). This stays an observation on one cluster, not a test of the ordering, and (b) stays OPEN in part. The wording on the marker's exp is the takeover rule's: it never moves, and each touch keeps the lapsed marker for another 60 s.
  • A no-token TransactWriteItems whose COMMIT answer is lost (comment on line 1119). It has live tests: test_ambiguous_commit_without_a_token_stays_ambiguous_and_is_not_retried and test_a_committing_lease_is_refused_before_commit_by_and_taken_after. At the default txtimeout the leases stay committing until commit_by (50 s), a second TransactWriteItems is cancelled with TransactionConflict, a plain write is refused with TransactionConflictException after its 10 s wait (not a 503), both before commit_by, and both succeed after it (53 s). At 1 s: 1 failed, 33 passed, 4 skipped; the failure is the known test_a_conflicting_transaction_in_the_commit_window_cancels_it_does_not_also_commit (cause not established: the held transaction answers ServiceUnavailable after its release where the test expects ok; a 1 s txtimeout shorter than the hold is the likeliest reason, not confirmed).
  • A plain lease's acquisition is guarded; a TransactWriteItems and a TransactGetItems have no guard (found open by the correction comment of 2026-12-03; fixed at 93d2a4d). An AcquireGuard is armed around each lease write; a dropped request or an error that may hide a landed write has OUR plain lease removed by id with a CAS (or a carried marker put back) by a spawned task, which never touches a committing or committed lease or another writer's. A process death in that window leaves the lease until it lapses (up to 50 s for a stream-table lease, 30 s for a plain KV write's) with the marker carried. Residuals: the cleanup tries twice with no backoff and then lets the lease lapse (a KV outage that caused the ambiguous error also defeats it), and it is skipped if no runtime handle is available (shutdown); a drop in the short KV write between a plain lease being returned and its release leaves a 30 s lease; a lease write that lands after the cleanup's single read leaks until its exp. Two fault-hook tests ran live at cdf2b37; on a build with the guard disabled both fail.
  • The SIGKILL test now starts the next writer only after the taker lease's lifetime plus 30 s and 60 s have passed (82 s at the default txtimeout, 62 s at 1 s) and first checks that the taker's document is still there as a plain lease with the original marker: it passed solo at 1 s (67 s) and at 30 s (87 s). It covers a SIGKILL at one point; a panic, a SIGTERM shutdown and a restore that fails twice stay untested.
  • The overwrite (comment on line 1156): the kill harness holds an item's own document staged; the overwrite needs one of three open cases (a marker that expired, an expired taker lease over a lapsed marker, a mixed fleet), none of which any run produced.
  • A Query or a Scan on a CREATING index is not refused (comment on line 777): neither path checks a status (read from the code, not run); both operations go in the row for docs/differences-from-dynamodb.md; the planned fix returns main's "Cannot read from backfilling global secondary index: " wording for both.
  • Text: the reader's no-skip guarantee is stated under assumption A1 (not tested, engineering item 1) in row 5.2 and the Streams row of the design summary; the test named with 300 ulps uses 1.5 against 1.5000000000001 (about 450 ulps; the name is kept); Drawbacks item (5) is rewritten (the task ends the lease, so the client's timeout no longer matters, and a plain lease's acquisition is guarded; a TransactWriteItems or TransactGetItems acquisition has no guard); 19 trials had a staged own document in the second run, and the 17 with a PutItem track were unstaged 23.4 to 521.7 s after the kill (the other two, 24 s and 91 s; 22.3 to 522.5 s over all 51 tracks of the 19 trials); the fourth run's documents stayed staged 1.6 to 322 s (40 trials, median about 60 s).
  • Runs. Full upstream suite at 9843eeb (backend code aaaac8b; release build, three nodes): 1248 passed, 41 failed, 16 skipped, 1 xfailed, the 41 being the baseline groups of the 389b8bc run exactly; the same suite at fb97722 (backend code identical to cdf2b37: git diff cdf2b37 fb97722 -- backend is empty, only scripts/commit-point-gate and tests/test_fault_hooks.py differ; release image built from git archive fb97722 with the default demo Dockerfile, no fault hooks; three nodes, durability = majority, txtimeout 30 s, the same five chunks plus test_transact_write_conflict.py as at 9843eeb): 1248 passed, 41 failed, 16 skipped, 1 xfailed, 0 differences in status against the 9843eeb run test id by test id (1306 ids), so the two runs match exactly, the 41 being the same baseline groups (4 aws:SourceIp loopback, 2 test_stream_table_reuse.py, 35 version skew); caveats: the demo bucket was deleted and recreated before the run (the earlier probe tables are gone); the in-repo Rust tests were not part of it (the 370 and 374 are a separate run); the run covers what the suite covers, not the kill-harness windows. At cdf2b37: unit tests 370 passed, 374 with fault-hooks, at fb97722 (the backend code of cdf2b37); the fault-hook file 35 passed, 0 failed, 3 skipped at 30 s; the three 5 s tests passed; regression 29 of 29 on the second run (the first run failed 11 tests during a Couchbase query-service authorization outage, code 2120); probes: identical-image track 64 tracks, all 64 final states consistent, with one 500 (C, PutItem, trial 5, 23.9 s after the kill: commit outcome unknown, not retried: query-txn POST failed, with the kill of another trial's query node 7.4 s into the probe; counted with the other 500s of these runs); 17-digit cycle 20, numeric 11, staged-key 12, all consistent.

What changed in revision 9 (2026-12-03)

Revision 9 answers the round-7 review (13 inline comments and the title request). It changes text and code. The revision-9 code is the revision-9 branch of the private repository, on top of the revision-8 branch, tip 9843eeb; the backend code is that of aaaac8b (ce16a55 is a commit on it that changes a test only, and skips two tests at a 1 s txtimeout), and the runs behind it are named per commit under "Tested" below and in the RFC's "Runs at 119b91f and acf2bcf", "Runs at 1f48ec1" and "Runs at aaaac8b". In short:

  • The rule for an unknown outcome is stated once, in two places. After an ambiguous COMMIT WORK only a token with the request's fingerprint proves that the commit point passed; an absent token, a token of another fingerprint and a failed token read all keep the leases committing until commit_by, because that COMMIT WORK may still pass its commit point. A retry with the same ClientRequestToken that outlives token_wait (txtimeout plus 10 s, shorter than commit_by, txtimeout plus 20 s) answers TransactionConflict and releases nothing; that is read from the code, with a unit test only.
  • TransactionConflictException is answered only behind a committing lease whose txn is true or absent; behind one that no client transaction holds, the wait ends in 503.
  • The bound on a stuck unstaging is 24 h, and after that for as long as a writer touches the marker at least once every 60 s (a restore keeps a lapsed marker for at least 60 s after each touch). It is stated that way in every place that gave 24 h alone.
  • One comparison, and a defect it hid (comment on line 1082; history: the tolerance described here is gone in revision 11). The visibility wait and the identical-image rule (the keep-committed rule) use one comparison, images_match (key order ignored, integers exact, doubles within 4 ulps; the idempotency token by its fingerprint and account_id); the taker's settle used it at aaaac8b and has been exact since revision 10. Revisions 8 and 9 took doubles within a relative 1e-12 as equal, a defect in the taker's settle: it passed at once for a pending change such as N "1.5" to N "1.5000000000001", so the taker decided from the pre-commit KV image. It was found by review of the round-7 comment on line 1082 (the request to add that pair to the TransactWriteItems fault-hook case), and it is fixed at aaaac8b (100eeee): one function, floats_close, within 4 ulps (FLOAT_CLOSE_ULPS, at most about 8.9e-16 relative; ulps_apart), served the settle (item_unstaged; exact since revision 10), and serves the visibility wait (commit_doc_visible) and the identical-image rule. The pair is now an ordinary changed write (the lease is released and the new value is read back), and exactly identical images keep committed. The earlier statement that this carried no loss of safety, because every pair the wait calls equal also keeps its lease committed, was wrong: that protection hands the next writer a committed marker whose item may still be staged, and the settle, with the same tolerance, could not tell; that tolerance left a real change within it (N "1.0000000000000002" to N "1.0000000000000004", one ulp apart, both stored as native numbers) taken as unchanged by the settle, which revision 10 removes by making the settle exact (see above); the change from 1e-12 to 4 ulps closed the defect for every change larger than 4 ulps, shown live (371 and 317 failed conditions on the old build, none on the new). Unit tests: 361 passed, 365 with fault-hooks, at 100eeee, and 367 and 371 at aaaac8b. The two keep-committed fault-hook tests were rewritten at 1f48ec1 and passed at 30 s and 1 s there; the whole file passed at 30 s at aaaac8b (32 passed, 0 failed, 4 skipped); at 1 s it gave 31 passed, 1 failed (the known test_a_conflicting_transaction_in_the_commit_window_cancels_it_does_not_also_commit), 4 skipped (298 s, at ce16a55). A probe of a taker that meets a staged item whose number changes by the pair (the numeric probe of the commit-point gate harness) shows the defect on the build before the fix (119b91f: 371 ConditionalCheckFailed answers to the PutItem whose condition names the new value and 317 to the DeleteItem, all decided from the pre-commit image, and wrong ALL_OLD answers; no ADD lost, from 6 samples) and not after it (29 of 29 trackers consistent at 1f48ec1, 20 of 20 at aaaac8b; the yield is small, 5 to 9 gate trials a run).
  • A single-item write's own transaction task ends its lease (a defect of revisions 8 and 9, found by reading the code after round 7, not by a test, fixed at aaaac8b). The text said that a request dropped by its client puts the marker back; that was true only of an escalated write. A single-item write on a stream-enabled table that holds an ordinary lease had no guard: the code that recorded the outcome and released the lease was in the request, so a client that timed out while the write's transaction ran left the lease committing until commit_by (50 s at the default txtimeout) even after a clean commit, and every other writer of the item got 503 (a TransactWriteItems cancelled). Now the detached task that runs the transaction ends the lease for the outcome it knows, whether or not the request is alive: a visible commit releases it, a clean failure releases it or puts a taken-over marker back, a commit not yet visible rewrites it committed, and a lost COMMIT answer keeps it committing until commit_by. A request dropped while a transaction is in flight only notes that it is gone; the guard acts only when no transaction is in flight, and, as revision 10 added, its acquisition has a guard of its own (above). A task that dies silently (a panic) after its transaction started leaves the lease as it was, plain until exp, or committing once the pre-commit hook has marked it (the request's tail ends a lease only when no transaction is in flight: tail_may_end_lease); a panic in the middle of COMMIT keeps a committing lease and is therefore conservative, covered by a unit test of that helper and by reading, with no live panic test. A plain write that is not a stream-table write, dropped in the middle of its one KV write, leaves a plain lease until its exp; the sweeper, reconciler and backfill's held-KV-replace path is unchanged. Escalated writes and replace_at_cas background rewrites now run detached, so a dropped escalated write commits and releases where before the drop cancelled it and restored the marker. Tests: the stream-table client-timeout test (passes at 30 s and 5 s), the dropped-marker test, changed to expect a commit and a release (passes at 30 s and 5 s), and the ambiguous-commit-after-a-drop test (passes at 5 s only; it skips at 30 s and at 1 s because its waits are written for a 5 s txtimeout, and at 1 s the held transaction would expire before COMMIT); unit tests of the outcome table and of the phase rule. Drawbacks gets a fifth item for what remains (a lost COMMIT answer, a silent task death).
  • The stream reader is a second user of assumption A1. The reader waits txtimeout plus 15 s counted from the writer timestamp of the row after a gap, which is never earlier than the BEGIN WORK of the transaction that holds the missing number, and adds no margin of its own (commit_by adds 5 s). If A1 fails and a record commits after the reader has probed its number and found nothing, that iterator does not deliver it, while an iterator started later would; the sentence that a late record "is still delivered, exactly once" was unconditional and is now conditional on A1; the writers' clocks must agree with the reader's within what is left of the 15 s. Not tested (engineering item 1); no code adds a margin. A third assumption, A3 (a transaction the query service reports as expired, 17010 with no raise, was rolled back), is stated beside A1 and A2, as the ending paths rest on it.
  • A rolling update is a requirement. With one server per catalog a mixed fleet arises only where an old and a new process overlap. The Helm chart sets no update strategy (Kubernetes' default RollingUpdate starts the new pod first), so "Operational requirements" now says to stop the old server before the new one starts (strategy.type: Recreate or the equivalent) for the guarantee that a taker's lease carries the marker.
  • Costs added to Drawbacks and to unresolved question 3. A stuck unstaging refuses writers (1.6 to 928 s measured with cleanup on; 24 h and the 60 s touch rule by design), a committed marker of about 150 bytes builds up per key a ConditionCheck touches, the first PutItem after a marker is p50 11.0 ms against 4.0 ms, and each TransactWriteItems attempt makes one extra KV read per mutation action (up to 100 for 100 actions).
  • Citations. The C++ SDK error-handling page is cited for transaction_result.unstaging_complete; Couchbase's transactions page is cited for NTP, which it requires of cluster nodes, and the ExtendDB server hosts are named under "Operational requirements" (A2 is about their clock).
  • Clauses added, no change in behaviour. A Query or a Scan on a CREATING index is not refused anywhere (neither upstream's IndexInfo nor the backend carries or checks the status; read from the code), so it can miss items; a row for it goes into docs/differences-from-dynamodb.md. A retry of the index pass rescans the whole table, so a hot item can hold the index CREATING indefinitely (from the code, not run), and the create lock of the server is held through an UpdateTable's index build and first backfill. The stream reader pays one transactional read per trimmed number, 64 per call, and only a checkpoint older than the 24 h retention meets a trimmed range. The restore heartbeat starts only after the target's CreateTable returns, so a target whose index build took longer than 900 s can be reaped before its first heartbeat.
  • Smaller corrections. The TTL sweeper is named among the writers that take the lease; the sentence on the full suite on three nodes is scoped to the revision-7 code and points at the 389b8bc row; row 6.3 says each figure names its suite revision or says that it was not recorded, and the parity row names the pin 7b828b0; the clause about a "1 s young-gap rule" is dropped (the reader has no such rule: its grace is txtimeout plus 15 s); d0dc673 is named beside b66f6c7 as a rename commit.
  • Code: the taker's lease carries the marker (comment on the takeover rule, line 1353). The taker's lease now carries the marker it took over (the revision-9 branch, tip 9843eeb). A lease that has expired and carries a marker stands for that marker for every writer and reader, so none clears it and then writes by KV; the taker writes its own lease over the marker in the one CAS that takes it over, with its short logical exp and the original marker verbatim (a chain of takeovers keeps the marker's own exp); the lease's native expiry is the larger of the marker's remaining life (at least 60 s, at most 24 h) and the lease's lifetime plus 30 s, so a taker over a lapsed marker is protected for the larger of 60 s and its lease's lifetime plus 30 s on its own document; a restore writes the marker back as before, and if both its attempts fail the taker's lease still carries it; the taker's own committing lease replaces the document without a marker field and is itself the protection from then on, with its own 24 h from the mark; in a mixed fleet a server without the change clears such an expired lease and writes by KV, so the guarantee holds only once every server runs the new code. The process death between a takeover and the taker's own mark, and the restore that fails twice, are closed by it by design (SIGKILL tested); the expiry of a marker (24 h, and after that for as long as a writer touches it at least once every 60 s), the expiry of a taker's lease over a lapsed marker, and a mixed fleet stay open.
  • Tested (before the comparison fix). Tested at 119b91f: unit tests 359 passed (363 with fault-hooks); five new tests, two of them strengthened at 119b91f, live on three nodes (durability = majority): the whole file passed (31 passed, 3 skipped at the default txtimeout; 32 passed, 1 failed, 1 skipped at 1 s, the failure being the known 1 s-only test); one SIGKILL test (809714c) passed at 1 s in two runs and at the default txtimeout in the whole-file run, and that the next writer did not write by KV is shown by the lease log lines and the final state, not by a KV trace. Addressed in code, SIGKILL tested; not tested: a panic of the detached section, a SIGTERM shutdown during the pause, a restore that fails twice, a chained takeover live; the native expiry of the taker's document and the renewal's copy of the marker are unit-tested only.
  • A write onto a staged item, measured (comment on line 1008). Two kill-harness runs (three nodes, durability = majority, cleanup on, the backend as of 493242d), described once in the RFC under "DynamoDB Streams", "Writes onto the item of a gate trial". The second is the one that tests a write onto a staged item document: the harness follows only trials in which the probed item's own document is staged right after the kill; 40-put transactions on a stream table, txtimeout 30 s; in 66 trials 19 had such a document, 51 tracks (17 each of PutItem, UpdateItem ADD, TransactWriteItems), and in 51 of 51 the first probe, 0.05 to 0.08 s after the kill, met the staged own document. The first writes were refused (TransactionConflictException after 10 s or cancelled after 2 s, then 503 or cancelled) until a takeover of the committed marker acknowledged one: 12, 11 and 8 acknowledged probes; 51 of 51 tracks consistent afterwards, no acknowledged write lost, no value of the transaction overwritten, no 5xx other than 503; the control at 389b8bc gave the same (21 tracks, 21 consistent). The kills still land 4 to 46 ms (median 7 ms) after the first visible document, so the yield comes from the transaction size; the absence of an observed KV write is not a proof; the late time bins rest on 3 or 4 trials. The first run (txtimeout 1 s, 10-put transactions, kill delay 0 to 3 ms, the kills landing 2.7 to 8.1 ms after the first visible document in its 21 gate trials) stays as a second run with its own setting: 120 trials, 21 gate trials, 4,374 probes, the documents staged for 42 to 928 s (median 222 s); only 1 of the 21 trials had the item's own document staged (trial 17: acknowledged at once, 0.04 s, at 68.2 s; the unstaging seen complete at 70 s); 12 of the 4,374 probes answered 500, 8 within 0.7 s of another trial's SIGKILL and 4 unexplained and not reproduced (the second run had none, at another txtimeout); 2 of the 12 were applied and are not counted as acknowledged; in trial 27 the item answered 503 from 58 to 755 s (about 700 s) after such a 500, until the unstaging finished (seen at 760 s; that it was that ADD's own transaction is inferred). Probes in both runs use integer attributes; the number-change defect has its own probe (above). A third run at aaaac8b with the second run's harness (18 trials, 6 gate trials, 16 trackers, all 16 consistent, no 5xx other than 503) was made for the lease-end change. The statements that no run had produced a stuck unstaging are replaced by this result, and the text that bounds how long a marker can refuse writers gives the measured 1.6 to 928 s beside the design bound (24 h, and after that for as long as a writer touches the marker at least once every 60 s).
  • Regression and what was not rerun. In-repo regression at 119b91f on three nodes: test_txn_lease 8 of 8, test_gsi_fence 1 of 1, test_reindex_reconcile 3 of 3, test_transaction_rollback 7 of 7, test_stream_trim 1 of 1, upstream test_put_item_create_race 9 of 9; the first run after the backend restart had one failure in test_reindex_reconcile (a request_plus SQL++ query: "stored document not found"), a rerun of that file alone failed one other test of it once and then passed three times, and a clean full run passed; the cause was not found, and that test goes through replace_at_cas, which the lease changes touch; rerun later: 29 of 29 at 1f48ec1 (one earlier run of the set hit one 30 s client read timeout in test_txn_lease::test_single_item_writes_on_a_stream_table_both_succeed_and_yield_to_transactions, not reproduced in three solo runs and the next full run, cause not found), and at aaaac8b 29 of 29 in 4 of 5 runs, with one run at 28 of 29 (the failure was test_reindex_reconcile::test_conditional_delete_on_phone_edited_item again, "stored document not found", cause not found); the stall was not reproduced in 5 solo passes and 4 full runs at aaaac8b. The lease driver (2,000 rounds), the absent-item test and test_transact_get_snapshot were last run at 389b8bc and not rerun at this tip, and the full upstream suite on three nodes was rerun at 9843eeb and at fb97722 (the backend code of cdf2b37) in revision 10: the lease code changed after 389b8bc (the carried marker, the one clock reading, the comparison, the end of a single-item write's lease inside its transaction task), so those results are not results for the tip; the runs that cover the changed code are the fault-hook file, the regression files, the SIGKILL test (passed at 30 s and 1 s at aaaac8b) and the probes.
  • Code, unchanged in behaviour (comment on line 1001). 8ec1983 names the lease fate after an ambiguous COMMIT WORK in a function and pins it with a unit test; the code already behaved as the rule (an absent token, a token of another fingerprint and a failed token read keep the leases committing), and the RFC's text at that line had been incomplete.
  • Not changed. Gap B (the retry path's three token reads); no run has held a COMMIT WORK past its commit_by (A1); the freeze runs' failed gate; the order of a takeover's transaction after a committed one is untested as a property (observed, see revision 10).

What changed in revision 8 (2026-12-01)

Revision 8 answers the round-6 review. It corrects statements of fact and describes code: the revision-8 branch of the private repository, on top of bf67ee2 [ref-repo] (its backend last changed in 389b8bc), pushed to the private repository, which answers the three round-6 comments on the lease rules. The RFC's "Corrections in revision 8" (under "Transactions") lists it. In short:

  • Code (the revision-8 code). (A) A committed lease no longer lapses after 30 s: it expires after 24 h like a committing one and ends when the next writer's own commit is visible; a marker past its exp but still present is taken over like a live one; every writer that takes a marker over (a plain write, a stream-table write, the GSI backfill, the reindex reconciler, a TransactWriteItems) writes through a query transaction, and a taker whose own transaction committed nothing puts the marker back. (B) A ConditionCheck item, and an item whose put, update or delete in a TransactWriteItems leaves its image unchanged, keeps a committed lease after a clean commit instead of having it deleted; a single-item write (an escalated plain write, or one on a stream-enabled table) whose staged image equals the pinned image keeps it too (numbers compare by value; within a relative 1e-12 in the revision-8 code, which was a defect, now within 4 ulps for this rule and the visibility wait, see revisions 9 and 10). The single-item rule uses the same comparison as the visibility wait, and is a safety rule that errs toward keeping the marker: N "2.0" over "2" is not such a case (the server normalises it, the write commits nothing and leaves no lease), and no API-reachable pair is known that differs as an item and stores a bit-identical document. (C) The lease records whether a client transaction holds it, so a plain write that waits out 10 s behind the committing lease of a stream-table or escalated write answers 503, and TransactionConflictException only behind a client transaction's.
  • Tests of that code. Unit tests 349 at 823f7e8 (353 with fault-hooks; 341 and 345 before) and 350 at e2fa27f. The fault-hook file on a single node at 823f7e8: 24 passed and 3 skipped at the default txtimeout, 25 passed, 1 failed and 1 skipped at a 1 s txtimeout (the failure also occurs on bf67ee2 at that setting); at 389b8bc, with the new identical-image stream-table test (it passes there and fails at 8d941da and 823f7e8), 25 passed and 3 skipped, and 26 passed, 1 failed (the same known test) and 1 skipped. On three nodes at durability = majority: 9 new fault-hook cases passed at 823f7e8, before 8d941da made the multi-node lease view fail on a query error (rerun at 389b8bc: the whole file, not only the nine cases, 25 passed and 3 skipped at the default txtimeout, and 26 passed, 1 failed and 1 skipped at a 1 s txtimeout (the failure is the 1 s-only test that also fails on a single node), with the lease view returning documents, so no test passed on an empty view), and lease drivers of 4,000 rounds at 823f7e8 (two runs) and, a separate set, 2,000 rounds at 389b8bc (one run, plain and stream-enabled tables) lost no write and answered no 503; the second ran on a loaded host with medians 7 to 17% above an earlier run, attributed to host noise and not proven. At 389b8bc, on three nodes at durability = majority and the default 30 s txtimeout: the full upstream suite (59 files after the CONFORMANCE.md filter; tests of 7b828b0, plus the test_transact* files of upstream d4dd0ba4) passed except 4 aws:SourceIp loopback tests (the server sees the Docker gateway address, not 127.0.0.1: an artifact of running in a container on macOS, not rerun on the baseline), 2 in test_stream_table_reuse.py (also fail on bf67ee2: the feature is not implemented) and 35 in two files that exist only at d4dd0ba4 (identical list of failures on bf67ee2: test-version skew); the images were built with the pinned dependency served from a local clone of the same sha 7b828b0 (Cargo.lock unchanged); test_txn_lease.py 8 of 8, test_gsi_fence.py 1 of 1, test_transaction_rollback.py 7 of 7, test_stream_trim.py 1 of 1; an upgrade from bf67ee2 to 389b8bc on one cluster (24 of 24 acknowledged items intact, 0 errors; tested on hand-made old-format markers only, since bf67ee2 left none; a legacy committing marker without txn makes a plain write wait 10 s and answer TransactionConflictException until its derived commit_by, about 10 minutes); and a lease build-up (2,000 ConditionChecks on 500 keys left 500 committed markers of about 147 B each, 73.8 KB, 24 h expiry; the first later PutItem on such a key p50 11.0 ms against 4.0 ms with no marker). What was not run is listed in the RFC's "Runs behind revision 8".
  • Costs and limits. A stuck unstaging now blocks the item for 24 h, and after that for as long as a writer touches the marker at least once every 60 s (30 s before, after which a plain write went through by KV); the first plain write after a ConditionCheck transaction costs about 7 ms more (median 12.2 ms on the quiet run, 11.9 ms in an earlier one, against 5.0 to 5.1 ms); a process death between a takeover and the taker's own committing mark, a restore that fails twice, the expiry of a marker (24 h, and after that for as long as a writer touches it at least once every 60 s) and a mixed fleet can still lose a marker (Gap A (d), OPEN); the order of a takeover's transaction after a committed one is untested (Gap A (b)); the residual of a real change of up to 4 ulps in the taker's settle, which revisions 8 and 9 left open, is gone from the settle in revision 10 (exact on parsed f64), with the number form a second transaction reads from a committed-but-staged document only partly measured (smaller, not closed). (As of revision 8; revision 9 closes the first two of the lost-marker windows by design, SIGKILL tested, see above.)
  • Commit-point hold. A later run that kills the coordinating query engine with query cleanup off reached the gate in 24 of 200 trials (10-put transactions on a stream-enabled table, three nodes, txtimeout 1 s), and the reader resolved the staged records by a transactional read (101 of the 102 stream gap lines in its backend log; the first resolution 16.0 to 16.4 s after the kill). It is one harness on one cluster, coordinator only, and its scripts are in the repository (scripts/commit-point-gate/, added in 1c44cc6 and renamed in d0dc673 and b66f6c7 [ref-repo]) only as a copy that was syntax-checked, not rerun, whose README lists manual setup steps; the freeze runs still failed the gate. Row 5.2 stays OPEN.
  • The design is said to depend on two Couchbase behaviours that are not from Couchbase's documentation: A1, and COMMIT WORK answering only after the unstaging. A2 is stated as the clock of the server that writes and compares commit_by (the query node times txtimeout on its own clock), with NTP. Couchbase's transactions page requires NTP across cluster nodes, and the ExtendDB server host is not one, so the RFC cites the page and names those hosts under "Operational requirements" (revision 9).
  • A stuck unstaging is described for both markers: a committed lease and a committing lease after an unknown outcome that the token does not prove committed (no token, an absent token, a token of another fingerprint, or a failed token read) both expire after 24 h (takeover of a committing lease from commit_by), and a stuck unstaging can block every writer of the item for 24 h, and after that for as long as a writer touches the marker at least once every 60 s.
  • Row 4.4 is OPEN in part for Gap A (b) and (d); Gap A (e), a ConditionCheck item's lease deleted with no check after a clean commit, is closed by (B). Item 15 lists it. Row 4.5 stays OPEN in part as before.
  • Rows 4.1 and 4.3 quote RFC-0003 4.1's sentence on client-visible concurrency control, state a third case (TransactionConflictException for up to commit_by after a client transaction's unknown commit) and that an escalated plain write holds the lease across a query transaction on any table. In the code behind revision 7 a second PutItem behind a stream-table or escalated write's committing lease answered TransactionConflictException after 10 s with no transaction holding the item; in the revision-8 code it answers 503 (C).
  • Engineering item 12 (the YCSB run with the lease on every table, and its refusal counts) is listed as OPEN in the RFC's status line, the acceptance intro and row 6.3, as it is below.
  • The lease-cost counter ratios of revision 7 are withdrawn: the counters behind them were not recorded. The latency and throughput figures stand.
  • 3988255 is not pushed; its backend, tests, demo and scripts are the same as bf67ee2 (see the last paragraph).
  • Transaction test rows name the suite revision. On main the write-skew test file has 6 tests and tests/test_transact*.py has 95 test functions (counted at 5489d29ac and d4dd0ba4), against 5 and 63 at the pin 7b828b0; the tests of main have not been run (a six-test copy of the file from a local clone of upstream passed 6 of 6 in 3 runs on three nodes; its revision was not recorded).
  • A restore's copy takes no item lease; the target is hidden while CREATING. A trimmed-horizon iterator passes a number still unresolved at 24 h. session_data_conformance and the new AuthorizationStore::fetch_session_data signature (fix(auth): read a role session's policy and tags by its access key #1523) are in the port lists.
  • The two restore divergences listed in [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 (a table being restored is hidden from the data plane, and DeleteTable on it answers ResourceInUseException) are dropped from the divergence list: on the reviewer's reading of AWS's DeleteTable reference (ResourceInUseException for CREATING, ResourceNotFoundException for a resource that is not ACTIVE; not re-read for this revision) both match the service.
  • Not changed: Gap B (the retry path's three token reads); no run has held a COMMIT WORK past its commit_by (A1); the freeze runs' failed gate.

What changed in revision 7 (2026-11-28)

Revision 7 corrects revisions 5 and 6; the correction comment on this PR lists what was wrong, and the RFC's "Corrections in revision 7" (under "Transactions") states it.

  • The takeover rule, corrected. Revision 6 (and its PR description) said a background rewrite, and any other writer, takes a committing lease over by CAS at once. On three nodes at durability = majority that let a second TransactWriteItems take over a first whose commit was still in flight, and both committed (write skew in 34 to 40 of 40 rounds of a driver; the upstream absent-item test failed 4 of 5 tests on every run). Now a committing lease carries commit_by (the mark plus txtimeout plus 15 s plus 5 s, 50 s by default); a committed lease may be taken over at once, a committing one only at or after commit_by, nothing else ever. Every taker (a transaction, a plain write, the GSI backfill, the reindex reconciler) uses that one rule, waits up to 2 s for the item to settle, and gives up if it does not. On three nodes after the change: 0 of 240 rounds on a plain table and 0 of 240 on a stream table with both committed, and the upstream test 10 of 10 runs. The rule rests on two assumptions stated in the RFC (A1, A2) and not checked against Couchbase's documentation, and no run has held a COMMIT WORK past its commit_by.
  • destroy, corrected. It refuses without a catalog and its version document; it drops recorded table collections, the backend's own fixed data collections, an account scope whole only if every collection in it is recorded, data only when nothing foreign is left in it, and the catalog scope last and whole.
  • Cancellation reasons of a lease conflict name only the contended item, as DynamoDB does (every action is marked where no contended item is known).
  • Gap A, narrowed. The escalated plain write, every single-item write on a stream-enabled table and a background rewrite that took a lease over now mark their lease committing before COMMIT WORK and release it only on a definite "not committed" or a commit a KV read shows; a TransactWriteItems waits for every staged document. The failure paths stay OPEN: after a post-commit failure (answered at once) or a visibility wait that reached 15 s, a read can see the earlier image; and the committed lease left by those paths lapses after 30 s, after which a plain write clears it with no settle and, on a table without a stream, writes by KV, so if unstaging is still pending then (a node failure after the commit point) cleanup can overwrite that acknowledged write. No run had produced that state at revision 7; a three-node probe of it was still to be run.
  • GSI backfill. UpdateTable's own backfill skips a pre-commit_by committing item at once instead of waiting 10 s. tests/test_gsi_fence.py failed 3 times in about 83 runs on the fix branch under heavy load; no fence race was observed, and the one failure examined is a request_plus scan that missed items already carrying the index column. Its cause is OPEN (item 5).
  • Also fixed in the code behind revision 6: a restore target is now born CREATING and handled by table id; the stream reader no longer stalls after more than 64 empty aged numbers (an iterator below the trimmed horizon now moves forward silently, where DynamoDB answers TrimmedDataAccessException); descending twins only for the backend's own indexes.
  • TransactGetItems renews its leases during its passes, bounds each pass at 3 s, and checks every lease after the last pass.
  • Lease cost, measured on one three-node harness: about 1 ms on the sequential median; with 8 threads about 26% less throughput in the median run and about 12% less on the mean, within run-to-run spread.

Status. Revision 12 (2026-12-04; revision 11 was 2026-12-03, revision 10 was 2026-12-03, revision 9 was 2026-12-03, revision 8 2026-12-01 and revision 7 2026-11-28; the lease rules changed in the code between revisions 7 and 8, and between revisions 8 and 9 a taker's lease came to carry the marker it took over and a single-item write's transaction task came to end its own lease). Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 of the acceptance table stay OPEN until a reviewer has read the reference repository. Open engineering parts:

  • Item 1: the test that holds a PutItem after its lease insert while a transaction commits on the key is not written (revision 10 added a hold after the lease insert for its acquisition tests, with a client that gives up); a COMMIT WORK held past commit_by is not tested.
  • Item 2: AT_TIMESTAMP (supported on main from feat(streams): AT_TIMESTAMP shard iterator on all four backends #468, absent at the pin).
  • Item 5: the reconciler held-write test is a skipped stub; the worker's drain wait, the transaction guard and the reconciler change are built only; the missed scan in tests/test_gsi_fence.py; an index that stays CREATING until a committing or committed marker expires (24 h, and after that for as long as a writer touches the marker at least once every 60 s) if its item never settles (item 15).
  • Item 8: whether the index count is of definitions or of instances on a cluster with replicas.
  • Item 12: the performance cluster's YCSB run with the lease on every table, and the refusal counts.
  • Item 13: the multi-part RANGE tests only, blocked on the pin.
  • Item 15, Gap A: the failure paths (a post-commit failure, a timed-out visibility wait), the untested order of a takeover's transaction after a committed one, and the windows in which a marker can still be lost (the expiry of a marker (24 h, and after that for as long as a writer touches it at least once every 60 s), the expiry of a taker's lease over a lapsed marker, a mixed fleet; the process death between a takeover and the taker's own committing mark and the restore that fails twice are addressed in the revision-9 code, with SIGKILL tested at one point and the same-id retry changed in revision 11, not tested). It leaves rows 4.4 and 4.5 OPEN in part.
  • Item 15, Gap B: the three token reads on the retry path (the unknown-outcome arm is changed). It leaves row 3.3 OPEN in part.
  • The commit-point hold is not under item 13 and has no item of its own. It is OPEN in row 5.2, and "DynamoDB Streams" and item 1 report its runs: the two freeze runs failed the gate both times, and a later run that kills the coordinating query engine reached it (24 of 200 trials) and the reader resolved the staged records by a transactional read.
  • The full upstream suite has run on three nodes at 389b8bc (results under "Tests of that code") and at 9843eeb (revision 10 above: 1248 passed, 41 failed, all baseline groups) and at fb97722, the backend code of cdf2b37 (1248 passed, 41 failed, 0 differences in status from the 9843eeb run; not the in-repo Rust tests, not the kill-harness windows), and at 71939c0, the tip of the revision-11 code: 1245 passed, 41 failed, 3 setup errors, 16 skipped, 1 xfailed; 3 differences in status against the run at 9843eeb, all in tests/test_fgac_leading_keys.py::TestLeadingKeys (CreateTable answered 500 with Couchbase code 2120 while ns_server was killed (exit 137) on the cluster nodes; the three tests passed 9 of 9 on a quiet cluster; the cause is a correlation from the logs, not shown to be the backend and not proven to be the cluster; the suite was not repeated on a memory-healthy cluster; the other 41 failures are the same 41 test ids as in the baseline); the parity suite and the rest of the older upstream runs were on a single node (durability = none).

The unresolved questions at the end of the RFC are the shared-tier bound, Community Edition, and whether the lease on every table is acceptable.

The revision-7 code is the single commit bf67ee2 on the private repository's the round-5 branch, pushed (later squash-merged with the other work of rounds 4 to 7 as 9daaef9, #244). The fix-branch commit 3988255, on which the unit tests ran (cargo test --lib 341 passed, 345 with the fault-hooks feature [ref-repo]), is not pushed; git diff --stat 3988255 bf67ee2 -- backend tests demo scripts prints nothing (checked 2026-12-01), so those tests ran on the same backend and tests as bf67ee2. Most live runs behind revision 7 were made one or more commits before that code; the RFC's "Runs behind revision 7" says which.

The revision-8 code is the revision-8 branch of the same repository, on top of bf67ee2 [ref-repo] (its backend last changed in 389b8bc, where the runs were made; d0dc673 moved a script directory and b66f6c7 renamed the names in it, and nothing else changed after it), pushed to the private repository. The runs listed first were made at 823f7e8; 8d941da then changed only tests (the multi-node lease view in the fault-hook tests now fails on a query error); e2fa27f changed the backend (the identical-image rule for single-item writes), 1c44cc6 added the commit-point harness, 389b8bc changed one test, and d0dc673 and b66f6c7 renamed the harness directory and the names in it; the RFC's "Runs behind revision 8" lists them and what was not run.

The revision-11 code is the revision-11 branch on top of the commits of the round-10 branch (a local branch, not pushed; all its commits are in the revision-11 branch), tip 71939c0 [ref-repo] (private pull request #247, merged into the private main as 5e58bea with the same tree): d43712b (serde_json float_roundtrip and two unit tests of the parse and of the settle's verdict), ead6698 (a comment), fcdac00 (exact comparison everywhere, adoption of a lease under the request's own id, entropy failure fails the request), 220301c (merge of origin/main of the reference repository), cdea5d0 (restores a field and a call the merge dropped), 5aba553 (the acquisition guard stays armed until the escalated guard exists), 8d6d8ac (restores an ESCAPE clause the merge dropped) and 71939c0 (keeps the acquisition guard armed after a "not written" lease answer until the read shows the lease is not ours). The backend behaviour changed in d43712b, fcdac00, 5aba553 and 71939c0.

The revision-10 code is the revision-10 branch on top of the revision-9 branch, tip fb97722 (backend code of cdf2b37) [ref-repo] (pushed 2026-12-03): df1740b (the taker's settle compares numbers exactly), 93d2a4d (a plain lease's acquisition is guarded; a TransactWriteItems or TransactGetItems acquisition has no guard), c382c65 (its two fault-hook tests), c3035ba (the fault point after_lease_cas in the fault-hook documentation), 37ed569 (the kill-harness track for a ConditionCheck, an identical-image Put and a one-ulp Put), 9287c1a and f218180 (the no-token committing-lease test at any server timeout, and its half-way check), f363f65 (the exact-settle unit test), cdf2b37 (the SIGKILL test's timing) and fb97722 (a live probe of the exact settle with 17-digit doubles). The backend behaviour changed in df1740b and 93d2a4d only.

The revision-9 code is the revision-9 branch, on top of b66f6c7, tip 9843eeb (backend code of aaaac8b) [ref-repo]: 8ec1983 (lease fate after an ambiguous COMMIT WORK named and pinned by a unit test; behaviour unchanged), 567d922, 5c95f94 and b36d299 (the taker's lease carries the marker; unit tests; a fault point and five fault-hook tests), 809714c (SIGKILL test), 493242d (a takeover is decided and its marker read at one clock reading), 119b91f (two tests strengthened) and acf2bcf and e94c95f (the kill-harness probes; the second selects trials with a staged item document), 2f9ad42 and 1f48ec1 (the number pair in the TransactWriteItems fault-hook case, rewritten for the comparison fix) and 100eeee (the comparison within 4 ulps), 2a363a5 (the numeric probe of the commit-point gate harness), d663261 and 7a8d0af (a single-item write's transaction task ends its own lease; its tests), 14f7529 (the request's tail leaves a lease alone when that task died), 879527e and aaaac8b (two commits outside the transaction code, in the reference repository's CI configuration and credential code, which the in-tree backend does not contain) and ce16a55 (skips two tests at a 1 s txtimeout). The backend last changed in aaaac8b. The fault-hook runs before the fix were made at 119b91f; the first kill-harness run used the acf2bcf harness on the 119b91f build and the second the e94c95f harness on the backend of 493242d; the earlier runs stay at 389b8bc; the runs at 1f48ec1 and at aaaac8b are in the bullets above (the 1 s whole-file run at the tip is 31 passed, 1 failed (the known test_a_conflicting_transaction_in_the_commit_window_cancels_it_does_not_also_commit), 4 skipped (298 s, at ce16a55)). The RFC's "Runs at 119b91f and acf2bcf", "Runs at 1f48ec1" and "Runs at aaaac8b" list them and what was not run.

🤖 Generated with Claude Code

Propose Couchbase Server as an ExtendDB storage backend, shipped as
Couchbase Converge for DynamoDB Workloads: a crates/storage-couchbase crate
installed through extenddb_storage::Backend behind a `couchbase` feature,
native-JSON items with one reserved `_xdb` object, KV point reads, SQL++
Query/Scan over tid-scoped indexes, query-service ACID transactions, and
code-based catalog and data migrations in the shape crates/storage-mongodb
uses. Maps every RFC-0003 criterion to the mechanism and the test that
proves it, and scopes the port from the v0.1.x pin the backend was built
against to the Storage contract on main.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up. I read it against main at 2ef5613, RFC-0002, RFC-0003, ADR-0023 and ADR-0026, and checked what it says about Couchbase against Couchbase's documentation. My answers to your eight questions are at the end. Before the final comment period, these need to change:

  1. The evidence is in a repository reviewers can't read. Every docs/, scripts/ and tests/ path, QE id and job in the acceptance table points into it (lines 9 and 58-83). So nobody can check a row of the RFC-0003 table yet. The Summary's "912 passed, 1 xfail" adds up to 913. Line 781 gives 913 as the count of the stale e41f370 checkout, which is main's commit for #307, and 1,234 for the pinned suite. The pin 7b828b0 isn't on main either: it's 308 commits behind main and has 6 commits main doesn't. Please open the repository now, or keep only the claims a reader of this PR can check. Please also say which suite at which commit produced each number. RFC-0003 asks for devtools/run-tests --extenddb --all to pass in CI before the project accepts a backend. Please name that run with --backend couchbase as the required gate, and use RFC-0003's suite names in place of "parity".
  2. Plain KV writes and query-service transactions write the same documents, and nothing stated keeps them apart. Couchbase's transactions page says non-transactional updates shouldn't be made to a document while a transaction that involves it is in progress. The intent lease (lines 193 and 403) is a separate document, so a plain write checks it in one step and writes in another. An unconditional PutItem is a plain upsert with no CAS (line 758). The lease lasts 10 s and nothing renews it, while txtimeout defaults to 30 s (line 397). The RFC also doesn't say whether the transaction holds the lease until Couchbase unstages every document. Please describe how each plain write path sees a staged transactional mutation in the same step as its write. Say what renews the lease, and what a plain write answers when it meets a staged mutation with no lease. Please also state the outcome for a PutItem and a TransactWriteItems on one key, in both orders.
  3. A stream record can become visible after a record with a higher sequence number. Lines 424-426 say a consumer can never pass a sequence number whose write hasn't committed. On Couchbase the commit point is the ATR entry, and Couchbase unstages the documents after it. The same page calls that an eventually consistent commit for non-transactional readers. GetRecords is a non-transactional SQL++ read (line 429). So T1 can take number 5 and commit, and T2 can take 6, commit and unstage. A consumer can then read 6 and move past 5 while 5 is still staged. If T1's query node fails after the commit point, record 5 waits for cleanup. RFC-0003 5.2 forbids this, and main fixed the same class on PostgreSQL with migration 7, StreamPending. Please name a mechanism that holds while Couchbase unstages documents. Please also add a test that holds T1 between its commit point and its unstaging while T2 commits.
  4. TransactGetItems has no named isolation mechanism. Line 400 says the transaction locks each read. SQL++ transactions run only at READ COMMITTED (BEGIN TRANSACTION), and their reads get Monotonic Atomic View. The only lock the transactions page describes is a staged mutation, and a read doesn't make one. If the fix for the torn pairs stages a write on every item it reads, please say so. Please also say what that does to concurrent writers, CAS loops and stream records. DynamoDB's transactions guide says a TransactGetItems that conflicts with a single-item write is the one that fails, with TransactionCanceledException. Please also say what stops a plain write to a ConditionCheck item between the check and the commit.
  5. The backend answers contention between plain writers as a transaction conflict. A CAS loop that runs out surfaces a retryable TransactionConflict (line 349). On a stream-enabled table every write is a transaction on the one stream_seq document (lines 362-364), so writers of different keys conflict there. RFC-0003 4.1 and 4.4 ask single-item writes and concurrent UpdateItem calls to succeed where DynamoDB handles the contention. TransactionConflictException means that an ongoing transaction holds the item. Main's MongoDB backend has the same limit, answers 503 ServiceUnavailable after 50 attempts, and documents it in docs/differences-from-dynamodb.md. Please state the attempt and time bounds and the answer at each. Say what the ALL_OLD put at line 758 writes and returns at its deadline, and add the rows to the differences document.
  6. A 100-action, 4 MB TransactWriteItems has no stated fit in Couchbase's limits. Line 684 says one can run past the 30 s txtimeout, and the query service bounds a transaction's delta table by its memory-quota. Please name the query-service settings the backend needs and what the client gets when a valid request exceeds them (RFC-0003 9.2). Please add a test at 100 actions and 4 MB.
  7. EXTENDDB_SCAN_CONSISTENCY=eventual (lines 335-339) answers a Query or Scan that sets ConsistentRead=true from an index that can lag, LSI reads included. DataEngine::query and scan carry no consistency flag on main (crates/storage/src/lib.rs:381-420), so the backend can't tell those requests apart. RFC-0002 allows an eventual read served as strong (line 83) and a stronger opt-in mode (line 118). It allows no mode that weakens a read. Please drop the setting until the trait carries ConsistentRead. Lines 373-374 also say index reads are strongly consistent, where row 2.7 says the backend doesn't advertise strong GSI reads. Please make them agree.
  8. A write that hasn't seen a new GSI can land after the backfill passed its item. UpdateTable writes the index row as CREATING, and the reconciler backfills and flips it to ACTIVE (lines 376-380). Meanwhile a write uses a catalog read up to 2,000 ms old (line 525), or the key info its request loaded. Such a write stores the item without the new derived keys after the backfill passed it, and the index goes ACTIVE without it (RFC-0003 2.4). The sub-document fast path has the same gap. Please name the fence.
  9. The key encoding needs to be specified. Couchbase limits a key to 246 bytes in a named collection, and allows 250 only in the default collection (Data). Every item here lives in a named collection, so line 727's 250-byte threshold lets a key of 247 to 250 bytes through to a refusal. Please give the S and B encodings of _xdb.pk and _xdb.sk (hex keeps unsigned byte order, standard base64 doesn't). Give the hashed form and why it can't collide with a literal key, whether a hashed lookup compares the stored key, and the shape of LastEvaluatedKey. RFC-0003 1.2 asks for a scheme that's provably collision-free. The example document (lines 274-283) also has _xdb.sk: "N#21001" with no top-level attribute for that sort key.
  10. A descending Query has no index in its order. There's one ascending base index (line 321) and one GSI per DynamoDB index. Couchbase's ORDER BY page says a query that sorts opposite to its index may run slower, and suggests a second index in the opposite order. Please say how the backend serves a ScanIndexForward=false page without reading the whole partition first, and add descending paging to the tests.
  11. The shared tier has no stated bound. Every table's GSIs, LSIs, TTL index and vector indexes are indexes on data.items (lines 188 and 369). So the index work of each write grows with every table in the tier. The budget check counts keyspaces in its bucket (line 584), but Couchbase's limit of 1,000 collections is per cluster (Scopes and Collections). Couchbase's Operator documentation also gives 10,000 indexes per cluster. Please count both across the cluster, and say what CreateTable and UpdateTable answer at the limit. Please also replace "effectively unlimited tables" (line 577) with a measured bound.
  12. The migration plan covers ids 1 and 2 of main's 12. The exhaustive match (lines 218-220) needs an entry for each of ids 3 to 12, either a body or NotApplicable with its reason. At least 6, 10, 11 and 12 apply here. Lines 213-217 delete the catalog_version settings document. But the shared runner writes that row with every catalog ledger row (LedgerWrites::write_version, crates/storage/src/migrations/record.rs:33), and ADR-0023 reads it to answer WrittenByOlderRelease and Uninitialized. The lock and the serving registration (lines 244-253) need the renewal, expiry and loss values ADR-0023 gives for every backend. The base-index rebuild that stays in the engine (lines 259-261) runs outside the runner, and ADR-0023 allows no shape step outside the migration list. Line 238's reason for writing the ledger row after the body also needs a fix. Couchbase has multi-document KV transactions through its SDKs. What rules them out here is the Rust SDK, which has none, and a SQL++ transaction, which takes no DDL.
  13. The backup section contradicts main. For a backend that can't fix an instant across a table, main's answer is Cassandra's. Its open_table_snapshot returns Unsupported, and CreateBackup takes the in-catalog create (crates/storage/src/snapshot.rs:20-22, crates/storage-cassandra/src/snapshot_engine.rs). docs/differences-from-dynamodb.md documents the divergence. Main has no BackupEngine trait (line 505). Point-in-time recovery isn't "snapshot-now only" (line 497): the engine refuses those operations for every backend. Export and import aren't mentioned, and on main export is a paged Scan with no point in time. Please follow Cassandra, or describe a mechanism that fixes an instant, and add a paragraph on export and import.
  14. Secret storage should use main's code. The workspace would gain aes-gcm (line 648), which ADR-0026 took out of the workspace when it moved secret encryption to extenddb_storage::secret_cipher on aws-lc-rs. The settings table keeps EXTENDDB_ENCRYPTION_KEY[_FILE] and its _PREVIOUS pair (line 634) beside the key ring of lines 482-484, and passwords already go through extenddb_storage::password. Please drop aes-gcm and those settings, and use secret_cipher, the key ring and the shared password code. Please also say whether the backend ships with main's default key placement or requires key_file.
  15. The settings should be [storage.couchbase] keys. Main's backends read [storage.<backend>] keys with EXTENDDB__STORAGE__<BACKEND>__<KEY> overrides, and the settings table (lines 625-634) and lines 599-600 use EXTENDDB_* environment variables instead. One of them, EXTENDDB_QUERY_TLS_INSECURE=1 (line 600), turns off certificate checks at run time. "Dev-only" needs a mechanism, and main's dev mode is a build feature. The sample config also puts the Couchbase password in connection_string (line 622), where main takes a backend password from its own environment variable. Please move the settings to [storage.couchbase], take the password from EXTENDDB_COUCHBASE_PASSWORD, and make the insecure TLS switch a build feature or delete it.
  16. ExtendDB runs one server per catalog. README.md:64 says so for every backend, and the HA design (lines 514-542) and the Helm chart's two replicas (line 637) rely on several. The engine also keeps per-process state beyond the key info that EXTENDDB_CATALOG_FRESHNESS_MS covers, the auth cache and console sessions among it. Please state one server per catalog and set the chart to one replica. The multi-server design changes every backend's deployment model, so it needs its own RFC.
  17. Please state the tier, the edition and the CI job. A new backend enters at Experimental (README.md:49-62), and lines 104 and 107-108 talk about GA and a production deployment surface. CI and the demo run Couchbase Server Enterprise 8.0.0 (line 589). The image's Enterprise licence is free for development and testing, and production needs a subscription. Community Edition allows clusters of up to five nodes and has no XDCR (Editions). Please say which edition the backend needs and what works on Community Edition. Name the required CI job and its image, and add the README row. cmd_serve.rs (line 647) has no backend gate, so please drop it from the implementation summary. The first release that ships extenddb-storage-couchbase also takes ADR-0029's new-crate steps.
  18. destroy needs a stated scope (line 197). An operator's bucket can hold other scopes, and catalog and data are names another application can use. Please say that destroy drops only what the catalog records, never by pattern. Say what init does with a catalog or data scope it didn't create, and that one bucket holds one deployment.
  19. The licence footer (lines 965-967) says ExtendDB isn't affiliated with AWS. The template and every RFC and ADR on main say "ExtendDB is an open source project maintained by AWS. It is not Amazon DynamoDB or an AWS service." Please copy the template's footer.

Please also fix these smaller ones:

  • The console known issue (lines 851-860) describes code that main fixed. account_detail requires a session for that account and an admin, and metrics_data answers 403 to a non-admin.
  • The engine already refuses begins_with on a number sort key with the service's message (crates/engine/src/query.rs:674-693, measured on 21 Oct). The backend's own check (lines 323-325) and the divergence line in #1183 can go.
  • One stream shard (line 421) differs from the four every backend takes from extenddb_storage::stream_lineage::SHARDS_PER_STREAM. Four shards would also split the counter of item 5. Please use the shared constant, or give the reason for one.
  • XDCR (lines 50-56) is Enterprise only. It can deliver part of a transaction when a connection drops, and the transactions page advises against active-active replication with transactions.
  • Lines 126-127 and 927-928 state what AWS intends, with no public source. Please delete them or cite one.
  • The multi-attribute RANGE limit (lines 382-384) points at a private checklist. Please name the ExtendDB issue, and put the limit in the README row as MongoDB and Cassandra do.
  • Some names aren't on main. BackupEngine appears at lines 153 and 909. CredentialStore is a trait of crates/auth, and line 155 lists it with the storage modules. validate_index_key_values doesn't exist (line 738), and the shared validators are in crates/core/src/validation.
  • One MutateIn takes at most 16 operations (sub-document operations). On a v3.2 table each SET takes two (lines 357-358), so an UpdateItem with more than eight SET actions has to fall back. Please say so.
  • Couchbase supports durability for up to two replicas (Durability), so the preflight (lines 601-610) should refuse a bucket with three.
  • A failed statement in a SQL++ transaction rolls back that statement only, and the transaction goes on. Please say the backend issues ROLLBACK when the token insert fails. Main releases the token of a cancelled transaction (tests/test_conditional_atomicity.py:272), so a retry with the same token runs again once the condition holds.
  • "Native JSON number when a double round-trips exactly" (line 659) needs to say what it compares. The value has to come back as the text normalize_number produces (crates/core/src/validation/number.rs). For example, 2^60 is exact as a double, but a shortest round-trip formatter prints it as 1.152921504606847e18.
  • A TTL value kept as an exact string in the sidecar (lines 296-297) doesn't match #ttl <= :now (lines 453-454).
  • Please pin the Rust SDK at 1.1.1 or later (line 648).

I'd answer your questions this way:

  1. Phases are fine if each PR carries complete traits with its tests passing in the required CI job (RFC-0002 rule 3). The first needs the mandatory traits, an entry for every migration id, the CI job and the README row at Experimental.
  2. Point-in-time recovery isn't a backend trait on main, and BackupEngine doesn't exist. VectorSearchEngine is optional under RFC-0002 rule 2. Either implement it and pass every vector test, with approximate results noted in the differences document, or leave it out, as MongoDB and Cassandra do.
  3. No trait change in this RFC. RFC-0002 already allows an eventual read served as strong. Please drop the eventual setting meanwhile (item 7).
  4. Use four shards (above). For backups, see 8.
  5. 8.0, the version CI runs and composite vector indexes need, with the edition named (item 17).
  6. One server per catalog in 1.0 (item 16).
  7. Replication and change data capture need their own RFC (docs/rfcs/README.md).
  8. Unsupported, as on Cassandra, with a Couchbase entry in the backup row of docs/differences-from-dynamodb.md. A write fence makes CreateBackup affect writes, and AWS says DynamoDB backups don't.

Line 428 is right, and I measured it on DynamoDB today. A PutItem of an identical item, an UpdateItem that changes nothing and a DeleteItem of a missing key wrote no stream record. Main gets this wrong, and I've filed it as #1229.

Responds to the review on ExtendDB#1184: evidence named by suite revision with the
pinned-suite run; key encoding and the hashed key form; the intent lease,
its renewal and the staged-mutation guard, with both orders of a plain
write and a transaction on one key; the locking read behind
TransactGetItems; CAS and lease bounds and the 503 at exhaustion; the
actual stream mechanism (number before commit, reader stops at an
unresolved number) with cleanupwindow in the abandonment age; the GSI
backfill fence; cluster-wide limits; an entry for all twelve migration
ids; Unsupported snapshots and in-catalog backup; secret_cipher and the
key ring; [storage.couchbase] settings; one server per catalog;
Experimental tier and the edition; four stream shards; destroy scoped to
the catalog; the template footer. Vector search and the two AWS lines are
removed. Open engineering items are listed with their tests.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 2. I read it at 38ee34b against main at 89fc971, and checked the new statements about Couchbase against Couchbase's documentation.

Revision 2 resolves items 7, 13, 14, 15, 16, 17 and 19. Of the smaller ones, it resolves the console known issue, begins_with on a number sort key, four stream shards and the AWS-intent lines. It also resolves the names that aren't on main, the SDK pin and the three-replica preflight. The same goes for ROLLBACK with the token release, the number text against normalize_number, the TTL string and XDCR.

Each point below names the round 1 item it continues. Two of the new mechanisms can't meet RFC-0003 as written:

  1. Item 9. The document key collides when an S key value contains |. S is S# plus the string's bytes, unchanged (line 370), and the key is <table_id>#<pk_enc>|<sk_enc> (line 378). Item A with pk x and sk y|S#z, and item B with pk x|S#y and sk z, both get <table_id>#S#x|S#y|S#z. The hashed form hashes the same pk_enc|sk_enc string, so long keys collide the same way. RFC-0003 1.2 rules out an unescaped delimiter that can appear in key values. Lines 387-390 and row 1.2 say a value can't forge a boundary, and an S value can. Please length-prefix pk_enc or escape | in S values, and add a partition key that contains |S# to the separator-collision test. Main has extenddb_storage::util::key::encode_netstring_composite, which MongoDB, Cassandra, PostgreSQL and SQLite use. Please use it for the raw form, or say why not.
  2. Item 3. The age that resolves a missing stream number lets a reader skip a committed record. Lines 626-632 abandon a number once the next record is older than txn_timeout plus cleanupwindow plus 15 s, which is 105 s with the defaults. The reason given is that cleanup unstages a committed transaction within cleanupwindow. Couchbase gives no such bound. cleanupwindow sets how often the query service checks its transaction records (query settings). The cleanup page says cleanup generally finds expired transactions within the window. It also names a downed node that the cluster has not failed over yet as a reason cleanup can still fail two hours past expiry. Auto-failover defaults to 120 s (Automatic Failover). So when the data node that holds a committed record fails, the reader passes its number at 105 s. Cleanup unstages the record after the failover, when every consumer has already passed its number. That breaks RFC-0003 5.1 and 5.2. One way that holds: before passing an aged number, read its record inside a transaction. The transactions page says a transaction reads the committed version as soon as the ATR entry says committed. If that read finds the record, deliver it. Skip the number only if the read finds nothing after the attempt expired. If the read fails, keep the stop. Please also extend open item 2's test to a hold longer than the age.

These still need to change:

  1. Item 1. The reference repository still answers 404 to my account. Line 9 says the first reviewer has access, and I'm the first reviewer. Please give me read access and say on line 9 when you granted it. Or mark every entry that only the private repository can show as unverified until it opens. Row 6.3 says the pinned suite passes all five baseline failures against the same build. The only pinned run in the RFC (lines 73-81) fails the three test_abac.py cases. Please name the run behind row 6.3, or narrow the sentence.
  2. Item 3, the skip marker. A writer leaves a skip marker for a number "because its transaction did not commit" (lines 625-626). A COMMIT WORK can fail with an unknown outcome, and a marker written then can hide a committed record. Please write a marker only after a rollback that succeeded, or after an error that came before the writer sent COMMIT WORK. Please also say that LATEST and AT_TIMESTAMP iterators start no later than the first unresolved number.
  3. Item 2. The guard looks for the txn extended attribute on the target document (lines 540-545). For a key that doesn't exist yet, Couchbase's transactions how-to says non-transactional actors can't see a transaction's staged insert. The RFC names no step by which the guard sees that insert. Take a PutItem that reads the lease before a TransactWriteItems takes it. If the PutItem writes after the transaction staged its insert of that key, it can pass the guard. The same holds after a lease lapses because renewals failed. The transaction concepts page says either write may then win, even with CAS, so the acknowledged PutItem can be lost. Lines 519-520 say the transaction then fails its validation at commit, where the page calls the outcome undefined. Please name the step that covers a key the transaction creates. Say that a transaction whose renewal fails rolls back before COMMIT WORK, and add the create case to open item 1's test. The guard also depends on the name and rule of the txn attribute, which Couchbase doesn't document. Please cite the source and name the versions you checked it on. Please also add a live test that stages a mutation and checks that the backend refuses each plain write path.
  4. Item 4. An absent key isn't protected. Lines 560-562 give it a staged insert that the transaction deletes again. I found nothing in Couchbase's documentation on what an insert and a delete of one key in one transaction leave staged. A plain PutItem also doesn't see a staged insert (point 5). So between a TransactGetItems' reads of A and B, a PutItem can create A and another can change B. The TransactGetItems then returns A absent with B's new value, which RFC-0003 3.5 forbids. Please read the absent keys again after the last read, or lease them. Please also add a test where a PutItem creates an absent key during a TransactGetItems.
  5. Item 4, the other direction. A plain writer that meets the read's staged lock takes the conflict path (lines 564-566), which answers TransactionConflictException. DynamoDB's transactions guide lists a PutItem as conflicting only with an ongoing TransactWriteItems, and fails the TransactGetItems when it meets a PutItem. Lines 445-446 also say that answer comes only from a transaction's intent lease, and a TransactGetItems takes none. Please retry the plain write within the 64-attempt, 10 s budget, answer 503 at its end, and give the 10 read attempts a time bound.
  6. Item 5. Single-item writes on a stream-enabled table have no stated answer when two meet. Each runs as a query-service transaction (lines 467-468 and 504), and the RFC doesn't say whether it takes an intent lease. If it does, a second PutItem on the key answers TransactionConflictException (lines 531-534) or TransactionCanceledException (line 555). Main's test_racing_puts_on_a_stream_table_all_succeed expects both to succeed. Please state the answer, keep TransactionConflictException for a live TransactWriteItems, and say how a write tells the two apart. Row 4.4 says writers of different keys contend on the shard counter. Lines 616-617 take the number with an atomic KV increment, which doesn't conflict, so please delete that clause.
  7. Item 6. Lines 902-904 say a 100-action TransactWriteItems can run past txtimeout, and the query settings page says no statement continues after it. Please state the answer before and after the commit point. memory-quota defaults to 0, which means no quota, so please write the requirement as 0 or at least the measured value. Please also measure on a stream-enabled table with NEW_AND_OLD_IMAGES, whose records add both images to the transaction.
  8. Item 8. The fence starts at the catalog row (lines 483-491). Main's CachedTableKeyInfoStore (crates/server/src/key_info_cache.rs) is a stale-while-revalidate cache, and UpdateTable invalidates it after the catalog mutation succeeds. A request that starts between the row write and the invalidation carries the old index list, and the fence doesn't wait for it. A count of request starts also shows that later requests began, not that earlier ones finished. Please start the fence at the invalidation and wait for the requests in flight, the reindex reconciler's writes included. Please add that window to open item 5's test.
  9. Item 9, numbers. Please give the N encoding's byte layout: field widths, the exponent bias, and the complement and terminator for negative numbers. Please add encoded values for a few numbers, such as -1.55, -1.5, 0 and 1.5. The example's N#21001 for 1 and N#2100325050 for 250.50 don't follow one layout.
  10. Item 10. Couchbase's documentation answers the EXPLAIN question. The index pushdowns page says order pushdown needs the ORDER BY keys aligned with the index order, and that a reverse scan isn't supported. Please make the descending twins part of the design and count them in the index budget.
  11. Item 11. Please say whether the budget counts index replicas and the twins, and how two concurrent creates stay under the limit.
  12. Items 12 and 18. The lock is a document in catalog.settings (lines 288-289), and the baseline creates that collection under the lock (line 262). On main, the Cassandra backend has the same order and runs create_lock_table before it takes the lock. Please do the same, or keep the lock in _default._default. Lines 231-233 call a scope with no extenddb_migrations ledger someone else's, so init refuses the out-of-tree deployment that row 1 adopts. On main the foreign-store check reads the contents, and only on an Uninitialized store. Please do the same and name the command that adopts. The table also needs each entry's kind and convergent flag (ADR-0023 decision 1). Row 1 should say it deletes the resource_tag_migration marker, as ADR-0023 decision 4 does.
  13. The multi-part RANGE limit. Lines 493-497 say the engine refuses a Query with conditions on two or more RANGE parts. On main, KeyCondition::resolve_multipart_with accepts them, since #381 closed on 31 Oct. A backend that filters only the first RANGE attribute refuses the rest with extenddb_storage::util::key::refuse_conditions_beyond_first_range, as MongoDB and Cassandra do, and their README rows state the limit. The issue those lines say this revision opens doesn't exist, and #1183 is the only issue you've opened. Please use the shared helper and the same README wording.

Please also fix these smaller ones:

  • The MutateIn limit leaves out the guard's two operations (lines 540-543). That leaves 14 for the update, so the limit is seven v3.2 SETs, and open item 3 should test eight.
  • Step 1 (lines 736-739) should carry the mandatory traits, the couchbase-integration job and the README row, as my answer 1 asked.
  • Prior art (lines 1175-1177) credits the Cassandra draft with the Unsupported snapshot and the ledger-after-body pattern. The draft has neither. They are ADR-0023 decision 2 and crates/storage-cassandra/src/snapshot_engine.rs.
  • check-cassandra-schema isn't on main (lines 312-314). Cassandra has the other two checks.
  • sha2 is already a workspace dependency (line 862). devtools/run-tests --backend takes postgres or mongodb, so the gate also needs a change there.
  • The PR description and #1183 still say "parity 331/331", give the EXTENDDB_* settings, and list the begins_with divergence.

Responds to the second review on ExtendDB#1184. Plain writes and transactions no
longer meet at the document: on a table a transaction has touched, both
take one lease document per item (KV insert, fail-if-exists), a
transaction verifies its leases before COMMIT WORK and marks them
committing across the commit, and a plain write that meets a committing
lease runs as a transaction; TransactGetItems leases every key it reads.
The stream reader resolves an aged number by a transactional read of the
record, never by age alone, and skip markers are written only after a
definite failure. Key encoding: the escape of | in key components (the
code's existing behavior), the N layout with encoded examples, corrected
example document. Descending twin indexes; the GSI backfill fence at the
cache invalidation with an in-flight counter; cluster-wide budget with
twins and replicas under the create lock; migration kinds and convergent
flags, the lock in _default._default, the foreign-store rule and
adoption; multi-part RANGE support on every part; timeout and
unknown-outcome answers; row 6.3 narrowed to the pinned run; the smaller
corrections. Open engineering items extended, with the lease cost
measurement.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@suravarjjala

Copy link
Copy Markdown
Author

Thank you for the second read. Revision 3 is on the branch and answers each point below by its number. The main change is a design change you asked for in substance: plain writes and transactions no longer meet at the document at all.

Access. The invitation to your account was sent on 2026-11-24 at 19:15 UTC and is still pending; GitHub answers 404 until it is accepted at https://github.com/couchbaselabs/extenddb-couchbase/invitations. Line 9 now says so, and says that until a reviewer has read the repository, every path and QE id in the RFC is a claim only it can show.

  1. The code escapes \ and then | in each key component before joining them (escape_key_component), so your two items encode to S#x|S#y\|S#z and S#x\|S#y|S#z, and test_separator_in_string_key_does_not_collide is that case. Revision 2's "unchanged" was my error, not the code's. "Key encoding" now gives the escape, why the backend keeps it rather than encode_netstring_composite (every v3.x document key is already written with it and a document key cannot be rewritten in place), and adds the |S# partition key to the test.
  2. Accepted in full, with your mechanism: an aged number is resolved only by reading its record inside a query-service transaction, delivered if found, skipped only if nothing is found after the attempt expired, and the stop kept if the read fails. No age alone resolves a number any more, and cleanupwindow is gone from the design. Open item 2's test holds the transaction longer than the age.
  3. Row 6.3 is narrowed to what the pinned run shows: two of the five pass, the three test_abac.py cases are the aws:SourceIp ones and fail behind Docker Desktop's bridge, and the first nightly after couchbaselabs/extenddb-couchbase#237 settles whether they are the nightly's three.
  4. The code already writes a skip marker only when the outcome is a definite failure; a commit with an unknown outcome (BridgeOutcome::Ambiguous) writes none. The RFC now says so, and says that LATEST and AT_TIMESTAMP iterators start no later than the first unresolved number.
  5. and 6. The staged-mutation guard is withdrawn: as you say, it rests on an undocumented attribute and cannot see a staged insert. In its place, on any table a transaction has touched, plain writes and transactions exclude each other through one lease document per item, taken by KV insert (fail-if-exists) by both sides. A TransactWriteItems leases every target, including keys it creates and ConditionCheck items, before it stages anything, verifies its leases by CAS before COMMIT WORK and rolls back if one was lost, and marks them committing with a long expiry across the commit; a plain write that meets a committing lease runs as a transaction, which the protocol orders after the committed one. TransactGetItems leases every key it reads, so an absent key is protected by the lease rather than by an insert-and-delete whose staging Couchbase does not document. Nothing in the design now depends on how a mutation is staged. The table a transaction has touched carries a transactional flag so that tables without transactions keep the single KV write; the cost on flagged tables is measured before FCP (open item 12). Open item 1 carries the create case and the live test over every plain path.
  6. Accepted. A plain write that meets a transact_get (or another plain) lease retries within the 64-attempt, 10 s budget and answers 503 at its end; TransactionConflictException is answered only for a transact_write lease; the read's attempts are bounded by 10 and 5 s.
  7. Stated: single-item writes on a stream-enabled table take no transact_write lease, two on one key conflict at the document and both succeed within the budget, 503 at its end; the lease's op field is how a write tells a transaction from another single-item write. The counter clause in row 4.4 is deleted.
  8. Stated: before the commit point a timeout rolls back and answers 503 with nothing written; after COMMIT WORK an unknown outcome is never retried by the server, the idempotency token written inside the transaction decides (success if it is there with the request's fingerprint, else 500 "outcome unknown, not retried"), and a client retry with the same ClientRequestToken resolves it. memory-quota is written as 0 or at least the measured value, and the measurement is on a stream-enabled table with NEW_AND_OLD_IMAGES.
  9. Accepted: the fence starts at the CachedTableKeyInfoStore invalidation and waits for every request in flight at that moment, the reindex reconciler's writes included, through an in-flight counter rather than a count of starts. Open item 5 covers the window.
  10. The layout is in "Key encoding" with field widths, the bias (1000) and the complement and terminator for negatives, and twelve encoded values from the implementation; the example document's values are corrected (1 is 210011, 250.50 is 210032505).
  11. Accepted: the descending twins are part of the design and counted in the budget.
  12. Stated: the budget counts twins and 1 + index_num_replicas copies of each index, and creates run under the server's create lock so two concurrent creates count one after the other.
  13. The lock moves to _default._default, which exists before the baseline creates the catalog scope. The foreign-store check runs only on an Uninitialized store and reads the contents; an out-of-tree deployment is reported WrittenByOlderRelease and adopted by migrate --yes. The migration table now has each entry's kind and convergent flag, mirroring MongoDB's, and row 1 deletes the resource_tag_migration marker.
  14. Thank you for the pointer to [Bug] Query on a GSI with one HASH and several RANGE attributes: wrong sort order, and three or more key conditions are rejected #381; we had been carrying that fix as a deferred upstream change. The backend already derives one column per RANGE part and was verified against the fixed engine, so the RFC now claims support on every part and commits to the upstream multi-part tests, with refuse_conditions_beyond_first_range and the MongoDB README wording as the fallback if any case fails. The sentence about an issue is gone.

Smaller items. With the guard withdrawn the MutateIn has all 16 operations, so the limit stays at eight SETs and open item 3 tests nine; step 1 now carries the mandatory traits, the couchbase-integration job and the README row; prior art credits snapshot_engine.rs and ADR-0023 decision 2; check-cassandra-schema is corrected; sha2 is noted as a workspace dependency and devtools/run-tests --backend gains couchbase; the PR description and #1183 are updated to match.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 3 and the reply. I read it at 0f4832a against main at 3534c9e, and checked the new statements about Couchbase against Couchbase's documentation.

Revision 3 resolves points 1, 2, 4, 7, 8, 11 and 12. It also resolves the MutateIn count, step 1, the prior art credits, check-couchbase-schema, sha2 and run-tests --backend. I checked the key scheme offline from the RFC's text. The escape gave no collision over 8,071,281 two-part keys built from \, |, #, |S# and the empty string. The twelve N values match the layout, and encoded order matched numeric order over 54,866 numbers.

One of the new mechanisms can't meet RFC-0003 as written:

  1. The transactional flag (lines 631-637). On a table without the flag, a plain write takes no lease and is one KV write. The first TransactWriteItems or TransactGetItems on a table sets the flag and then takes its leases. A PutItem that read the flag as unset before that has no lease. Its KV write can land while the transaction commits the same key, and nothing waits for it. Couchbase's transaction concepts page says either write may then win, even with CAS. So the transaction can be partly applied, or an acknowledged PutItem can be lost. The same race lets a PutItem create an absent key during the first TransactGetItems. Lines 636-637 say no other process can hold a stale view, but this race is inside the one server. If the server reads the flag through main's CachedTableKeyInfoStore (crates/server/src/key_info_cache.rs), the window is longer. That cache serves an entry until its TTL ends or a handler that changes the catalog row invalidates it. A TransactWriteItems isn't such a handler. Please fence the flag the way lines 549-558 fence a new GSI. Wait for every plain write that read the flag before the transaction set it. Your unresolved question 3 offers the other way, a lease on every table. That makes the flag unnecessary and closes this window, at the cost open item 12 measures. Please also add a test for it. Hold a PutItem between its flag check and its KV write while the first TransactWriteItems commits that key.

These still need to change:

  1. A TransactWriteItems deletes its committing leases when "the commit has returned and Couchbase has unstaged every document" (lines 611-612). I found no Couchbase page that says a query-service COMMIT WORK returns only after unstaging. The SDK's error handling page says a transaction can reach its commit point and return before unstaging is complete. Cleanup then finishes the commit. If the leases go first, a plain write can meet a staged committed mutation at the document. The lease is there to prevent that overlap. The unknown-outcome answer (lines 683-690) has the same gap. It answers success when it finds the token, but a GetItem, a KV get (line 460), can return the old item until cleanup runs. That breaks RFC-0003 4.5. Please cite a source for the unstaging, or measure it. Otherwise, keep each committing lease until a KV read shows the committed body, and answer success only after those reads. The error handling page gives the same advice to an application that needs the commit visible to non-transactional readers.
  2. A plain write can outlive its own lease. The lease expires after 10 s (line 599), and only a TransactWriteItems renews it. A plain write holds its lease through the CAS loop, which can last 10 s (line 502). Each attempt at majority durability can also wait for the durable-write timeout, 10 s by default (durability). So the lease can expire while the write is still in flight, and a transaction can take the key in that gap. Please give the plain lease an expiry above the write's budget plus that timeout. Or stop new attempts when too little of the lease remains. Please also make every lease delete, and the rewrite to committing, a CAS operation on the owner's version.
  3. A TransactWriteItems or TransactGetItems that meets a committing lease has no path. Only a plain write runs as a transaction then (lines 625-631). A TransactWriteItems cancels after 2 s (lines 603-605), and a TransactGetItems after 10 attempts or 5 s (lines 669-672). A committing lease lives 24 h (line 611). A query node that fails past the commit point keeps the lease in place. So does a backend crash between the rewrite and COMMIT WORK. Every transaction on that item then cancels until a plain write runs or 24 h pass. No transaction is in flight on the item then, so TransactionConflict doesn't describe it. Please give transactions the plain write's rule. Please also have a transaction that never sent COMMIT WORK delete its committing leases on a definite failure.
  4. Lines 757-759 say a single-item write on a stream-enabled table runs as a query-service transaction "after checking that no such lease holds the item". That check looks for a transact_write lease only. Lines 616-618 say every plain write on a flagged table takes the plain lease. If only the check runs, a PutItem on a flagged stream-enabled table can create a key that a TransactGetItems holds under a transact_get lease. That reopens round 2's point 6 on those tables. A check followed by a write is also the race of round 2's point 5. Please say that every single-item write on a flagged table takes the plain lease. Please also add a stream-enabled table to open item 4's test.
  5. The index backfill (lines 547-549) and the reindex reconciler (line 556) write items without a lease. The lease rule names only the API writes (line 616). On a flagged table, a TransactWriteItems can stage an item while the backfill writes it, and Couchbase calls that outcome undefined. Please have the background writers take the item's lease, and add that case to open item 5's test.
  6. Row 4.1 (line 1117) still says a bare PutItem is one KV write with no retry, so two racing calls both succeed. On a flagged table it takes the plain lease. A write that meets another plain write's lease retries, and answers 503 at the end of its 10 s budget (lines 620-625). RFC-0003 4.1 asks that two concurrent unconditional PutItem calls both succeed. Plain writes only need to exclude transactions. Please let them share the lease. Or state the bound and the 503 in row 4.1 and in the differences document. Please also run main's tests/test_put_item_create_race.py and the test_atomic_counter test of tests/test_concurrency.py on a flagged table.
  7. A TransactGetItems writes the documents it reads, by deleting and re-inserting them (lines 655-658). It gets none of the TransactWriteItems lease rules: no renewal, no CAS check before COMMIT WORK, no committing state. If its query node fails after the commit point, its re-inserts stay staged while its 10 s leases lapse. A plain write can then take a lease and write the item. When cleanup unstages the read's re-insert of the older body, the acknowledged write is lost. Please give TransactGetItems the same lease rules, and add it to open item 1's node-failure test.
  8. Lines 230-235 say the backend reports an out-of-tree deployment as WrittenByOlderRelease, and that migrate --yes adopts it. On main, a store with a catalog_version row and no ledger is a catalog (Snapshot::initialized in crates/storage/src/migrations/runner.rs). ADR-0023's status table gives such a catalog Behind at migration 1. WrittenByOlderRelease needs a ledger row for migration 1, and migrate --yes refuses that status (refusal in crates/storage/src/migrations/catalog.rs). The adoption itself works, since migrate --yes applies the baseline to a Behind catalog. Please say that. Please also define Uninitialized as crates/storage/src/migrations/status.rs does: no ledger row and no catalog_version row.
  9. Lines 561-568 say you verified the per-part predicates against the engine's resolve_multipart_with. That function came with #429, the fix for #381, on 31 Oct. The backend builds against the pinned rev 7b828b0 (lines 859-862), whose commit date is 23 Oct and which doesn't contain #429. Please name the ExtendDB revision that check ran on, or leave the claim to open item 13. Please also name the tests. Main's file for conditions on several RANGE attributes is tests/test_gsi_multi_range_query.py. If the fallback ships, couchbase goes into that file's FIRST_RANGE_ONLY_BACKENDS and into the row of docs/differences-from-dynamodb.md that names the two refusing backends. The README row should then say which behaviour ships.
  10. Line 9 now marks the paths and QE ids as claims only the reference repository can show. The figures, job and build numbers and that repository's issue numbers rest on it too. So does what the RFC says the code does. Please mark them the same way, and keep row 6.3 OPEN until a reviewer has read the repository.

Please also fix these smaller ones:

  • The lease writes (lines 597-611) name no durability, and a lease lost in a failover lets a plain write into a commit. Please give them the backend's durability setting. Please also say what <item key> is in the lease key. If it's the full document key, a 240-byte key gives a 257-byte lease key, past Couchbase's 246.
  • The stream reader (lines 738-747) should read the record by its key. An index scan may not return a committed insert that Couchbase hasn't unstaged yet. The age assumes the attempt expires txn_timeout after it took its number. The txtimeout clock starts only when BEGIN WORK succeeds (query settings), and BEGIN can retry on another node. Please take the number after BEGIN WORK returns. Please also say that a writer that sent COMMIT WORK writes no skip marker, whatever ROLLBACK WORK answers.
  • The fence's one counter per table (lines 553-557) also counts requests that start after the invalidation. It shows the earlier ones finished only when it reaches 0, which a busy table may never do. Please count per key-info generation.
  • The index budget check runs "under the server's create lock" (lines 910-914). Main has no such lock, so please say it's the backend's own and where the backend holds it. The reconciler builds an UpdateTable's indexes later (lines 546-549), so the check should also count the catalog's CREATING indexes. The TTL term says "plus two", where each index takes 1 + index_num_replicas copies by the rule above it.
  • Rows 1.1 and 1.2 (lines 1086-1087) still describe the key without the escape. Row 1.2's reason is the one round 2's point 1 showed doesn't prevent the collision.
  • Open item 1's live test checks only that plain writes refuse while another request holds the lease. That passes when a plain write reads the lease instead of inserting it, or reads a stale flag. Killing the query node "after COMMIT WORK is sent" doesn't show that the transaction reached its commit point either. Please check that with a transactional read of the token.
  • Open item 12 measures throughput and latency. RFC-0003 4.1, 4.3 and 4.4 depend on how many writes on one hot key end in 503 or TransactionConflictException, so please report those counts too.
  • A TransactWriteItems without ClientRequestToken has no token to read on an unknown outcome (lines 683-690). Please say what the backend does then.
  • Line 213 still lists the migration lock in catalog.settings. Lines 297-299 put it in _default._default.
  • Lines 257-258 say the baseline deletes the marker "once it has recorded migration 2 from it, as ADR-0023 decision 4 does". In decision 4, migration 1 deletes the marker and records nothing for migration 2.
  • The PR description and #1183 still describe "an intent lease", and the description still says reviewer access is on request. Please describe the per-item lease and the transactional flag instead.

This was in revision 2, so it isn't a condition here: lines 801-802 name the extenddb key commands, and main's command is extenddb encryption-key.

The engineering items revision 3 listed are implemented and merged in the
reference repository (commits b0c272f, 5e8462b, f4f293d), each with its
test, and the three-node harness passes 19 of 19 with the new
commit-point hold (a query engine frozen 60 s under transactional, plain
and stream load: balance conserved, no acknowledged write lost, the
stream reader never passed a number whose record appeared later). The
acceptance rows marked OPEN are closed; "Open engineering items" becomes
a status table; the 100-action transaction and the lease cost are
measured on the demo stack; EXPLAIN confirms the descending twin; the
hot-key observation (plain writes under a transaction firehose) is
recorded under Drawbacks. Still pending: the multi-part RANGE tests
(blocked on the pin), the performance-cluster figures, and the
shared-tier bound.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 4. I read it at 6111e88 against main at 5252eda.

Revision 4 doesn't change the text of the Transactions section: lines 608-710 match revision 3's lines 588-690. Its new text says that the reference repository implements the engineering items of revision 3. This review covers the RFC text, so the design that the RFC states has to meet each point below. We can't read that repository yet, so this review can't check the claims that rest on it.

These points from round 3 are still open:

  1. The transactional flag window (lines 653-659) still blocks acceptance. A plain write that read the flag as unset can still land while the first transaction commits the same key. Lines 656-657 still say that no other process can hold a stale view, but the race is between two requests in that one server. Unresolved question 3 (lines 1344-1347) offers the lease on every table and now gives its cost on the demo stack. Please fence the flag and add the held-write test from round 3, or take the lease on every table and drop the flag. If the flag stays, question 3 should say that the flag needs the fence, and what the fence costs.
  2. The committing leases are still deleted when COMMIT WORK returns, and the unknown-outcome answer is unchanged (lines 630-635 and 702-710). Couchbase's transactions page calls unstaging an eventually consistent commit for KV reads.
  3. A plain write can still outlive its lease, and the lease deletes and the committing rewrite still use no CAS (lines 517, 619 and 630-638).
  4. Every transaction on an item with a committing lease still cancels until a plain write runs or 24 h pass (lines 622-625, 645-651 and 689-692).
  5. Single-item writes on a stream-enabled table still check for a transact_write lease only (lines 782-784, against lines 636-640).
  6. The fence now runs two backfill passes (lines 568-578), and neither pass takes the item's lease.
  7. Row 4.1 (line 1145) is now closed. A plain write that meets another plain write's lease still retries. It answers 503 at the end of its 10 s budget (lines 643-645 and row 4.3). Please let plain writes share the lease, or state the bound and the 503 in row 4.1. Please also run the two upstream tests from round 3 on a flagged table.
  8. A TransactGetItems still deletes and re-inserts its documents without the TransactWriteItems lease rules (lines 672-695).
  9. WrittenByOlderRelease and Uninitialized are unchanged (lines 239-245). On main, a store with a catalog_version row and no ledger is Behind at migration 1 (crates/storage/src/migrations/status.rs).
  10. Lines 584-588 still say the per-part predicates were "verified against the engine's resolve_multipart_with". Item 13 (line 1236) now says that the engine at the pin refuses those queries before the backend sees them. So that check can't have run at the pin. Please drop "verified", or name the revision it ran on. Please also add an acceptance row that names tests/test_gsi_multi_range_query.py and the behaviour that ships. That's either the per-part predicates with that test passing, or couchbase in its FIRST_RANGE_ONLY_BACKENDS, in docs/differences-from-dynamodb.md and in the README row.
  11. Line 9 is unchanged. It marks each docs/, scripts/ and tests/ path and each QE id as a claim that only the reference repository can show. Revision 4 closes every row that revision 3 left open, on commits in that repository (lines 86-94 and 1107-1108). Those are rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2. Their commit ids, pass counts and timings have no such mark. Please mark them the same way, and keep those rows open until a reviewer reads the repository.

New in revision 4:

  1. The fence (lines 568-578). The backend first sees a write when the engine calls it, and the engine resolves the key info before that call. Main's UpdateTable invalidates the key-info cache after the backend returns (crates/engine/src/update_table.rs, line 281). So a counter in the backend misses a write that resolved the old key info and hasn't reached the backend yet. The backend also can't tell when the invalidation ran. Lines 569-571 say that UpdateTable builds and backfills before it returns. But lines 561-564 and row 2.4 say that the reconciler does it, and that index DDL never runs on the request path. Line 574 lets the GSI worker flip the index without saying that it waits and backfills first. tests/test_gsi_fence.py races four writers against the create, and two backfills with no wait can pass that test too. Please state one order in all three places, and describe the wait through events that the backend sees. Please also restore revision 3's test. It holds a write with key info from before the invalidation until the second backfill passes its item. Please hold a reindex reconciler write the same way. Revision 3's fence also waited for the reindex reconciler's own writes (its lines 555-557). Revision 4 doesn't say whether the fence still waits for them.
  2. The commit-point hold (lines 775-780) freezes a query engine at a moment that isn't tied to any transaction's state. "Never passed a number whose record appeared later" also holds when no record appeared later. Please make each run fail unless a transactional read of a token shows a transaction committed while one of its records is still staged. Please also report how many numbers txn_peek resolved during the freeze.
  3. The hot-key observation (lines 1274-1278). The figure of 5,961 refusals against 4 acknowledged writes doesn't tell two kinds of refusal apart. Some may have met an in-flight transaction's lease, and some the lease of a transaction that had already answered. So it doesn't show DynamoDB's priority for the transaction. Please describe it as this backend's behaviour, or measure DynamoDB under the same load.

Please also fix these smaller ones:

  • Row 3.5 (line 1139) is closed without the test that revision 3 named: a PutItem that creates an absent key during a TransactGetItems. The new test creates the key with a TransactWriteItems. Point 5 still allows the PutItem case on a stream-enabled table.
  • Engineering item 2 (line 1225) names LATEST only. Lines 771-772 state the rule for AT_TIMESTAMP too.
  • The two new measurements (lines 711-716 and 1078-1083) don't say which durability level they ran at. The 503 below the memory quota and the two timeout answers have no test.
  • Row 6.3 (line 1168) still says "or marked OPEN with its engineering item", and revision 4 marks no row OPEN.
  • Line 658 still says the flag's cost "is measured before FCP", next to the measurement.
  • These smaller ones from round 3 are unchanged:
    • the lease's durability and key length (lines 617-620)
    • the stream reader's read by key, the txtimeout clock and the skip marker (lines 751-766)
    • the counter per key-info generation (line 568)
    • the index budget's lock, the CREATING indexes and the TTL term (lines 931-944)
    • open item 1's live test, and the 503 counts in open item 12
    • a TransactWriteItems without ClientRequestToken
    • line 222 against lines 306-308, and lines 266-267 against ADR-0023 decision 4
    • rows 1.1 and 1.2 (lines 1114-1115)
    • the PR description and #1183

This note isn't a condition, because revision 3 had the same text. A TransactWriteItems that ends without a commit leaves its leases until their 10 s expiry (line 619). It ends that way when it can't take a lease in 2 s or when a condition fails. It also ends that way on a rollback, and when its txtimeout expires before the commit point. Until the leases expire, the backend refuses plain writes on those items with TransactionConflictException. In DynamoDB's transactions guide, a plain write conflicts only with an ongoing TransactWriteItems that includes the same item. Deleting the leases on every path that ends the transaction would stop those refusals.

@suravarjjala

Copy link
Copy Markdown
Author

Revision 4 is on the branch. Since revision 3 the engineering items it listed have been implemented and merged in the reference repository (commits b0c272f, 5e8462b, f4f293d), and the RFC now records their state in "Engineering items of revision 3" instead of an open list.

The test you asked for in round 2 (items 2 and 5) ran on the three-node Docker harness: one node's query engine is frozen for 60 s, longer than the stream gap grace, under three transaction writers, two plain writers and a stream reader on one table. Over two runs, 1,646 and 2,816 transactions committed, the balance sum was conserved, every acknowledged plain update and every acknowledged transaction was applied, plain writes answered only 200 or TransactionConflictException, and the stream reader never passed a sequence number whose record appeared later (scripts/txn-commitpoint-test.py, step 7/8 of scripts/query-txn-multinode-test.sh; 19 of 19 on the second run, the first run's single failure was a client read timeout in a property round right after cluster bring-up, which replays clean).

Also measured: EXPLAIN plans a descending Query on the _desc twin with no Order operator (your item 12); a 100-action, 4 MB TransactWriteItems on a NEW_AND_OLD_IMAGES table commits in 0.63 s at the default memory-quota (item 6, so the requirement is the default); and the lease roughly doubles a bare PutItem's median on a transaction-touched table on the single-node demo stack (0.81 ms to 1.88 ms), with the multi-node figure to come from the performance cluster before FCP.

Two init fixes came out of the harness and are in f4f293d: a regression of mine (the base twin created before the collection existed on a fresh cluster) and a pre-existing race (a CREATE COLLECTION reaching a query node before the scope created through another node had propagated). One observation is recorded under Drawbacks: under a sustained transaction firehose on one item, plain writes to it are refused almost every time, which is the priority rule as specified.

Still pending, and said so in the RFC: the upstream multi-part RANGE tests, which need the pin past #381 (the in-tree port); the performance-cluster figures; the measured shared-tier bound (unresolved question 1). The repository invitation to your account is still pending at https://github.com/couchbaselabs/extenddb-couchbase/invitations.

@LeeroyHannigan LeeroyHannigan added the RFC Request for Comments, a proposal open for discussion before implementation label Nov 25, 2026
suravarjjala and others added 6 commits November 25, 2026 20:42
Lines >= 700 only: lease on every table (flag removed), skip-marker and
unknown-outcome rules, no-token COMMIT, memory-quota answer, stream reader,
index budget incl. TTL, rows 1.1/1.2/2.4/3.5/4.1/4.3/5.2/6.2 marked OPEN with
[ref-repo], engineering items restated with what ran and what did not, Q3.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@suravarjjala

Copy link
Copy Markdown
Author

Thank you for round 4. Revision 5 is on the branch (RFC head 527f4ca5), and line numbers below are its lines. You were right that revision 4 did not change the Transactions text; this revision does, and each point is answered by its number. Verdicts are FIXED-TEXT, FIXED-CODE, ANSWERED or OPEN. A claim that rests on the reference repository is marked [ref-repo] as line 9 defines, because that repository is not readable by reviewers yet (line 9 gives the state of the invitation).

Defects I found and fixed while answering. Five of them were mine, and they change what you should read in the text:

  • COMMIT WORK error 17004 ("transaction not present") was treated as "nothing committed". A client retry could then have applied the writes twice. It is now an unknown outcome: leases stay committing, the answer is 500 "commit outcome unknown, not retried". Covered by unit tests of the classifier and of commit_outcome only; no live run.
  • An unrecognised COMMIT WORK error could write a stream skip marker, which could hide a record that had committed. It is now an unknown outcome and writes no marker. Unit tests only.
  • The query service's memory-quota error (code 17016, "Transaction memory (N) exceeded quota (M)") answered 500, not 503. My first classifier had guessed the wrong code and wording, so it missed it. At a 1 MB quota on the demo stack the corrected build answered 503 with nothing written and the cause in the log [ref-repo]. That is one observed run of an ad-hoc script, not a committed test. At COMMIT WORK the same error is an unknown outcome (unit-tested only).
  • The TTL index took neither the create lock nor the index budget, and its rebuild of an out-of-date index ran outside both. Both now run under the lock with cost 1 + index_num_replicas, and the rebuild checks after the drop so the old index is not counted twice. A unit test covers the cost arithmetic only. A live TTL check enabled TTL on a fresh table and the sweeper deleted the 5 expired items and left the 4 others; I did not inspect the index, and the rebuild path has not been run, because it needs an out-of-date index.
  • The plain-lease retry loop checked its 10 s deadline on some retry paths and not on others, so the bound was not strict. It now checks at the top of every iteration. The test covers the pure deadline function only; the retry branches themselves have not been run.
  1. Flag window. FIXED-TEXT, FIXED-CODE; one test OPEN. I took your second option: the transactional flag is deleted and every plain write takes the item's lease on every table (lines 647-656; bb94b2c [ref-repo], on a branch of that repository that is not merged). Unresolved question 3 (lines 1498-1509) now says the race cannot be fenced from the backend alone and what the lease costs (three KV operations per write, at the backend's durability), and asks whether you want an opt-out that would need the fence the flag lacked. Your round-3 held-write test was for the flag, so it no longer applies. The test that would show a plain write really inserts its lease, holding a PutItem after its lease insert while a transaction commits the key, is not written: the fault-hooks build holds a write after its catalog-view read, not after its lease insert. Item 1 (line 1372) says so and stays OPEN for it. tests/test_txn_lease.py [ref-repo] passed 8 of 8 on the demo stack; it checks answers and invariants, not that the lease is inserted.
  2. committing leases and the unknown outcome. PARTLY: FIXED-CODE for CAS-pinned actions, OPEN for the rest. After COMMIT WORK the backend now keeps the committing leases until a KV read of the written document shows the committed body (or its absence, for a delete), within 15 s; past 15 s it answers success and the leases stay for the next writer (lines 673-693). I do not rely on the commit being visible when COMMIT WORK returns, as your link says. Two gaps remain and are engineering item 15 (line 1386), with no code: an action that does not pin a document by CAS (an unconditional Put, a create, an unconditional Delete, a ConditionCheck) gets no visibility wait, and the token read after an unknown outcome is a KV read that can miss a token that committed and is not yet unstaged (lines 782-790). No run of mine isolates the visibility wait.
  3. A plain write outliving its lease; no CAS. ANSWERED, FIXED-CODE. Lease deletes are CAS removes that check the owner id first, and the rewrite to committing is a CAS replace (lines 658-668, 681-693). A plain write stalled longer than its lease can still land; lines 712-718 say the lease is a bound, not a fence, and that nothing re-checks a plain write's lease between its insert and its KV write. The same paragraph and the outcomes table (line 741) now say that a write from the Couchbase side (SQL++, Eventing, Mobile, XDCR) takes no lease. No test stalls a plain write past its lease.
  4. Transactions cancelling on committing. FIXED-CODE. A TransactWriteItems that meets a committing lease takes it over by CAS; a TransactGetItems waits 5 s and then reads that key inside a throwaway query transaction (lines 707-711, 734-737). So a transaction no longer waits for a plain write or the 24 h expiry to clear the lease; a TransactGetItems that cannot get two agreeing passes within its 5 s is still cancelled with TransactionConflict. I have no test that isolates this path.
  5. Stream-enabled tables. FIXED-CODE. A single-item write on a stream-enabled table takes the item's lease like any table, then runs as a query-service transaction, with the lease's expiry at txtimeout plus 20 s (lines 909-923, 670). TransactionConflictException is answered only for a transact_write lease. test_racing_puts_on_a_stream_table_all_succeed is in test_put_item_create_race.py, 9 passed (see 7).
  6. Backfill takes the item's lease. FIXED-CODE, built and unit-tested only for the committing skip. Each backfilled item is rewritten under its plain lease; an item a committed transaction still holds committing is skipped, the fenced pass leaves the index CREATING, and the worker retries every 30 s (lines 598-602, item 5 at line 1376). The skip has no dedicated test.
  7. Row 4.1. ANSWERED (text); one test OPEN. Row 4.1 (line 1291) and lines 694-702 state the bound: a plain write that meets another plain write's or a transact_get lease retries with jittered backoff and answers 503 at 10 s. Of your two round-3 tests, I ran the whole of test_put_item_create_race.py (9 passed) and test_concurrency.py::TestAtomicCounter::test_atomic_counter (1 passed) at the pin 7b828b0, against the final code on the single-node demo stack at EXTENDDB_DURABILITY=none [ref-repo]. "A flagged table" no longer exists, since every table takes the lease. No test drives two plain writers into the 10 s bound.
  8. TransactGetItems. FIXED-CODE. It takes a transact_get lease on every key, present or absent, in sorted order, reads each key by KV and releases; no document is deleted and re-inserted, so no CAS changes and no stream record is written (lines 743-766). tests/test_txn_lease.py [ref-repo] runs three TransactGetItems readers against a TransactWriteItems that creates and updates a pair, and the pair was never torn across an absent key (8 of 8 passed).
  9. WrittenByOlderRelease and Uninitialized. FIXED-TEXT. Lines 243-253 now follow main's status check: a catalog with catalog_version and no ledger is Behind at migration 1 with no version (exit 3) and migrate --yes adopts it; WrittenByOlderRelease is the later state. I checked that text against crates/storage/src/migrations/status.rs on main 5252eda31 by reading it, not by running it.
  10. Multi-part RANGE. FIXED-TEXT; the test is NOT RUN, blocked on the pin. OPEN. "Verified against resolve_multipart_with" is gone. Lines 617-627 say that function (f49c5f82, fix(query): classify and order key conditions on a multi-attribute GSI the way the service does #429) does not exist at 7b828b0, and the engine refuses the query before the backend sees it. New row 2.8 (line 1275) names tests/test_gsi_multi_range_query.py and the behaviour that ships in both states: until the pin moves, couchbase is in FIRST_RANGE_ONLY_BACKENDS, in docs/differences-from-dynamodb.md and in the README row; after, the per-part predicates ship with that test passing. Item 13 (line 1384) is the work. I have not counted the "60 passed" target.
  11. Marking. FIXED-TEXT. Line 9 defines [ref-repo], and it is now on every commit id, pass count and timing in rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2, including the demo-stack counts in row 4.1. Those six rows stay OPEN until a reviewer has read the repository (line 3, line 1250, row 6.3).
  12. Fence. FIXED-TEXT; FIXED-CODE; the reconciler test is OPEN. I agree the backend cannot see UpdateTable's invalidation, so the text no longer waits for it. One order, in the section (lines 573-615), row 2.4 (line 1271) and item 5 (line 1376): the request path builds and backfills once and publishes CREATING; a detached task sleeps the catalog freshness window, waits for this server's in-flight writes, backfills again and flips ACTIVE; the worker repeats it at 75 s. The waits are on events the backend sees: a per-table, per-generation counter that a single-item write takes before it reads its catalog view, that a TransactWriteItems takes once per table, and that the reindex reconciler takes before it re-reads the catalog row for each document it rewrites. So the fence does wait for the reconciler's writes. A drain that times out leaves the index CREATING. Tests: tests/test_gsi_fence.py [ref-repo] passed 1 of 1, but as you say it holds nothing. Your round-3 test is restored as tests/test_fault_hooks.py [ref-repo]: a PutItem whose key info came before the publish is held until after it, and must land with the index column; it passed on each fault-hooks run, on a fault-hooks build, single-node, PutItem only. The same hold for the reindex reconciler is a skipped stub (OPEN). The transaction guard, the reconciler change and the committing skip are built and unit-tested only.
  13. Commit-point hold. OPEN; not run since I changed it. I did not meet your wording. The gate is per stream record, because a stream record carries no transaction id (lines 883-907): a run fails unless the backend logs at least one record resolved by a transactional read after the freeze began, and it prints that count. That line fires on any transactional-read hit, so it does not show that the record was still staged at that instant, and the text says so. The --since change to the script is syntax-checked only and the hold has not run since. The revision-4 counts could not be traced to a run and are withdrawn. Row 5.2 (line 1302) says the property is the design's intent and that the hold that tests it is unrun.
  14. Hot-key observation. FIXED-TEXT. The refusal-against-acknowledged figures of revision 4 are withdrawn (lines 1418-1432, item 12 at line 1383). The paragraph now says that a harness run does not tell a refusal by a transaction that goes on to commit from one by a transaction that was cancelled and has not yet released its lease, that DynamoDB was not measured under the same load, and that it describes this backend's behaviour only, with no parity claim. The measurement I owe is the lease's cost and the split counts on the performance cluster at durability = majority, a condition of FCP, and not made.

Smaller items

  • Row 3.5, PutItem creating an absent key during TransactGetItems. ANSWERED. tests/test_txn_lease.py [ref-repo] has it on a plain and on a stream-enabled table (row 3.5, item 4 at line 1375); 8 of 8 passed. Row 3.5 stays OPEN under point 11.
  • Engineering item 2 and AT_TIMESTAMP. FIXED-TEXT, OPEN. Item 2 (line 1373) and lines 876-883 cover AT_TIMESTAMP: main supports it from feat(streams): AT_TIMESTAMP shard iterator on all four backends #468 (6aef346f) and the pin does not. The in-tree rule starts a LATEST or AT_TIMESTAMP iterator no later than the first unresolved number. There is no code at the pin; the acceptance is tests/test_streams_at_timestamp.py on main once the pin moves.
  • Durability level and untested answers. FIXED-TEXT; some untested. Lines 807-815 and item 6 (line 1377) state it: the 100-action, 4 MB request committed in 0.67 s on the one-node demo stack at the default memory-quota (0) and EXTENDDB_DURABILITY=none [ref-repo]. The lease-cost measurement is withdrawn. The 503 below the quota was observed once, as above. An injected ambiguous COMMIT WORK with a token resolved to success with the counter at 1 and a same-token retry left it at 1; the same fault with no token answered 500 and was not retried, counter 1; all on a fault-hooks build, single node [ref-repo]. The txtimeout answer (503, nothing written) has unit tests of its mapping and a script that asserts neither; no live test asserts both. OPEN.
  • Row 6.3 and line 658. FIXED-TEXT. Row 6.3 (line 1314) now lists items 1, 2, 5 and 8 as having OPEN parts, item 13 as blocked on the pin and item 15 as a design gap. The flag sentence is gone with the flag.
  • Lease durability and key length. FIXED-TEXT, FIXED-CODE. The key is the 64-byte lower-case SHA-256 hex of scope, collection and document key, and every lease insert, replace and remove carries the backend's durability (lines 658-669).
  • Stream reader. FIXED-TEXT. It reads the number's record by key (USE KEYS) inside a query transaction; BEGIN WORK goes first and the number is taken after it, so the txtimeout clock starts at BEGIN; a skip marker is written only when the answer says nothing committed (lines 847-880). The narrowed marker rule is unit-tested only.
  • Counter per generation. FIXED-TEXT, FIXED-CODE. Lines 590-593; covered by the tests under point 12.
  • Index budget. FIXED-TEXT, with an OPEN part. Lines 1052-1070 and item 8 (line 1379): the lock, a CREATING index counted because UpdateTable creates and builds it before it publishes, and the TTL index at 1 + replicas (see the defects above). Whether system:indexes lists a replica as a row of its own is unchecked on a cluster with replicas. OPEN.
  • Open item 1's live test and the 503 counts in item 12. OPEN, see 1 and 14.
  • TransactWriteItems with no ClientRequestToken. FIXED-TEXT. Lines 794-801: an unknown COMMIT WORK outcome answers 500 and is not retried, and the leases stay committing. boto3 fills a token in by default (botocore 1.43.86), so the test removes that handler.
  • Line 222 against lines 306-308, and 266-267 against ADR-0023 decision 4. FIXED-TEXT. The migration lock is in _default._default (lines 226-228), and migration 1's body deletes the resource_tag_migration marker and records nothing for migration 2 (lines 275-276).
  • Rows 1.1 and 1.2. FIXED-TEXT. A table without a sort key uses the partition key's encoding unescaped, as the code does; the text says so (lines 447-449, rows at lines 1259-1260).
  • PR description and [RFC] Couchbase storage backend (crates/storage-couchbase) #1183. Refreshed for revision 5 (bodies attached separately).

Your closing note. A TransactWriteItems that ends without a commit now deletes its leases before it answers, on every path you listed: it cannot take its leases, its condition fails, it rolls back, a lease is lost, or txtimeout expires before the commit point (lines 719-729). Two paths deliberately keep the leases: a commit not yet visible to KV reads and a commit with an unknown outcome, so the next writer orders itself after a transaction that may have applied. A request its client abandons mid-transaction is not covered by a release; the native expiry is the backstop, and I have not checked whether the server detaches the request from the connection. No test covers release on rollback or on a failed condition.

Still open (the same list as line 3 and row 6.3):

  • Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2, until a reviewer has read the reference repository.
  • Item 1: the test that holds a PutItem after its lease insert is not written.
  • Item 2: AT_TIMESTAMP, no code at the pin. Point 13: the commit-point hold, not run since its gate changed.
  • Item 5: the reconciler held-write test is a skipped stub; the transaction guard, the reconciler change and the committing skip are unit-tested only.
  • Item 6: no live test of the txtimeout 503.
  • Item 8: whether the index count is of definitions or instances with replicas.
  • Item 12: the lease's cost and the split refusal counts on the performance cluster.
  • Item 13: the multi-part RANGE tests, blocked on the pin.
  • Item 15, Gaps A and B: the visibility wait for actions that do not pin a document by CAS, and the token read after an unknown outcome. No code.

Commits. The round-4 branch is fix/round4-code of the reference repository (private, as above), off fix/review-rounds-3-4. The RFC revision 5 commits are on this PR's branch.

Commit What it changes Covered by
0a2fb5d Do not flip a GSI ACTIVE after the in-flight drain times out built and unit-tested only
9781c1a Single-item writes count in-flight before their catalog-view read held-write test, fault-hooks build
13460a0 TransactWriteItems counts as an in-flight write built and unit-tested only
314bf7d Reindex reconciler counts first and re-reads key info per document built and unit-tested only
e47f790 Backfill: an item under committing keeps the index CREATING built and unit-tested only
17b9a0c Commit-point script counts resolutions after the freeze bash -n only; NOT RUN
aee5546 Error 17004 at COMMIT WORK is an unknown outcome unit tests only
a58176f Unrecognised COMMIT WORK error is an unknown outcome, no skip marker unit tests only
e51c260 Resource-limit error class (first form; missed the real code) unit tests only
ef38485 Memory-quota error (17016, "exceeded quota") is a resource limit: 503 at a statement unit test with the captured error; 503 observed live once
2423790 TTL index creation takes the create lock and the index budget cost arithmetic unit test; live TTL check
d75f669 TTL index rebuild takes the lock and budget cost arithmetic unit test; rebuild NOT run live
a44e465 Plain-lease loop checks its deadline on every retry path pure-function unit test; branches NOT run
bf94e63 Two asserts: raise is checked before the code for 17010 at COMMIT WORK unit tests only
cf69603 fault-hooks cargo feature, compiled out of release builds unit tests; tests/test_fault_hooks.py on a fault-hooks build
2bb316e, c5c0b72 Ambiguous-COMMIT tests: with a token (success, counter 1) and with none (500, counter 1) passed on a fault-hooks build, single node
91b709d Stale comments corrected none needed
RFC 76bbc7b7, 3f6ff36e, 2258dbe7, bfbd63bc, 24870642, 527f4ca5 RFC revision 5 n/a

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 5 and for the reply point by point. I read it at 527f4ca against main at d9c587d.

Revision 5 resolves the Blocking point: the transactional flag is gone, and every plain write takes the lease. Points 3, 4, 5, 6, 8, 9, 10, 11 and 14 are resolved in the text, and so are most of the smaller items. The inline comments give the corrections that remain. Point 2 is resolved for the CAS-pinned actions, and item 15 covers the rest. Point 7 is answered the second way that round 4 offered: row 4.1 states the bound and the 503. The comment on line 1291 is about what the lease on every table now does to that bound. Points 12 and 13 stay open, as your reply says.

Five inline comments need a change to the design or its tests: lines 594, 611, 705, 1291 (the first of the two) and 1386. The others are smaller corrections.

Two things that don't fit inline:

  • The description puts the commit-point hold under item 13. In the RFC, item 13 is the multi-part RANGE tests only. #1183 gives the key as <table_id>#<pk_enc>|<sk_enc>, but the RFC escapes each component (line 448). #1183 also says that the divergences are recorded in docs/differences-from-dynamodb.md. But row 4.1 says those rows come with the implementation PR, and main's file has no Couchbase entry yet.
  • Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay OPEN until a reviewer can read the reference repository, as line 3 says.

server then runs the fenced second pass: it sleeps the catalog freshness window
(`EXTENDDB_CATALOG_FRESHNESS_MS`, default 2 s, plus 0.5 s), waits up to 30 s for
every write on this server that was already in flight, backfills again, and
flips the index `ACTIVE`. The server's GSI worker repeats the backfill and the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a drain times out (lines 596-597), this pass backfills and flips at 75 s. The text doesn't say that it waits for the writes the drain was still waiting for. Please say that the worker's pass waits for the old generation's count to reach zero before its backfill, as the fenced pass does. Or state the longest time a write can stay in flight, and why 75 s is longer.

per table and per generation: the fenced pass starts a new generation and waits
only for the writes counted before it, so a busy table does not hold it. A write
takes the counter before it reads its catalog view. `TransactWriteItems` (one
guard per table) and the reindex reconciler take it too; the reconciler reads

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 741 says that no ExtendDB writer writes without the lease. But the reindex reconciler's rewrites (lines 593-596 and 989) take only the in-flight counter. Round 3 asked for the item's lease on both background writers, and revision 5 gives it to the backfill only (line 598). Couchbase's transactions page says that a non-transactional update made during a transaction can interfere with it or be overwritten. Please say that the reconciler rewrites each document under the item's plain lease, and what it does when it meets a transact_write or committing lease.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
the index `CREATING` for the worker's pass instead of flipping it. Each
backfilled item is rewritten under the item's `plain` lease, like any plain
write; an item that a committed transaction still holds `committing` is not
backfilled, the fenced pass then leaves the index `CREATING`, and the worker

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A committing lease clears only when the next writer takes it over, or after 24 h (lines 672, 687-688 and 789-790). So on an item that nobody writes again, this retry keeps the index CREATING for up to 24 h. A plain write takes a committing lease over by CAS and rewrites in a query-service transaction (lines 702-706). Please let the backfill do the same, and say what it does when it meets a transact_write, transact_get or plain lease.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
ordinary writers against the create and finds every item in the `ACTIVE` index,
but it holds nothing, so a fence that waited for nothing could pass it. The held
write test, in which a `PutItem` whose key info was resolved before the publish
is parked until after the publish and must then land with the index column,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The held write is released at the publish. The fenced pass then sleeps the freshness window plus 0.5 s before its second backfill (lines 576-579). So the write lands before that backfill, even if the pass never waits for in-flight writes. A fence with no drain passes this test. Please hold the write past the point where a pass with no wait would run its second backfill. While the write is held, check that the index is still CREATING. Line 1376 puts the hold after the catalog-view read, and this line puts it before the publish, so please state one hold point. Please also say what the runs Tess-2 to Tess-5 are.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
at its end; a `committing` lease (a committed transaction not yet visible to
KV reads, or one whose outcome was unknown) is taken over by CAS, and the write
runs as a query-service transaction, which Couchbase orders after the committed
one, holding the lease across it and deleting it after, so the next plain

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 682-683 say that COMMIT WORK can return before every document is unstaged, and the wait at lines 684-688 covers only the CAS-pinned actions of a TransactWriteItems. This escalated write also commits through COMMIT WORK, and so does every single-item write on a stream-enabled table (lines 909-912). Both then delete their plain lease with no wait, and item 15 lists neither path. Couchbase's transactions page calls that commit eventually consistent for KV reads. So a GetItem after an acknowledged write can return the old item (RFC-0003 4.5), and the next plain write can be overwritten (4.4). Please apply the same wait on both paths, or add them to item 15 as OPEN, and correct "as after any commit" on line 786.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

| # | Criterion | How the backend meets it | Evidence |
|---|---|---|---|
| 4.1 | Unconditional writes never fail under contention | A bare unconditional `PutItem` with no `ReturnValues` takes the item's lease (a KV insert), makes one KV write and removes the lease (a read and a CAS remove): there is no CAS on the item and no retry of the write itself, and the last writer wins. A plain write that meets another plain write's lease retries with jittered backoff and answers 503 at the end of a 10 s bound; the lease is held for the length of one KV write, so in practice two racing calls both succeed, and one fails only if the other holds the item for more than 10 s. What a plain write answers when it meets a transaction's lease is under "Transactions". With `ALL_OLD` it is a CAS loop of 64 attempts / 10 s that answers 503 at exhaustion, as MongoDB does; no CAS detail is client-visible (`cas_contended`); the differences-document rows come with the implementation PR | **OPEN** until a reviewer reads the reference repository. Upstream `test_put_item_create_race.py::test_racing_puts_with_all_old_all_succeed`, `::test_racing_puts_on_a_stream_table_all_succeed`, `test_concurrency.py::test_parallel_inserts`; run against the demo stack on 2026-11-25 (upstream tests at the pin `7b828b0`): `test_put_item_create_race.py` 9 passed and `test_concurrency.py::TestAtomicCounter::test_atomic_counter` 1 passed, re-run on the final code (HEAD `7f5ae94` of the round-4 branch, single-node demo stack) `[ref-repo]`. No test drives two plain writers into the 10 s bound. CR-03 `[ref-repo]` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revision 5 puts this lease on every table, so the 10 s bound now applies to every unconditional PutItem. The row says that the lease is held for one KV write. On a stream-enabled table it is held across a query-service transaction (lines 670-671 and 909-912). After a crash, a plain lease that a write left behind blocks its key until it expires (30 s). Writes to that key can answer 503 until then. RFC-0003 4.1 says that two concurrent unconditional PutItem calls must both succeed. Please let plain writes share the lease, so that only a transaction excludes them (round 4's first option). Or state both cases in this row and in the differences rows.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

| # | Criterion | How the backend meets it | Evidence |
|---|---|---|---|
| 4.1 | Unconditional writes never fail under contention | A bare unconditional `PutItem` with no `ReturnValues` takes the item's lease (a KV insert), makes one KV write and removes the lease (a read and a CAS remove): there is no CAS on the item and no retry of the write itself, and the last writer wins. A plain write that meets another plain write's lease retries with jittered backoff and answers 503 at the end of a 10 s bound; the lease is held for the length of one KV write, so in practice two racing calls both succeed, and one fails only if the other holds the item for more than 10 s. What a plain write answers when it meets a transaction's lease is under "Transactions". With `ALL_OLD` it is a CAS loop of 64 attempts / 10 s that answers 503 at exhaustion, as MongoDB does; no CAS detail is client-visible (`cas_contended`); the differences-document rows come with the implementation PR | **OPEN** until a reviewer reads the reference repository. Upstream `test_put_item_create_race.py::test_racing_puts_with_all_old_all_succeed`, `::test_racing_puts_on_a_stream_table_all_succeed`, `test_concurrency.py::test_parallel_inserts`; run against the demo stack on 2026-11-25 (upstream tests at the pin `7b828b0`): `test_put_item_create_race.py` 9 passed and `test_concurrency.py::TestAtomicCounter::test_atomic_counter` 1 passed, re-run on the final code (HEAD `7f5ae94` of the round-4 branch, single-node demo stack) `[ref-repo]`. No test drives two plain writers into the 10 s bound. CR-03 `[ref-repo]` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The row names test_concurrency.py::test_parallel_inserts as evidence, but the run it reports is TestAtomicCounter::test_atomic_counter, which is row 4.4's test. test_parallel_inserts writes a distinct key from each thread, so it doesn't put two writers on one key either. Please name the test that races bare puts on one key, and report its run.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
The items revision 3 listed as open, with their state in the reference
repository (commits on its `main`, dated 2026-11-25 UTC, are marked
`[ref-repo]`; work on the round-4 branch that is not yet pushed is described
without a commit id, and each row says what ran and what did not):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines say that work on the round-4 branch is described without a commit id. But items 1, 4 and 8 and row 4.1 cite bb94b2c, a44e465, d75f669 and 7f5ae94 from it. Line 97 says the branch is not pushed, and your reply says it is a branch of the repository that is not merged. Please say which it is, and either keep the ids with the mark (d75f669 in item 8 has none) or drop them.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
| 10 | CAS exhaustion answers 503; the `docs/differences-from-dynamodb.md` rows | The out-of-tree loops already answered 503 (`cas_contended`); revision 3's text was wrong. The rows come with the implementation PR, with the hot-key observation under Drawbacks |
| 11 | The hashed-key read compares the stored encoded keys; a partition key containing `\|S#` in the separator-collision test | Implemented (`b0c272f` `[ref-repo]`) |
| 12 | The lease cost and the hot-key refusal counts | Not measured with the lease on every table: the one-node figures of revision 4 predate it and are withdrawn. The multi-node YCSB workload A figures (at `durability = majority`) and the refusal counts (plain writes acknowledged, `TransactionConflictException` and 503, with the transaction side split the same way) are a condition of FCP. `scripts/txn-commitpoint-test.py` `[ref-repo]` prints the plain writers' answers, but its transaction side merges 503 into cancellations and a run that includes the freeze is not a steady state, so a run without a freeze and with the split counters is needed. RFC-0003 4.1, 4.3 and 4.4 are reported against those counts when they exist |
| 13 | `tests/test_gsi_multi_range_query.py` on `main` (60 cases at `f49c5f82`) against the per-part columns, with `couchbase` not in `FIRST_RANGE_ONLY_BACKENDS` | **OPEN**, blocked on the pin: the engine at `7b828b0` predates `f49c5f82` (which adds `resolve_multipart_with`) and refuses a multi-condition Query on a one-HASH, several-RANGE GSI before the backend sees it. Done when the pin is at or after `f49c5f82`, the suite passes with 60 passed, 0 skipped and 0 failed on the three-node harness `[ref-repo]`, and the engine revision and the count are recorded here |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/test_gsi_multi_range_query.py collects 64 tests at f49c5f82 and on main today. This item and row 2.8 say 60. Its TestFirstRangeOnlyBackends case skips itself on a backend that serves every RANGE attribute, which is the state this item describes. So the target here and in row 2.8 can't be met as written. Please make it 63 passed, 1 skipped and 0 failed, out of 64.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
| 12 | The lease cost and the hot-key refusal counts | Not measured with the lease on every table: the one-node figures of revision 4 predate it and are withdrawn. The multi-node YCSB workload A figures (at `durability = majority`) and the refusal counts (plain writes acknowledged, `TransactionConflictException` and 503, with the transaction side split the same way) are a condition of FCP. `scripts/txn-commitpoint-test.py` `[ref-repo]` prints the plain writers' answers, but its transaction side merges 503 into cancellations and a run that includes the freeze is not a steady state, so a run without a freeze and with the split counters is needed. RFC-0003 4.1, 4.3 and 4.4 are reported against those counts when they exist |
| 13 | `tests/test_gsi_multi_range_query.py` on `main` (60 cases at `f49c5f82`) against the per-part columns, with `couchbase` not in `FIRST_RANGE_ONLY_BACKENDS` | **OPEN**, blocked on the pin: the engine at `7b828b0` predates `f49c5f82` (which adds `resolve_multipart_with`) and refuses a multi-condition Query on a one-HASH, several-RANGE GSI before the backend sees it. Done when the pin is at or after `f49c5f82`, the suite passes with 60 passed, 0 skipped and 0 failed on the three-node harness `[ref-repo]`, and the engine revision and the count are recorded here |
| 14 | The lint item 6.2 | Done (`b0c272f` `[ref-repo]`) |
| 15 | The visibility wait covers every action of a `TransactWriteItems`, and the unknown-outcome token read sees a committed token | **OPEN**, code changes not yet made. After a commit the backend deletes the `committing` leases only once a KV read shows the committed body, but it waits only for the actions that pin a document by CAS (a conditional or pinned write or delete); an unconditional `Put`, a create, an unconditional `Delete` and a `ConditionCheck` are not waited on. After an unknown-outcome commit the token is read by KV, which can miss a token that is committed and not yet unstaged; the request then answers 500 although it committed, and a retry with the same token resolves it |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The status line, the acceptance intro and row 6.3 call this item "Gaps A and B", but nothing says which gap is which. Please letter the two gaps here, and add the two commit paths from the comment on line 705 to the visibility gap. Please also mark OPEN, on this item, the acceptance rows that each gap leaves unmet. The visibility gap reaches rows 4.4 and 4.5. Please say what closes each gap.

suravarjjala and others added 2 commits November 25, 2026 23:43
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@suravarjjala

Copy link
Copy Markdown
Author

Thank you for round 5. You resolved the Blocking point (the flag is gone and every plain write takes the lease) and points 3, 4, 5, 6, 8, 9, 10, 11 and 14, and you said points 12 and 13 and the six reference-repository rows (2.4, 3.5, 4.1, 4.3, 5.2, 6.2) stay open. They do. Revision 6 is on the branch (RFC head eeb92a4f). Each answer below is in your inline order, gives your line number from revision 5 and the line numbers in revision 6, and ends in one verdict: FIXED-TEXT, FIXED-CODE, ANSWERED or OPEN. A claim that rests on the private reference repository carries [ref-repo], as the RFC's front matter defines it (lines 23-34). The code changes are on the round-5 branch of that repository; every commit id is in the one table at the end.

What changed beyond your comments (so you read it, not find it):

  • A regression in my round-5 change for your line 762, found and fixed before this reply. The one deadline I added for TransactGetItems (3ffb3df) made a read that met a committing lease cancel after 5 s every time. The committing detection and the pass loop shared the one deadline: a key was added to the committing set only at the deadline, and the loop then refused to start the second pass because the deadline had passed. So the "read it inside a throwaway transaction" path I described never ran, and after an unknown COMMIT WORK (which leaves committing leases for up to 24 h) a TransactGetItems on those items would have been cancelled with TransactionConflict until a writer took the lease over. A review of the revision-6 package found it before I posted. The fix detects a committing key at the deadline minus the 3 s pass allowance, that is 2 s into the 5 s (5ef33e9 [ref-repo]), so the second pass still fits inside the deadline. The regression test (28e8299) makes an ambiguous COMMIT with no token, which leaves a committing lease, and then requires TransactGetItems to return the committed value. On a fault-hooks build on the single-node demo stack it passed in 2.03 s (the whole test, against a 4 s bound), one run. With the fix reverted it failed in both runs, after about 5.3 s (5.29 s and 5.22 s), with TransactionConflict (Tess-8 [ref-repo]). The release suites ran 12 of 12 after the fix (test_txn_lease.py 8, test_gsi_fence.py 1, test_reindex_reconcile.py 3; single node [ref-repo]). cargo test --lib gives 274 passed (278 with the fault-hooks feature; the Testing table at RFC line 1384 says the same). Two limits: if the first pass itself takes about 3 s, the check before the second pass can still cancel the read, and the 3 s is an estimate I did not measure.
  • After an unknown outcome of COMMIT WORK on a TransactWriteItems with a token, the backend now reads the token with a transactional read (txn_peek) instead of a KV read. This is the unknown-outcome arm of Gap B (see your line 1386). The decision is unit-tested; a committed token that is still staged, and a failed txn_peek, are not tested end to end (lines 885-895).
  • The lease-holding section of TransactGetItems now runs detached, so a client that drops the request still releases its leases, and a lease read that failed no longer leaks the leases already taken. Every return path of that section releases them; a panic inside it skips the release and the leases lapse at their 10 s expiry. Neither is unit-tested or run (lines 856-860).
  • The reindex reconciler and the backfill treat a transact_write lease as skip-and-retry (lines 631-649). In the reconciler this is a change of reporting: before e7f94b0 that lease came back from the lease call as an error, which the per-item handler logged as "leaving queued" (reindex.rs at e7f94b0^, line 455), so the item stayed queued either way; it is now an explicit skip with its own log line. The real change is in the backfill: failing to lease an item used to fail the whole pass, and it now skips the item and keeps the index CREATING.
  • The commit-point hold ran twice. It did not pass (see line 889).

Inline comments

  1. Line 579 (now 609-616). FIXED-CODE, FIXED-TEXT. The worker's pass waits for the old generation's in-flight count to reach zero before its backfill, with the same helper and the same 30 s cap as the fenced pass. If the wait times out it warns, leaves the mark and the index CREATING, backfills nothing, and retries at the next interval (38eeab5 [ref-repo]). The text no longer says that 75 s is what makes this safe, and claims no longest in-flight time. Built, not unit-tested: no test covers the wait, because the helper needs a running engine. Row 2.4 (line 1428) now says the worker waits.
  2. Line 594 (now 631-649 and the row at line 828). FIXED-CODE, FIXED-TEXT. Reading the code, the reconciler already rewrote under the item's plain lease (since bb94b2c, when the lease went onto every table); revision 5's text did not say so, and what was missing was the rule for the other lease kinds, which is now in the text: transact_write skips the item at once and leaves it queued, transact_get and plain wait up to 10 s and then skip, and committing is taken over by CAS and rewritten in a query-service transaction (e7f94b0, 84c30aa [ref-repo]). So the claim "no ExtendDB writer writes without the lease" (the row at line 828) holds, and says that the Couchbase side is the exception. Built; no unit test covers these lease paths.
  3. Line 600 (now 631-649). FIXED-CODE, FIXED-TEXT. The backfill does the same as the reconciler: a committing lease is taken over by CAS and the item is rewritten in a transaction with one replace-expect carrying the CAS it read (the escalated write's path, replace_at_cas); a transact_write lease skips the item and the index stays CREATING until the worker's next pass finds it free; transact_get and plain wait up to 10 s. The 24 h claim for the backfill is gone. The takeover was NOT exercised (the held-unstaging harness it needs is not built) and its transaction path has no unit test; the round-5 tree's regression runs (test_txn_lease.py 8 passed, test_gsi_fence.py 1, test_reindex_reconcile.py 3, single-node [ref-repo]) do not target it. One defect I found in it, which is in the text as OPEN: the callers of replace_at_cas delete the lease on every outcome, a failed or unknown commit included, so a takeover turns a committing lease into a plain one and deletes it, which breaks the rule that an unknown commit keeps its committing leases (engine.rs backfill_item and reindex.rs [ref-repo]). It is the third path of Gap A (see 5).
  4. Line 611 (now 659-687, item 5 at line 1535). FIXED-TEXT, FIXED-CODE. One hold point, after the catalog-view read (the text and item 5 now agree). The test holds the write for the catalog freshness window (default 2000 ms) plus 0.5 s plus 3 s, which is past where a pass with no drain wait would run its second backfill; it asserts the index is CREATING while the write is held, then releases it and requires the write to land with the index column, the index to go ACTIVE and a query on it to return the item (7cc900a [ref-repo]). Tess-2 to Tess-6 are runs of tests/test_fault_hooks.py on a fault-hooks build on the single-node demo stack, one run each; the held-write test passed on all five, on the earlier form in Tess-2 to Tess-5 and on the rewritten form in Tess-6 [ref-repo]. Negative control (Tess-7): with both drain waits made to return at once, the rewritten test failed at "index left CREATING while a write was held: ACTIVE" in 2 of 3 runs, failed once with a client read timeout I have not explained, and no patched run passed; the unpatched build passed it once. That shows a fence with no drain fails this test. It does not show that a short or partial drain, or a fault in one of the two passes (both were patched together), is caught.
  5. Line 705 (now 778-784; item 15 at line 1545). OPEN. You are right: the escalated plain write and every single-item write on a stream-enabled table commit through COMMIT WORK and delete their plain lease when it returns, with no wait for the commit to be visible to KV reads. I did not add the wait. Both paths are now in item 15 as Gap A, OPEN, together with a third that I found while answering your line 600: a background rewrite (the GSI backfill or the reindex reconciler) that took a committing lease over through replace_at_cas, which also deletes its lease on every outcome, a failed or unknown one included. The text no longer says "as after any commit": it says the next plain write is an ordinary one only once that commit is visible (lines 783-784; the same correction at lines 807-812). I do not know that the window exists on Couchbase 8.0.4 (see line 1386), and I have not built the wait for it.
  6. Line 717 (now 791-802). FIXED-TEXT. "The durability level and the lease length are what bound it" is gone. The paragraph now says that nothing bounds how late a stalled plain write lands: the lease length bounds how long contending writers wait and how long a crashed holder blocks its key, and the durability level makes each write durable but does not bound when a stalled write lands.
  7. Line 741 (now 828 and the Drawbacks entry at 1569-1577). FIXED-TEXT. Both places now say that a write from the Couchbase side (SQL++, Eventing, Mobile, XDCR) takes no lease and, made while a transaction is in progress, can interfere with the transaction's updates or be overwritten by its commit, citing Couchbase's transactions page. The Drawbacks entry adds that an operator who writes from both sides to the same items should know such a write can be lost.
  8. Line 762 (now 830-871; item 4 at line 1534). FIXED-CODE, FIXED-TEXT; see the regression above. "The same 5 s" is gone. There is one deadline, taken before the first lease, for acquiring the leases and for the agreement passes together, checked before each pass (it used to start a fresh 5 s clock). It is 5 s plus an allowance of 3 s for one pass already running, so a read ends within 8 s of its first lease, 2 s inside the 10 s lease, which is not renewed; the 3 s is an estimate I did not measure, and on a very slow cluster a pass over 100 keys could outlast it. A key whose lease is committing is waited on for 2 s and then read inside a throwaway transaction (5ef33e9). Every return path of the section that holds the leases deletes them, including a cancelled or failed read, and the section runs detached (3ffb3df [ref-repo]); a panic inside it skips the release and the leases lapse at 10 s. A compile-time check and unit tests cover the arithmetic of the deadline and of the cut; the release on cancel and the panic path are built only. There is no check after the read that the leases are still held, and a single KV operation has no deadline of its own, so the bound is about 10 s, not strict.
  9. Line 889 (now 1009-1053, row 5.2 at line 1459). OPEN, and not a pass. I did not meet your wording, and I cannot on this version as probed. Your gate needs a state in which a KV get misses a filler record while a transactional read by key returns it. Two probes on Couchbase 8.0.4, single node (Pip, Quin [ref-repo]), found no transaction xattr on a document mutated in an open query transaction ($XTOC empty, txn and _txn absent), an old body from both a KV read and an out-of-transaction SELECT while the transaction was open, and the commit visible from the first sample 1 to 4 ms after COMMIT WORK returned. So that state was never observed on the version tested, and the RFC (line 1048) says exactly that and no more. I did not test a held or crashed unstaging window, and the RFC keeps the item OPEN; I do not claim the window cannot exist. The hold ran twice on the round-4 branch, three query nodes (image built from the commit by timestamps, not proven) [ref-repo] (Cora): the driver's 10 safety invariants held both times, and the gate failed in all six attempts: 0 stream records resolved by a transactional read after the freeze, txn_peek count 0 (neither run's backend log holds that line at all), although each freeze landed on the node named in the ops=41 commit line about 0.5 s after the send. The RFC says the freeze was meant to land between the commit point and unstaging, not that it did (lines 1011-1013). So the run shows the invariants under a freeze, not a record committed and unstaged during it. A harness that lands the freeze between the commit point and unstaging is still owed.
  10. Line 913 and row 4.4, line 1294 (now 1055-1072 and row 4.4 at line 1451). FIXED-TEXT. Both now say what you describe: the second single-item write waits on the first's lease, retrying inside the 10 s bound, and writes after the lease is released, so both succeed (test_racing_puts_on_a_stream_table_all_succeed expects that; see 14); at the end of the bound it answers 503. The paths that can still conflict at the document are named: a writer that takes no lease (the Couchbase side), a holder stalled past its lease, and a second write that starts after the first's COMMIT WORK returned and before its commit is visible (Gap A, OPEN). Between ExtendDB's own lease-holding writers no other is known.
  11. Line 1210 (now 30-34, 132 and 1362). FIXED-TEXT. The multi-node YCSB figures come from Couchbase's performance CI (runs of 2026-10-22 to 2026-11-01), not from the reference repository. The front matter now names that CI as a source in its own sentence (lines 30-34 of the front matter, next to the [ref-repo] definition at lines 23-34, not in the status line at lines 3-11), and each of those figures carries [perf-ci], not [ref-repo]. Until a reviewer is given access to those runs they are claims only Couchbase can show. The PR description and [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 are corrected to say the same.
  12. Line 1275 (now row 2.8 at line 1432; item 13 at line 1543). FIXED-TEXT. Both name the two files that define FIRST_RANGE_ONLY_BACKENDS on main: tests/test_gsi_multi_range_query.py and tests/test_fgac_leading_keys.py. The [ref-repo] mark is off the entries that change main's files.
  13. Line 1291, the 10 s bound (now row 4.1 at line 1448). FIXED-TEXT. Row 4.1 states both cases and says the row differs from RFC-0003 4.1. (1) Between plain writes on a table without a stream: the second waits on the first's lease and answers 503 at 10 s; the lease is held for one KV write, so in practice two racing calls both succeed; a plain write that crashed leaves its lease until it expires (30 s), and writes to that key can answer 503 until then. (2) On a stream-enabled table the lease spans a query-service transaction (up to txtimeout plus 20 s): the same 10 s bound and 503 apply to a writer that waits on it, and a crashed holder blocks its key for that long. Both go in the docs/differences-from-dynamodb.md rows that the implementation PR adds (main has no Couchbase entry yet; item 10 at line 1540 says so). Sharing the lease between plain writers is the alternative, a follow-up if you prefer it. No test drives two plain writers into the 10 s bound or a crashed lease.
  14. Line 1291, the test name (now row 4.1 at line 1448 and row 4.4 at line 1451). FIXED-TEXT. test_parallel_inserts is gone from row 4.1: its threads write distinct keys. Row 4.1 now names the tests in upstream test_put_item_create_race.py that race bare puts on one key (8 writers, 15 rounds, every put must succeed): test_racing_puts_on_a_gsi_table_leave_only_the_final_entry, test_racing_puts_on_an_lsi_table_leave_only_the_final_entry and test_racing_puts_on_a_stream_table_all_succeed, plus test_racing_puts_with_all_old_all_succeed for the ALL_OLD loop. The recorded run is the file at 9 passed at the pin 7b828b0, single-node demo stack, durability none [ref-repo] (Tess-2, 5 and 6 each ran it). TestAtomicCounter::test_atomic_counter moved to row 4.4, where it belongs.
  15. Line 1368 (now 121-124, 1522-1527 and items 1, 5 and 8 at lines 1531, 1535 and 1538). FIXED-TEXT. The round-4 branch is a branch of the private reference repository and is not merged; the RFC no longer says it is not pushed. The ids stay, each with [ref-repo]: bb94b2c, a44e465 and 7f5ae94 in item 1, and d75f669 in item 8, which now has the mark too.
  16. Line 1384 and row 2.8 (now 1543 and 1432). FIXED-TEXT. The target is now 63 passed, 1 skipped, 0 failed, out of 64. I took the 64 from your count; I have not collected the file myself. The skip is its TestFirstRangeOnlyBackends case, which skips itself on a backend that serves every RANGE attribute. The test is NOT RUN, blocked on the pin.
  17. Line 1386 (now item 15, line 1545). FIXED-TEXT; OPEN. The two gaps are lettered. Gap A (visibility): after a commit the backend deletes the committing leases once a KV read shows the committed body, but it waits only for CAS-pinned actions; an unconditional Put, a create, an unconditional Delete and a ConditionCheck are not waited on, and three commit paths do not wait at all: the escalated plain write, every single-item write on a stream-enabled table, and the background takeover (replace_at_cas). All three delete their lease when COMMIT WORK returns, whatever the outcome, an unknown one included (verified in engine.rs backfill_item and in reindex.rs; no test touches it). Gap A leaves rows 4.4 (line 1451) and 4.5 (line 1452) OPEN in part, and it closes with a wait for those actions and paths, the takeover keeping its committing lease on a failed or unknown commit, and a harness that lands a freeze between the commit point and unstaging. Gap B (token read): fixed for the unknown-outcome arm (3231463 [ref-repo]: a token present with the request's fingerprint means committed; anything else, no token, another fingerprint or a failed read, answers 500 with the leases kept, because a token absent now may belong to a commit still in progress) and OPEN for the retry path, where three token reads remain outside a transaction. The pre-check and the Exists arm are SQL++ USE KEYS reads, not KV reads, and the poll while a foreign lease is held under the same token is the only true KV read (every 50 ms). Each can miss a token that is committed and not yet unstaged. From the code, not a run: a miss sends the request on to stage again, and its in-transaction token create meets Exists, which retries until its 1.5 s deadline and answers a retryable TransactionConflict instead of a replay. The writes are not applied twice only if a query transaction's insert sees a committed, not yet unstaged, token as existing; that is unverified. Gap B leaves row 3.3 (line 1440, now marked OPEN in part) OPEN (that mapping is mine), and closes when all three reads use a transactional read.

The two things you raised in your summary

  • Commit-point hold under item 13. FIXED-TEXT (PR description). You are right: item 13 is the multi-part RANGE tests only. I used the round-4 review's point number for the hold, which is also 13. In the RFC the hold has no item of its own, and the status line says so (lines 9-11): its design and both runs are in "DynamoDB Streams" (lines 1009-1053), it is OPEN in row 5.2 (line 1459), and the engineering table reports its run under item 1 (line 1531). Your "item 13" complaint was about the PR description, and the new PR description says the same.
  • The key in [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 and the differences document. FIXED-TEXT (issue body). The RFC escapes each component: "Key encoding" (line 424, "The document key" at line 473) gives <table_id>#<pk_esc>|<sk_esc> with \ doubled and then | preceded by \, and row 1.1 (line 1416) says the same. [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 now says so. [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 also said the divergences are recorded in docs/differences-from-dynamodb.md; the rows come with the implementation PR and main has no Couchbase entry yet, so it now says that.

Still open (the same list as lines 3-11 and row 6.3 of the RFC):

  • Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2, until a reviewer has read the reference repository.
  • Item 1: the test that holds a PutItem after its lease insert is not written.
  • Item 2: AT_TIMESTAMP, no code at the pin.
  • Item 5: the reconciler held-write test is a skipped stub; the worker's drain wait, the in-flight counter, the transaction guard, the reconciler change and the background committing takeover are built, not unit-tested, and the takeover was not exercised.
  • Item 8: whether the index count is of definitions or of instances with replicas.
  • Item 13: the multi-part RANGE tests, blocked on the pin.
  • Item 15: Gap A (no code; three commit paths) and Gap B (the retry path's three token reads).
  • The commit-point hold (row 5.2): the gate failed both runs; a harness that lands a freeze between the commit point and unstaging is owed.
  • TransactGetItems: the 3 s pass allowance is an estimate; the release on cancel and the panic path are not run.
  • Item 12: the lease's cost and the split refusal counts on the performance cluster, a condition of FCP; not measured.

Commits. All ids are in the private reference repository. The round-4 branch is fix/round4-code (pushed, not merged). The round-5 commits below are on that repository's fix/round5 branch and on this PR's branch for the RFC; fix/round5 and the PR branch are to be pushed before this is posted. The round-5 branch contains 3231463.

Commit What it changes Covered by
0a2fb5d Do not flip a GSI ACTIVE after the in-flight drain times out built and unit-tested only
9781c1a Single-item writes count in-flight before their catalog-view read held-write test, fault-hooks build
13460a0 TransactWriteItems counts as an in-flight write built and unit-tested only
314bf7d Reindex reconciler counts first and re-reads key info per document built and unit-tested only
e47f790 Backfill: an item under committing keeps the index CREATING (its skip is superseded by 84c30aa) built and unit-tested only
17b9a0c Commit-point script counts resolutions after the freeze the two runs above; the gate failed both
aee5546 Error 17004 at COMMIT WORK is an unknown outcome unit tests only
a58176f Unrecognised COMMIT WORK error is an unknown outcome, no skip marker unit tests only
e51c260 Resource-limit error class (first form; missed the real code) unit tests only
ef38485 Memory-quota error (17016, "exceeded quota") is a resource limit: 503 at a statement unit test with the captured error; 503 observed live once
2423790 TTL index creation takes the create lock and the index budget cost arithmetic unit test; live TTL check
d75f669 TTL index rebuild takes the lock and budget cost arithmetic unit test; rebuild NOT run live
a44e465 Plain-lease loop checks its deadline on every retry path pure-function unit test; branches NOT run
bb94b2c The lease on every table, no transactional flag (this is also where the reconciler began to rewrite under the item's lease) tests/test_txn_lease.py, 8 passed
bf94e63 Two asserts: raise is checked before the code for 17010 at COMMIT WORK unit tests only
cf69603 fault-hooks cargo feature, compiled out of release builds unit tests; tests/test_fault_hooks.py on a fault-hooks build
2bb316e, c5c0b72 Ambiguous-COMMIT tests: with a token (success, counter 1) and with none (500, counter 1) passed on a fault-hooks build, single node
91b709d Stale comments corrected none needed
3231463 Unknown-outcome arm of TransactWriteItems reads the token with txn_peek (Gap B, part) decision unit test; staged-token case and failed txn_peek not tested end to end
e7f94b0 Background rewrites skip an item they cannot lease, and log it; in the backfill a failed lease no longer fails the pass built; no test of the lease paths
84c30aa Background rewrites take a committing lease over and rewrite in a transaction built; NOT exercised; no unit test of the transaction path
38eeab5 The worker's pass waits for the old generation to drain before its backfill built; no unit test; negative control removes both drain waits together
3ffb3df TransactGetItems: one deadline inside the lease; leases always released on return arithmetic: compile-time check and unit tests; release NOT tested; this commit carried the regression fixed by 5ef33e9
5ef33e9 TransactGetItems: a committing lease is detected at the deadline minus the 3 s pass allowance (fixes the regression) unit tests of the cut; 28e8299 passed once (2.03 s); with the fix reverted it failed twice (about 5.3 s)
28e8299 Regression test: ambiguous COMMIT, no token, then TransactGetItems returns the value fault-hooks build, single node, one run passed
7cc900a Held-write test: hold past a no-drain second backfill, assert CREATING while held Tess-6 and Tess-8 passed once each; negative control failed 2 of 3 patched runs at the assertion
RFC 76bbc7b7, 3f6ff36e, 2258dbe7, bfbd63bc, 24870642, 527f4ca5 RFC revision 5 n/a
RFC 73559f2b, a112c642, fbc5f514, bbdb773c, c6b30dac, e25f2d2b, eeb92a4f RFC revision 6 n/a

…-6 code, Gap A/B stay open)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, revision 7 is now up (52cf768), and with it I correct parts of revisions 5 and 6 and of my last reply.

What was wrong. Two statements were wrong, my answers to your lines 594 and 600 repeated one of them, and my answer to your line 705 was incomplete.

  • The takeover rule. The RFC ("Plain writes and transactions on one document" and the outcomes table), reply comment 7196281882 items 2 and 3, and the PR description ("committing is taken over by CAS and rewritten in a query-service transaction") said that any writer that meets a committing lease takes it over at once. In the reference code that let a second TransactWriteItems take over the leases of a first whose COMMIT WORK had not yet reached its commit point. On three nodes (bucket with one replica, durability = majority, Couchbase Server 8.0.0), upstream tests/test_transact_absent_item_isolation.py failed 4 of its 5 tests on each of 5 runs, and a two-transaction driver saw both transactions commit in 34 to 40 of 40 rounds (0 on a single node). The likely cause is that rule: a read by the second transaction could still see the state before the first one's commit. We found no defect in Couchbase; the defect was the backend's lease rule.
  • destroy. The RFC said destroy drops only what the catalog records. That was the intended behaviour, not the code. The code behind revision 6 refused only when a catalog scope was present without its version document and was not half-built. Otherwise it dropped every per-account scope the catalog recorded, whole, whatever it held, and then dropped the data scope whole, whatever it held, foreign collections included, on every destroy: with a correctly initialised catalog, with a half-built one, and with no catalog scope at all.
  • My answer to your line 705 (item 5) left the visibility wait for later. It is now built (R5-5 below).

The code behind revision 6 also had three defects that revision 6 did not state, now fixed: a restore target was ACTIVE before its copy started, and the restore found it by name afterwards; the stream reader could stall forever after more than 64 consecutive empty aged sequence numbers, so "resolves them over several polls" was not true of that code; and the descending twins were made for any idx_* index in the bucket, other applications' included, at every start. Revision 7's "Corrections in revision 7" lists all five.

The reference implementation is pre-release and private. I withdraw the statements above; revision 7 replaces them.

Each of your round-5 points, after revision 7. The verdicts are FIXED-TEXT, FIXED-CODE, ANSWERED or OPEN. Sections are revision 7's. Code is in bf67ee2 [ref-repo]. Most runs below were made on the fix branch one or more commits before the final code (each row says so where it matters). The final code is fix-branch commit 3988255, whose backend and tests are the same as the pushed commit bf67ee2; the last changes before it only make UpdateTable's own backfill skip a pre-commit_by committing item at once and rewrite that test. On the final code the unit tests (341) and the rewritten backfill test (3 of 3) ran.

Point Change in revision 7 Evidence Verdict
R5-1, worker drain (line 579) Unchanged from revision 6. The worker also clears its mark only when the drain, the backfill and the flip all succeeded. The drain wait is built but not unit-tested. The mark decision has a unit test. FIXED-CODE (as in rev 6)
R5-2, reconciler leases (594) A transact_write lease: skip. A plain or transact_get lease: wait 10 s, then skip. A committing lease before its commit_by: wait 10 s, then skip. A committed lease, or a committing lease at or after commit_by: take it over by CAS. See "The takeover rule" in "Transactions". The takeover rule and commit_by arithmetic are unit-tested. Only the backfill's takeover has a fault-hooks test; the reconciler's is covered by the rule's unit tests only. FIXED-CODE, FIXED-TEXT (corrects rev 6)
R5-3, backfill takeover (600) The backfill follows the same rule. While an item's lease stays committing, the index stays CREATING until a pass at or after its commit_by. UpdateTable's own first backfill skips such an item at once instead of waiting 10 s. A rewrite that took a lease over keeps or releases it according to the commit outcome. In probes on three nodes the index went ACTIVE about 100 to 105 s after UpdateTable returned at the default txtimeout. At a 1 s txtimeout the rewritten test passed 3 of 3 on the final code (single node), ACTIVE 21.1 to 21.2 s after the mark; UpdateTable took 10.5 to 11.6 s, all of it index build, with no lease wait. In 22 runs the index never went ACTIVE before commit_by. Measurements, not a guarantee. If the item never settles under a committing lease (an unknown outcome), every pass puts the lease back and skips, and the index stays CREATING until the lease's 24 h expiry. Under a committed lease (commit point known passed, unstaging stuck) that holds only for 30 s: the lease then lapses, and the next pass clears it with no settle and rewrites the item by KV, which cleanup can overwrite if the unstaging is still pending (Gap A, below). FIXED-CODE, FIXED-TEXT; the stuck-unstaging cases are OPEN (items 5 and 15)
R5-4, held-write test (611) No change. tests/test_fault_hooks.py, run twice in full: 10 passed, 3 skipped. ANSWERED
R5-5, two commit paths (705) The escalated plain write and the single-item write on a stream table mark their lease committing before COMMIT WORK. They release it only if the outcome is definitely "not committed" or a KV read shows the commit. Unit test of the outcome-to-lease table, plus fault-hooks tests on a single node. FIXED-CODE; the failure paths stay OPEN (Gap A below)
R5-6, durability bound (717) No change. The lease of a transactional single-item write is now renewed while it runs. Built. FIXED-TEXT (as in rev 6)
R5-7, Couchbase-side write (741) No change. - FIXED-TEXT (as in rev 6)
R5-8, TransactGetItems deadline (762) The leases are now renewed during the passes. Each pass is bounded at 3 s, and every lease is checked after the last pass. Revision 6 said the leases were not renewed. A fault-hooks torn-pair test passed. The 3 s allowance is still an estimate. FIXED-CODE, FIXED-TEXT
R5-9, commit-point gate (889) No harness lands the freeze where your gate needs it. A new probe on three nodes saw a partial state only during unstaging, before the writer's call returned, and never after it returned (0 of 40). It took no transactional read at that moment. "DynamoDB Streams", item 15. OPEN
R5-10, two single-item writes (913, row 4.4) The path "a second write after the first's COMMIT WORK, before it is visible" is closed, because the first keeps its lease until the commit is visible. The backend takes a successful COMMIT WORK to answer only after every document is unstaged (an unstaging failure is a post-commit failure, 17018). That rests on reading the source of the transaction library the query service uses, and on the assumption that the query service answers only after that library's commit callback; it was not verified at the query service itself and is not taken from Couchbase documentation. On that basis no other path between ExtendDB's own writers is known after a clean commit. After a post-commit failure or a timed-out wait, a writer within the committed lease's 30 s takes it over and writes through a query transaction that Couchbase orders after the committed one; that ordering is not tested. After those 30 s the lease has lapsed: the next plain write clears it with no settle and, on a table without a stream, writes by KV, so if the unstaging is still pending then (a node failure after the commit point), cleanup can overwrite that acknowledged write. As R5-5; a single-node probe (durability = none) of 800 rounds of ConditionCheck then PutItem on one item, plus a concurrent writer, lost no write; 2,400 rounds of the same on three nodes (durability = majority, plain and stream tables) lost none either. Neither can reach the failure paths. A three-node probe with a fault hook confirmed that the committed lease lapses after 30 s and that a plain write then goes by KV with no wait; it could not produce a still-staged document, so the lost write itself has not been reproduced. FIXED-CODE for a clean commit, on the assumption above; the failure paths, the lapsed lease included, are OPEN (Gap A)
R5-11, [perf-ci] (1210) No change. - FIXED-TEXT (as in rev 6)
R5-12, FIRST_RANGE_ONLY_BACKENDS (1275) No change. - FIXED-TEXT (as in rev 6)
R5-13, row 4.1 (1291) Both cases as in revision 6. Added: a plain write that waits out its 10 s bound behind a committing lease before commit_by answers TransactionConflictException, so after a COMMIT WORK with an unknown outcome its keys are unavailable for up to commit_by (50 s by default). The lease cost is now measured (below). Unit tests of the rule. FIXED-TEXT
R5-14, test name (1291) No change. test_put_item_create_race.py is in the full pinned suite: 1,214 passed, 6 failed (the six baseline failures only), 16 skipped, 1 xfail. Single node, durability = none. FIXED-TEXT (as in rev 6); not yet run on three nodes
R5-15, branch ids (1368) The revision-7 code is cited as one commit, bf67ee2 [ref-repo]. - FIXED-TEXT
R5-16, 63/1/0 of 64 (1384) No change. Still blocked on the pin. Not run. OPEN (item 13)
R5-17, Gap A / Gap B (1386) Gap A: the commit paths are fixed in code, and the failure paths stay OPEN (below). Gap B: unchanged. The three token reads on the retry path are still outside a transaction. Item 15. FIXED-CODE in part; OPEN
Summary: hold under item 13; key form in #1183; differences document Fixed in the revision-6 PR and issue bodies. - FIXED-TEXT
Write skew (above) The takeover rule as under R5-2. A lease conflict's cancellation reasons name only the contended item (where no contended item is known, every action is marked). On three nodes, both transactions committed in 0 of 240 rounds on a plain table and 0 of 240 on a stream table. The upstream test passed 10 of 10 runs; the upstream test_transact*.py files passed 63 of 63. The fix is time-based: it rests on two assumptions (below), and no run has held a COMMIT WORK past its commit_by. FIXED-CODE under A1 and A2; a commit delayed past commit_by is OPEN
destroy (above) destroy refuses without a catalog and its version document, and has no --force. It drops recorded table collections and the backend's own fixed collections (one list shared with init), an account scope whole only if every collection in it is recorded, and data only when nothing foreign is left in it. It drops the catalog scope last and whole, whatever else is in it: its version document is taken as proof of ownership. Unit tests of the decision. tests/test_destroy_lifecycle.py passed 3 of 3 on throwaway buckets. On an earlier commit of the fix branch, a bucket with no catalog and a foreign collection in its data scope was refused, and the collection was kept. FIXED-CODE, FIXED-TEXT

Measured, not yet proven

  • tests/test_gsi_fence.py failed 3 times in about 83 runs on the fix branch, each time while a heavy job loaded the same machine. 50 runs at four commits under lighter load passed, and 20 runs at an older commit under the same heavy load passed. No fence race was observed. In the one failure examined, a request_plus scan missed 243 of 100,243 items whose documents already carried the index column, and a scan minutes later returned all 100,243. That contradicts what the RFC says request_plus gives a scan. The cause is OPEN (indexer visibility lag, or the consistency applied on the query path); the failure coincided with heavy load, which is not shown to be its cause. The earlier failure (33,727 missing) is unexplained. I do not claim the fence is race-free.
  • The lease cost was measured on one three-node harness (durability = majority). It adds about 1 ms to the median of sequential writes. With 8 threads the median run gave about 26% less throughput (594 against 803 operations per second) and the mean of three runs about 12% less; the spread between runs of one build is as large as the difference. The performance-cluster YCSB run with the lease on every table has not been made.
  • An earlier form of the visibility wait compared bodies exactly and waited the full 15 s on about 5 to 15% of commits on three nodes; it now compares by value, and the 15 s wait has not recurred (839 waits, median 0 ms, maximum 4 ms). The likely cause, a computed timestamp in the token document, was not directly observed.

Still open

  • Gap A, the failure paths. After a commit reported as a post-commit failure (success is answered at once, with no visibility wait) or a visibility wait that reached its 15 s bound, a GetItem or Query, which does not check the lease, can see the earlier image: the client sees a stale read after a success. The next writer of such an item within the committed lease's 30 s writes through a query transaction ordered after the committed one, which is not tested. After those 30 s the lease lapses and is cleared with no settle; if the unstaging is still pending then (it needs a node failure after the commit point), the next plain write on a table without a stream, or a background rewrite, is a KV write that cleanup can overwrite, so an acknowledged write could be lost. No run has produced that state; a three-node probe of it is still to be run. An insert still staged then can be missed by a GSI backfill until the worker's next pass, about 75 to 105 s later (from reading the code).
  • Gap B, unchanged: on the retry path a missed token gives the client a retryable TransactionConflict instead of a replay.
  • commit_by rests on two assumptions, stated in the RFC and not checked against Couchbase's documentation: (A1) the query service does not pass a commit point later than txtimeout after BEGIN WORK plus 15 s; (A2) the ExtendDB server's clock and the query node's timing of txtimeout differ by less than 5 s.
  • The commit-point gate (R5-9); rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 until the reference repository is readable; items 1, 2, 5 (including the missed scan and the stuck-unstaging cases), 8 and 13.
  • The full upstream suite has run only on a single node at durability = none, where the write skew did not show. On three nodes only the transaction files, the write-skew test and the skew driver ran.

Where the code is. All of this is one commit, bf67ee2, pushed to a private branch of the reference repository and not merged. "Runs behind revision 7" under "Testing" lists what was run, on which commit, and what was not run live.

…, not 8.0.4)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revisions 6 and 7, and for the two replies. I read the RFC at 3ed5490 against main at 5489d29.

Revision 7 resolves most of round 5. That covers the comments on lines 579, 594, 600, 611, 705, 717, 741, 762 and 913. It also covers lines 1210, 1275, 1368 and 1384, both comments on line 1291, and the three items in the round 5 summary. The inline comments give what is left on some of them. The comments on lines 889 and 1386 stay open, as your replies say. If A1 and A2 hold, the corrected takeover rule closes the write skew that your second reply reports.

Five inline comments need a change to the design, its tests or the access route: lines 28, 909, 965, 1343 and 1850. The others are smaller corrections.

One point doesn't fit inline. #1183 lists two behaviours as divergences: a table being restored is hidden from the data plane, and DeleteTable on it answers ResourceInUseException. AWS's DeleteTable reference gives ResourceInUseException for a table in CREATING, and ResourceNotFoundException for a resource that is not ACTIVE. So both match the service. Please drop them from the list, or say what differs.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
resolved as committed), and a `committed` lease lapses 30 s after it is
written, which is 30 s after `COMMIT WORK` answered on the post-commit
arm and 45 s after it on the timed-out-wait arm. Once it has lapsed, the
next plain write or background rewrite clears it with no settle and takes a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A committed lease lapses 30 s after it is written. Couchbase's SDK docs say that the cleanup finishes a commit that did not finish unstaging "usually within a minute" (error handling, cleanup). A post-commit failure writes committed, and it is the case that leaves the unstaging to that cleanup. So a KV write after the lapse can be overwritten, which RFC-0003 4.4 rules out. A settle first does not help a ConditionCheck item, because its restaged image is identical. Please have any writer that clears a committed or committing lease, live or lapsed, write through a query-service transaction.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
`committed`. On a post-commit failure the leases are rewritten `committed`
and success is answered at once, with no visibility wait (Gap A, engineering item 15). A
`ConditionCheck` restages its identical image, so no body comparison can
show it unstaged; on a successful commit it is unstaged before the leases

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a successful COMMIT WORK, this deletes a ConditionCheck item's lease with no check, because no body comparison can show it unstaged. Line 947 says that the premise, COMMIT WORK answering only after the unstaging, is not from Couchbase's documentation. The transactions page calls the commit eventually consistent for KV reads. The SDK can report a success with unstaging_complete false. If that happens here, the next plain write lands on a staged document, and the cleanup can overwrite it. Please keep this lease committed after every commit, as the token arm at line 1186 already does. Otherwise, please list the case in item 15 as OPEN against row 4.4.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
lease wait; the 64 attempts belong to the CAS loops), and the write answers 503
at its end; a `committing` lease before its `commit_by` is waited on the
same way, and at the 10 s deadline the write answers
`TransactionConflictException`, since a transaction is ongoing for the item;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this revision, a stream-table write and an escalated write also mark their lease committing (lines 985-990). So a second PutItem that meets one of them answers TransactionConflictException after 10 s, although no transaction holds the item. Row 4.3 says that plain-writer contention never surfaces as a transaction conflict. Please record in the lease whether a transaction holds it, and answer 503 when none does. Or state this case in rows 4.1 and 4.3.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
pass, and once it has passed the read is cancelled the same way. Every return
path of the section that holds the leases deletes them, and the section runs
detached, so a client that drops the request still releases them; a panic inside
the detached section skips the release and the leases lapse at their 10 s expiry

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that the read renews its leases, the 10 s lapse after a panic holds only if the renewal stops with the section. Please say that the renewal stops on every exit path, a panic included, here and for TransactWriteItems at line 1023.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
commit point passed but the item does not settle (its unstaging stuck, for
example after a node failure), every taker's settle fails (503 for a plain
write, a skip for a background rewrite) only while the lease is live. In
that case the lease is `committed` (written after a post-commit failure, a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says that the lease is committed whenever the commit point passed and the item does not settle. After an unknown outcome that no token resolves, the lease stays committing. Then a stuck unstaging blocks every writer of the item for up to the 24 h expiry, as line 723 says for the backfill. Please name both cases and both bounds here.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

**Runs behind revision 7.** Every row is `[ref-repo]`. The code behind
revision 7 is pushed as the single commit `bf67ee2`; its backend and tests
are the same as the fix-branch commit `3988255`, called "the final code"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit tests (341, and 345 with fault-hooks) and the rewritten backfill test ran on 3988255. The text says only that bf67ee2 is pushed. A reviewer with access can check that the two have the same backend and tests only if both are readable. Please say whether 3988255 is pushed, or cite runs on bf67ee2.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
|---|---|---|
| Upstream `tests/test_*.py` at the pin `7b828b0`, same exclusions as under "Evidence" | single node | 1,214 passed, 6 failed, 16 skipped, 1 xfail, and 2 deselected (the two `test_gsi_async.py` tests that drive the host CLI, deselected by the runbook); 1,237 ran, 3 more than the baseline's 1,234, which is not yet traced; the 6 are the four `aws:SourceIp` loopback cases and the two `test_stream_table_reuse.py` cases of the baseline, and nothing else failed |
| Upstream `tests/python/` (parity) | single node | 331 / 331 |
| Upstream `tests/test_transact_absent_item_isolation.py` (the write-skew test) | three nodes | 10 runs, 5 of 5 tests passed in each, 5.5 to 12 s per run |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These rows don't name the suite revision, and row 6.3 says every conformance figure does. On main, this file has six tests (the sixth came with #513 on 5 Nov), and tests/test_transact*.py has 95 test functions, against 5 and 63 here. Please name the suite revision in each row. Please also list this file in row 4.3's evidence, since it is the test that caught the write skew. Its target for the port is 6 of 6 on main.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

| # | Criterion | How the backend meets it | Evidence |
|---|---|---|---|
| 4.1 | Unconditional writes never fail under contention | A bare unconditional `PutItem` with no `ReturnValues` takes the item's lease (a KV insert), makes one KV write and removes the lease (a read and a CAS remove): there is no CAS on the item and no retry of the write itself, and the last writer wins. **This differs from RFC-0003 4.1** ("two concurrent unconditional `PutItem` calls both succeed"), and the two cases are stated separately. (1) Between plain writes on a table without a stream: the second waits on the first's lease with jittered backoff and answers 503 at the end of a 10 s bound; the lease is held for one KV write, so in practice two racing calls both succeed, and one fails only if the other holds the item for more than 10 s; a plain write that crashed leaves its lease until it expires (30 s), and writes to that key can answer 503 until then. (2) On a stream-enabled table the lease spans a query-service transaction (up to `txtimeout` plus 20 s): the same 10 s bound and 503 apply to a writer that waits on it, and a crashed holder blocks its key for that long. Both are recorded in the `docs/differences-from-dynamodb.md` rows that the implementation PR adds (`main` has no Couchbase entry yet). Sharing the lease between plain writers, so that only a transaction excludes them, is the alternative; it is a follow-up if the reviewers prefer it. What a plain write answers when it meets a transaction's lease is under "Transactions". With `ALL_OLD` it is a CAS loop of 64 attempts / 10 s that answers 503 at exhaustion, as MongoDB does; no CAS detail is client-visible (`cas_contended`) | **OPEN** until a reviewer reads the reference repository. The tests that race bare puts on one key are in upstream `test_put_item_create_race.py` (8 writers, 15 rounds, every put must succeed): `::test_racing_puts_on_a_gsi_table_leave_only_the_final_entry`, `::test_racing_puts_on_an_lsi_table_leave_only_the_final_entry` and `::test_racing_puts_on_a_stream_table_all_succeed`, with `::test_racing_puts_with_all_old_all_succeed` for the `ALL_OLD` loop. Recorded run: the file 9 passed at the pin `7b828b0`, single-node demo stack, durability none `[ref-repo]` (a second run, 9 passed). `test_concurrency.py::test_parallel_inserts` is not evidence here (its threads write distinct keys), and `TestAtomicCounter::test_atomic_counter`, which passed 1 of 1 on the same run, belongs to row 4.4. No test drives two plain writers into the 10 s bound or a crashed lease. After a `COMMIT WORK` whose outcome is unknown, writes to its keys are unavailable until `commit_by` (50 s at the default `txtimeout`): a plain write answers `TransactionConflictException` after 10 s, a `TransactWriteItems` cancels after 2 s (see "The takeover rule"). CR-03 `[ref-repo]` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RFC-0003 4.1 also says that a backend must not surface its concurrency control as a client-visible error on an unconditional write. That is the sentence the 503 differs from, so please quote it. Case (1) says that the lease is held for one KV write. But the escalated plain write (lines 982-985) holds it across a query-service transaction on any table. The TransactionConflictException for up to commit_by after an unknown commit is only in the evidence cell. Please make it a third case here and in the differences rows, as #1183 does.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
| 4.1 | Unconditional writes never fail under contention | A bare unconditional `PutItem` with no `ReturnValues` takes the item's lease (a KV insert), makes one KV write and removes the lease (a read and a CAS remove): there is no CAS on the item and no retry of the write itself, and the last writer wins. **This differs from RFC-0003 4.1** ("two concurrent unconditional `PutItem` calls both succeed"), and the two cases are stated separately. (1) Between plain writes on a table without a stream: the second waits on the first's lease with jittered backoff and answers 503 at the end of a 10 s bound; the lease is held for one KV write, so in practice two racing calls both succeed, and one fails only if the other holds the item for more than 10 s; a plain write that crashed leaves its lease until it expires (30 s), and writes to that key can answer 503 until then. (2) On a stream-enabled table the lease spans a query-service transaction (up to `txtimeout` plus 20 s): the same 10 s bound and 503 apply to a writer that waits on it, and a crashed holder blocks its key for that long. Both are recorded in the `docs/differences-from-dynamodb.md` rows that the implementation PR adds (`main` has no Couchbase entry yet). Sharing the lease between plain writers, so that only a transaction excludes them, is the alternative; it is a follow-up if the reviewers prefer it. What a plain write answers when it meets a transaction's lease is under "Transactions". With `ALL_OLD` it is a CAS loop of 64 attempts / 10 s that answers 503 at exhaustion, as MongoDB does; no CAS detail is client-visible (`cas_contended`) | **OPEN** until a reviewer reads the reference repository. The tests that race bare puts on one key are in upstream `test_put_item_create_race.py` (8 writers, 15 rounds, every put must succeed): `::test_racing_puts_on_a_gsi_table_leave_only_the_final_entry`, `::test_racing_puts_on_an_lsi_table_leave_only_the_final_entry` and `::test_racing_puts_on_a_stream_table_all_succeed`, with `::test_racing_puts_with_all_old_all_succeed` for the `ALL_OLD` loop. Recorded run: the file 9 passed at the pin `7b828b0`, single-node demo stack, durability none `[ref-repo]` (a second run, 9 passed). `test_concurrency.py::test_parallel_inserts` is not evidence here (its threads write distinct keys), and `TestAtomicCounter::test_atomic_counter`, which passed 1 of 1 on the same run, belongs to row 4.4. No test drives two plain writers into the 10 s bound or a crashed lease. After a `COMMIT WORK` whose outcome is unknown, writes to its keys are unavailable until `commit_by` (50 s at the default `txtimeout`): a plain write answers `TransactionConflictException` after 10 s, a `TransactWriteItems` cancels after 2 s (see "The takeover rule"). CR-03 `[ref-repo]` |
| 4.2 | Conditional writes: correct error on race | The CAS loop re-evaluates the condition against the winner's image and returns `ConditionalCheckFailedException` | CC-01, upstream `test_put_item_create_race.py::test_racing_puts_check_their_condition_against_the_winner`, `::test_racing_conditional_creates_have_one_winner` |
| 4.3 | Transaction conflict mapping | A plain write meeting a `transact_write` lease returns `TransactionConflictException`, and so does one that waits out its 10 s bound behind a `committing` lease before its `commit_by`; a transaction that meets a foreign `transact_write` lease, or cannot take its other leases in 2 s, returns `TransactionCanceledException` with `TransactionConflict` on the contended item only; a plain write meeting a `transact_get` or `plain` lease retries and answers 503 at its 10 s bound; plain-writer contention never surfaces as a transaction conflict (implemented `[ref-repo]`; see "Transactions") | **OPEN** until a reviewer reads the reference repository. TX-08 `[ref-repo]`, CC-09 `[ref-repo]`, upstream `test_transact_write_conflict.py`, `scripts/write-race-test.py` `[ref-repo]`, `tests/test_txn_lease.py` `[ref-repo]`, the three-node harness's commit-point hold `[ref-repo]` |
| 4.4 | UpdateItem serializes | CAS read-modify-write with jittered backoff; arithmetic and `ADD` never take the sub-document path; on a stream-enabled table each write is a transaction that holds the item's lease, so two on one key do not meet at the document: the second waits on the lease and writes after the first releases it, and both succeed; the first keeps its lease until its commit is visible to a KV read (`bf67ee2` `[ref-repo]`; revision 6 left this row OPEN in part because three commit paths released without that wait), and the paths that can still conflict at the document are listed under "DynamoDB Streams" | CC-02, CC-03, `scripts/concurrency-property-test.py` (`prop_add_counter`, `prop_optlock_counter`), upstream `test_concurrency.py::TestAtomicCounter::test_atomic_counter` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gap A (d) lets the cleanup overwrite a KV write made after the committed lease lapses (lines 1369-1371 and item 15). So an acknowledged UpdateItem can be lost, and RFC-0003 4.4 requires no lost update. Gap A (b) is an untested ordering on the same path. Please mark this row OPEN in part for Gap A (b) and (d). Please also name row 4.4 next to row 4.5 in the acceptance intro (line 1806), in item 15 and in the PR description.

`couchbase:enterprise-8.0.0`, a required check as `mongodb-integration` and
`cassandra-integration` are. The crate's own `*_live_tests.rs` run there
through `run-couchbase-tests`, together with the in-crate checks every backend
runs with its own store: `metrics_conformance`, `key_conformance`,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since round 5, #1523 changed AuthorizationStore on main to read a role session's data by its access key ID. It also added session_data_conformance, which the MongoDB and PostgreSQL crates run against their own stores. Please add it to this list of in-crate checks, and the new signature to the port list.

@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, thank you for round 6. I have read all 21 inline comments and the review body, and I am not going to answer them point by point until the changes are tested. This is a short status so you know where things stand.

Wording and tables (revision 8, to follow). Most of the comments are corrections to the text, and I agree with them: the A1 and A2 statements, the committed and committing bounds, the failed-settle outcome, item 12 in the open lists, the data-scope list, the suite revisions and counts, the RFC-0003 4.1 quote, row 4.4 as open in part, the session_data_conformance and AuthorizationStore additions, and the two restore divergences in #1183 (I will drop them: both match the AWS reference). These are written and checked against the code and against main.

Three points are code, not wording. I am implementing and testing them now, and revision 8 will describe whatever the tests show:

  • Lines 909 and 965: a committed lease that lapses, and the ConditionCheck lease that is deleted after a commit. The direction is the one you suggest: no writer clears a committed or committing lease and then writes by KV, and the ConditionCheck item's lease stays committed.
  • Line 981: record in the lease whether a client transaction holds it, so a plain writer that waits behind a stream-table or escalated write answers the 503 and not TransactionConflictException.

Line 1343 (the commit-point gate). You are right that a freeze of one query engine ends before the reader's probe, and that matches the 0 resolutions. I am trying a different fault, killing the coordinating query engine so that the unstaging is left to Couchbase's cleanup, with the same gate. If it cannot keep a record staged past the reader's age, revision 8 will say so, and the gate stays OPEN. If you have a mechanism you would accept for this, I would rather build that one.

Read access (line 28). You are right that the invitation of 24 November has expired. I have sent a new read invitation to your GitHub account (2026-12-01); it is pending at https://github.com/couchbaselabs/extenddb-couchbase/invitations, and the repository answers 404 until it is accepted. It expires after seven days, and I will send another if it lapses. Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay OPEN until a reviewer has read the repository.

I expect to post revision 8 by Friday, 4 December.

@LeeroyHannigan

Copy link
Copy Markdown
Collaborator

@suravarjjala, on line 1343: any harness meets the gate if its run shows the gate's state after the fault. In that state, a KV get misses a filler record, and a transactional read by key returns it. The run must also show that the gap reader resolves that record through its transactional read.

A kill of the coordinating query engine may end like the freeze in item 15. There, another node completed the interrupted unstaging in about 1 s. If that completion comes from the Query Service's transaction cleanup, two cluster settings disable the Query Service's part in it: queryCleanupLostAttempts and queryCleanupClientAttempts (cluster query settings). One way to use them on the three-node harness:

  1. Set both settings to false.
  2. Kill the coordinating query engine after the commit point.
  3. Check that the record is still staged when the reader probes, and that the reader resolves it.
  4. Set both settings to true again, and show that the cleanup completes the unstaging.

If the record does not stay staged with cleanup off, please say so in revision 8.

…mmit-point gate run, test revisions and counts)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, revision 8 is pushed to this PR (head 4c0e2754). Your line numbers are those of revision 7 (3ed54902c); I checked each against that copy and they were right to within 1 to 3 lines. Each answer below gives the verdict, and where the revision-8 text or code is, by section name. Verdicts: AGREE, FIXED-TEXT, FIXED-CODE, ANSWERED, or OPEN with the reason. The code is on the branch fix/round6 of the reference repository (tip b66f6c7, on top of bf67ee2; it differs from 389b8bc, where the runs below were made, only by the rename of one script directory and of the names in it (containers, environment variables, README)); every claim about it is marked [ref-repo], as the RFC's front matter defines it.

Runs referred to below:

  • Run U: cargo test --lib on 823f7e8: 349 passed, 353 with fault-hooks (341 and 345 on bf67ee2). Clippy library warnings 29, the same as at bf67ee2.
  • Run F1: tests/test_fault_hooks.py, fault-hooks build, single node, durability = none, on 823f7e8. Default txtimeout: 24 passed, 3 skipped. txtimeout 1 s: 25 passed, 1 failed, 1 skipped; the failure is test_a_conflicting_transaction_in_the_commit_window, which fails the same way at that setting on bf67ee2.
  • Run F3: the nine new lease cases of that file, three nodes, durability = majority, 823f7e8, before 8d941da made the multi-node lease view fail on a query error: 9 passed; rerun at 389b8bc: the whole file, not only the nine cases, 25 passed and 3 skipped at the default txtimeout, and 26 passed, 1 failed and 1 skipped at a 1 s txtimeout (the failure is the 1 s-only test that also fails on a single node), with the lease view returning documents, so no test passed on an empty view. The tests read the lease documents through a request_plus SQL++ query over a primary index created by hand on the throwaway cluster, because the admin REST listing returns only the contacted node's vBuckets.
  • Run L3: lease paths under load, three nodes, durability = majority, 823f7e8, default txtimeout: 2 runs of 200 rounds each, on a plain and on a stream table (4,000 rounds in all), in the modes plain, concurrent, held, transaction-only and PutItem-only. 0 lost writes in all of them (the final value was the last acknowledged write in every held run); every refusal was TransactionConflictException while a transaction held the item; no 503. Median latency of a plain-table transaction was 17.1 to 19.0 ms and of a PutItem 12.2 ms after a ConditionCheck, against 5.0 ms with no lease on the item (quiet run).
  • Run A1: upstream tests/test_transact_absent_item_isolation.py (a six-test copy from a local clone of upstream), three nodes, 823f7e8: 6 of 6 in 3 of 3 runs. The revision of the clone was not recorded when the runs were made; it was at 3ed54902, the PR branch, when checked.
  • Run N (identical images, added after the runs above): single-item writes whose staged image equals the pinned image, on fix/round6 at 389b8bc (fault-hooks image built from 1c44cc6, same backend). The new test test_a_stream_table_put_of_an_identical_image_keeps_a_committed_lease passes at 389b8bc and fails at 8d941da and 823f7e8. The fault-hook file on a single node: default txtimeout 25 passed, 3 skipped; 1 s txtimeout 26 passed, 1 failed (the known test above), 1 skipped. Regression: test_gsi_fence.py, test_txn_lease.py and test_transaction_rollback.py 16 passed, and seven upstream test_transact*/create-race files 73 passed; test_transact_update_remove_only.py 24 passed, 24 failed, the same as at the baseline (a file newer than the pin). Three nodes: 2,000 rounds of the lease driver, 0 lost writes, no 503, on a loaded host (medians 7 to 17% above an earlier run, attributed to host noise, not proven). cargo test --lib 350 passed at e2fa27f; clippy library warnings 29 at e2fa27f, the same as at 8d941da (not run with -D warnings, which the baseline's 29 warnings already fail). The whole fault-hook file on three nodes at 389b8bc is under Run F3, and the full upstream suite, the upgrade and the lease build-up are Run S.
  • Run S (added after Run N; three nodes, durability = majority, default 30 s txtimeout, release image of 389b8bc, no fault hooks): the full upstream suite, 59 files after the CONFORMANCE.md filter, tests of 7b828b0 plus the test_transact* files of upstream d4dd0ba4. All passed except 4 aws:SourceIp loopback tests (the server sees the Docker gateway address, an artifact of the container on macOS; not rerun on the baseline), 2 in test_stream_table_reuse.py (also fail on bf67ee2: not implemented) and 35 in two files that exist only at d4dd0ba4 (the same failures on bf67ee2: test-version skew); harness errors of mine in the first pass (missing import/export paths, auth cache disabled) were fixed and are not product results. The image was built with the pinned dependency served from a local clone of the same sha 7b828b0 (Cargo.lock unchanged). In the same setup: test_txn_lease.py 8 of 8, test_gsi_fence.py 1 of 1, test_transaction_rollback.py 7 of 7, test_stream_trim.py 1 of 1. Upgrade bf67ee2 to 389b8bc on one cluster: 24 of 24 acknowledged items intact, 0 errors; tested on hand-made old-format markers only (bf67ee2 left none after a TransactWriteItems); an expired marker acts as none, a present or lapsed committed marker is taken over at once, a legacy committing marker without txn makes a plain write wait 10 s and answer TransactionConflictException until its derived commit_by (about 10 minutes). Lease build-up: 2,000 PutItems leave no marker; 2,000 ConditionChecks on 500 keys leave 500 committed markers of about 147 B (73.8 KB), 24 h expiry; the first later PutItem on such a key p50 11.0 ms against 4.0 ms with none, then 4.4 ms.
  • Run G: the commit-point gate, three nodes (Couchbase Server 8.0.0, data, index and query on each, one replica), durability = majority, txtimeout 1 s, 823f7e8 built without fault-hooks. Described under line 1343.

Line 1343 (your comment on the commit-point gate, and the mechanism you gave)

ANSWERED. The gate was reached and the reader resolved the staged records. The row stays OPEN.

You are right that a freeze of one query engine ends before the reader's probe: the unstaging takes 18 ms at the median, the reader's first transactional read comes at txtimeout plus 15 s, and that is the 0 resolutions of the two freeze runs. The revision-8 text says so.

You asked for a mechanism, and I used yours, with one change: the kill is timed, not blind. Run G:

  1. queryCleanupLostAttempts and queryCleanupClientAttempts set to false by POST /settings/querySettings (original values read first: both true), and read back on all three nodes.
  2. Each trial is one TransactWriteItems of 10 puts (21 operations) on a stream-enabled table (NEW_AND_OLD_IMAGES). A KV poller sees the first new item document, which means the commit point is past and unstaging has begun, and sends SIGKILL to the coordinating cbq-engine after a random delay of 0 to 10 ms (0 to 15 ms in the first 20 trials). The killed engine was the coordinator in 200 of 200 trials, predicted from the backend's query-txn commit log line and checked afterwards.
  3. For 60 s after the kill: a KV sweep, a transactional read (BEGIN WORK, SELECT ... USE KEYS, ROLLBACK) on a live node, and a second KV sweep. The gate is a stream record that both KV sweeps miss and the transactional read returns. A stream reader polled GetRecords from TRIM_HORIZON every 0.5 s.
  4. Cleanup set back to true, and the unstaging observed.

What it showed:

  • Gate reached in 24 of 200 trials with cleanup off (1 to 7 staged stream records each, median 2.5). It depends on the kill landing within 10 ms of the first visible document: 2 to 4 ms after it, 10 of 29 trials; 4 to 6 ms, 8 of 45; 6 to 8 ms, 3 of 35; 8 to 10 ms, 3 of 33; 10 ms or later, 0 of 58. In the other 176 trials the kill landed after the unstaging.
  • The record stayed staged with cleanup off: in 23 of the 24 for the whole 60 s hold, and the census at the end of the cleanup-off phase found those 23 still staged (KV miss on every node, the transactional read returned each) up to 2,578 s (43 minutes) after the kill. One trial unstaged itself 22.3 s after the kill with cleanup off on all three nodes; I did not find the cause, and it did not repeat. You asked me to say if the record does not stay staged; this is that case, once in 24.
  • The reader resolved them in 24 of 24 gate trials: the backend logged committed record resolved by a transactional read for exactly the staged numbers, first resolution 16.0 to 16.4 s after the kill (txtimeout plus 15 s), and the reader then delivered all 10 records of the trial while a KV get still missed the staged ones. The whole-run log has 102 stream gap lines: 101 resolved, 1 transactional read failed (error 17017, queue is closed), retried and resolved 0.5 s later. No number was skipped without a transactional hit.
  • Step 4, cleanup back on: the oldest staged records (up to 43 minutes old) began to unstage about 618 s after the switch, 12 of 23 trials by 820 s; in a later on-phase the remaining ones cleared 50 to 103 s after the switch. Everything was unstaged afterwards. So the cleanup does complete the unstaging, and slowly.
  • Control with cleanup on from the start: 20 of 120 trials reached the gate (a second driver, started by mistake, briefly switched cleanup off during part of this phase; the run's own report excluded 3 trials for that, giving 19 of 117, but the result files do not mark which, so 20 of 120 is the figure stated). In the 6 trials tracked per key the record stayed staged for 126, 238, 241, 262, 365 and 495 s, so cleanup does not close the window either; it is not required to reach the gate.
  • Every writer was answered with success (200 of 200), 187 of them in 0.08 to 0.26 s and 13 in about 15.1 s (the visibility wait reached its 15 s bound; 9 of the 13 were gate trials). So an acknowledged write coexisted with staged stream records.

Limits, all of them of the harness: one three-node cluster; only the coordinating engine was killed, never more than one node and never a non-coordinator (the record was staged on every node anyway: KV missed it on all three); txtimeout 1 s, at which transactions of 100 or 20 items do not finish on a stream table (503 after 4 to 78 s), so every trial uses 10 puts; a single PutItem on a stream table unstages its record about 0.5 ms after its item, faster than the trigger can kill (60 trials, no gate; 2 answered 500 although the write had committed and both documents were visible, not investigated); the trigger is a poller, so the kill timing is not under control below about 2 ms. The harness is in the reference repository as scripts/commit-point-gate/ (added in 1c44cc6, renamed in b66f6c7); it was only syntax-checked after its paths were made configurable and its README lists manual setup steps, and the numbers above come from the run of the working copy, not from a rerun of the committed one. The per-trial result files are not in the repository. The run does not show how long Couchbase's cleanup takes after a real node failure.

Row 5.2 stays OPEN for those limits and until a reviewer has read the reference repository. Engineering items 1 and 2 and row 5.2 in the RFC carry these numbers.

Inline comments, in your line order (row 10 last)

Line Verdict Where it is What it is, and what was not verified
28 OPEN Front matter, PR description, #1183 You are right that the invitation of 2026-11-24 expired and the repository answers 404. I sent a new read invitation on 2026-12-01 (pending, expires after 7 days); you can accept it at https://github.com/couchbaselabs/extenddb-couchbase/invitations, and I will send another if it lapses. Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay OPEN until a reviewer has read the repository.
309 (the sentence at 311 of revision 7; also 283, 286, 355) FIXED-TEXT (a statement of design, no in-tree code yet) "Bucket layout" table rows for reindex_queue and the ledger, "Catalog and data migrations" migration 1, destroy paragraph The ledger extenddb_migrations is named in the data list and in destroy's shared list, so the data scope can be dropped when nothing foreign is left; without that entry your reading holds (the ledger counts as foreign). Migration 1's data body now creates reindex_queue and txn_leases; the engine's first-use check stays as a guard. In the reference repository the picture is different and the text says so: reindex_queue is created by the data migration and again by the reindex worker, txn_leases is not created by init and is created on first lease, and there is no data-scope ledger. The in-tree migration is design, not code.
845 (and the decisions-table row at 1673) FIXED-TEXT "The takeover rule" prose, "Design decisions summary" "Nothing depends on how Couchbase stages a mutation" is replaced, in both places, by the two behaviours the design does depend on: A1, and COMMIT WORK answering only after the unstaging. The text says that neither is from Couchbase's documentation and that neither was verified at the query service.
894 FIXED-TEXT A2 paragraph, "Plain writes and transactions on one document" A2 is stated as you wrote it: the server that writes commit_by also compares it; the query node times txtimeout on its own clock; the takeover is early only if this server's wall clock steps forward between the mark and the check, and a restart on a host whose clock is ahead has the same effect. The text says the deployment is to run NTP, which Couchbase already requires for transactions. Not verified: that the reference deployment's hosts run NTP.
904 (first comment) FIXED-TEXT Same section, "stuck unstaging" paragraph Both markers and both bounds are named. committed (a post-commit failure or a visibility wait that timed out) now lasts until the next writer's own commit is visible, with 24 h as the backstop; committing after an unknown outcome that no token resolves, or a token read that itself fails, stays until commit_by for a takeover (and a failed settle puts it back), with the same 24 h expiry. In both, a stuck unstaging refuses writers of the item for up to 24 h, as the backfill sentence already said. A token read that finds nothing is "not committed" and releases; only a failed read is unknown.
909 FIXED-CODE, with four windows still open "Corrections in revision 8" (A); item 15 Gap A (b) and (d); row 4.4 Code: 5a14ccf, 11ba318, 9630c56, 3a0027d (all on fix/round6, pushed). A committed lease expires after 24 h, like a committing one. A marker whose exp has passed but is still in the bucket is taken over like a live one, not deleted. Every writer that takes a marker over writes through a query-service transaction: plain write on any table, stream-table write, GSI backfill and reindex reconciler (through replace_at_cas), TransactWriteItems; a TransactGetItems reads through it transactionally. A taker whose own transaction commits nothing (failed condition, rollback, cancellation, absence check, a request dropped by its client) puts the marker back with its original exp and the native expiry it had left, so a restore does not move the marker's exp (a lapsed marker is kept at least 60 s per touch, and a clean ConditionCheck or identical-image commit writes the marker again with a fresh 24 h). Tests: Runs U, F1, F3 (lapsed committed marker present after 35 s and taken over by a query transaction; the restores; the dropped request; the lapsed committing marker), Run L3, Run A1. Still open, and in the text: (1) a process death between the takeover and the taker's own committing mark loses the marker; (2) a restore that fails twice (one retry); (3) a marker that reaches its 24 h expiry with unstaging still pending; (4) a mixed fleet: an older binary expires committed markers by their exp (now 24 h, so safe) but does not restore. The reconciler path over a marker is not tested on its own (it shares replace_at_cas and the plain takeover with the backfill, which is). The staged overwrite itself (a plain KV write landing on a staged document and the cleanup then overwriting it) has not been reproduced with the existing hooks; the fix closes the route by design, not by a reproduction. The order of a takeover's transaction after a committed one (Gap A (b)) is untested.
965 FIXED-CODE (your first alternative), with one path to settle "Corrections in revision 8" (B); item 15 Gap A (e) Code: 338a1aa, 11ba318, and for single-item writes e2fa27f (all on fix/round6, pushed). After a clean commit of a TransactWriteItems the lease of a ConditionCheck item with no mutation on the same key stays committed; so does the lease of an item whose put, update or delete in it leaves its image unchanged (a put of an identical image, an update to the value the item has, a delete of an absent item). A TransactWriteItems reads the current image of every mutation action by KV before each attempt to find them (one parallel round: +0 to 1 ms in Run L3). An absence check stages nothing and its lease is deleted. Tests: Runs F1 and F3 (a ConditionCheck marker stays committed; the next PutItem escalates and clears it; identical put, identical update and absent delete keep it; a changed put releases it). Cost, from Run L3 and an earlier run: the first plain write after such a lease is a query-service transaction, 12.2 ms in the quiet run (11.9 ms in an earlier one) against 5.0 to 5.1 ms. The pre-image reads are not pinned by CAS; a concurrent change can only make the check keep a committed lease or release one whose body differs, where the body comparison still proves it. Single-item writes, settled from the code: an escalated plain write and a single-item write on a stream-enabled table share one function, and it had the gap for an item that differs as an Item but stores an equal document. e2fa27f applies the rule there: if the staged image equals the pinned image the lease stays committed after a clean commit. For numbers the comparison is by value, doubles within a relative 1e-12 being equal. This is a narrow safety rule that errs toward keeping the marker, not a fix of a common case: N "2.0" over "2" is not such a case (the server normalises it, the write is a no-op, nothing commits and no lease is left), and I found no pair reachable through the API that differs as an item and stores a bit-identical document. Test: Run N. The background rewrite through replace_at_cas is not changed: its callers only call it after a change, so an identical image cannot reach it today.
981 FIXED-CODE "Corrections in revision 8" (C); rows 4.1 and 4.3 Code: 5411a03 (on fix/round6, pushed). The lease records txn: true for TransactWriteItems and TransactGetItems, false for plain, stream-table and escalated writes; it survives the rewrite to committing and committed. A plain write whose 10 s wait ends behind a committing lease answers TransactionConflictException only if a client transaction holds it, and 503 (the existing contention error) otherwise. A lease without the field is read as a transaction's, which is the old behaviour. Tests: Run F1 (held stream-table put and held escalated put: the second PutItem answers 503 after about 10 s; held client TransactWriteItems: TransactionConflictException; a lease with txn removed: TransactionConflictException; the ambiguous-commit test on a stream table now expects 503). Not changed: a lease held by a TransactGetItems still ends a waiting plain write in 503, as before.
1036 (your second comment on the row; the "failed settle" outcome) FIXED-TEXT Outcomes table of "Plain writes and transactions on one document" The row now says: a failed settle restores the lease, and the second transaction cancels with TransactionConflict on that item. Read from the code, not a separate run; when both transactions carry the same ClientRequestToken the second waits for the holder, which the row already said.
1040 FIXED-TEXT Outcomes table of "Plain writes and transactions on one document" (the row for a key that does not exist) A restore's copy does not take the item lease. The target is created CREATING and the data plane does not serve a table in that state, so no ExtendDB writer writes the target while the copy runs; the backup copy into its snapshot is the same. The row now says that no ExtendDB writer writes without the lease, the background writers included, with one exception: the copy of a restore takes no item lease, and neither does the copy of a backup into its snapshot. Verified only for the function that decides visibility (a unit test); not verified that every data-plane path calls it.
1133 FIXED-TEXT (true per the code, not tested for a panic) TransactGetItems and TransactWriteItems paragraphs The text now says the renewal stops on every exit path of the section, a panic included: the renewal task ends when the section's sender is dropped, and unwinding drops it. One renewal already in flight can still complete, so the lapse is up to 10 s after the last renewal. There is no panic = "abort" in the reference manifests or in main's Cargo.toml. The only test is one for a panicking section's neutral error; no test checks that the renewal stops.
1287 FIXED-TEXT "DynamoDB Streams", the iterator paragraph The sentence now says that an iterator below the trimmed horizon moves forward over trimmed numbers, so a number still unresolved at 24 h is passed; "no age resolves a number" is narrowed to "no age below the 24-hour retention". What happens to a record that commits after that is stated as not tested.
1343 ANSWERED above See the section above.
1716 FIXED-TEXT (the ratios are withdrawn) "Performance characteristics" I found the figures (3.0 sets against 1.0, 1.33 deletes against 0.33, cbstats deltas summed over three nodes), but no record of which counters they are, and the script that produced them is gone. So the per-write ratios are withdrawn, and the text says the counters were not recorded, so no per-write ratio is given. The latency and throughput figures stay.
1745 ANSWERED, FIXED-TEXT "Testing" 3988255 is not pushed. It exists in two local worktrees and on no remote branch; it is not an ancestor of bf67ee2. git diff --stat 3988255 bf67ee2 -- backend tests demo scripts prints nothing (run 2026-12-01), so the 341/345 unit tests and the rewritten backfill test ran on the same backend and tests as bf67ee2; the full diff is five deleted files outside them. You cannot repeat that diff from the remote, and the text says so. The revision-8 runs are on 823f7e8 and 389b8bc; the tip adds 8d941da (test), e2fa27f (backend: the identical-image rule), 1c44cc6 (harness), 389b8bc (test), and d0dc673 and b66f6c7 (the rename of the harness directory and of the names in it), as Run N says.
1766 FIXED-TEXT "Testing" rows, row 4.3 Each row names the suite revision. Counted with grep -c "def test_" on each revision (class methods included, parametrization not expanded): the write-skew file has 5 tests at the pin 7b828b0 and 6 at 5489d29ac and at d4dd0ba4 (the sixth came with #513, 2026-11-05, b186d1a0); tests/test_transact*.py has 63 in 6 files at the pin and 95 in 8 files at 5489d29ac and d4dd0ba4 (your 95 confirmed). The write-skew file is listed in row 4.3's evidence, with 6 of 6 on main as the target. Which revision our earlier 5 of 5 and 63 of 63 ran at is not recorded; the text infers the pin from the counts and says it is inferred. Run A1 is 6 of 6 on a copy of the six-test file. main's own suite was not run.
1847 FIXED-TEXT Row 4.1; "Writes and conditional writes" (the differences paragraph) Row 4.1 quotes RFC-0003 4.1: a backend must not surface its concurrency control as a client-visible error on an unconditional write. Case (1) is plain writes on a table without a stream: the lease is held for one KV write, except for an escalated plain write, which holds it across a query-service transaction. Case (2) is a stream-enabled table, where the lease spans a query-service transaction. Case (3), new, is TransactionConflictException for up to commit_by after an unknown commit of a TransactWriteItems that a client transaction holds; the stream-table and escalated variant of it is now 503 (see 981). The three cases are in the differences paragraph and in #1183.
1850 FIXED-TEXT Row 4.4, status line, acceptance intro, item 15, PR description Row 4.4 is OPEN in part for Gap A (b) (the untested ordering) and (d) (a plain write can still be overwritten by the cleanup, so an acknowledged UpdateItem could be lost, which RFC-0003 4.4 rules out), and names the four windows listed under 909. Row 4.4 is named next to row 4.5 in the acceptance intro, item 15 and the PR description. Gap A (e) is closed in the code for TransactWriteItems (see 965). No run produced a lost write: 0 in Run L3.
1913 FIXED-TEXT "Required suites", port list step 6 session_data_conformance (added by #1523, 5026c891, 2026-11-27) is in the in-crate checks. The new signature is in the port list, quoted from crates/storage/src/authorization_store.rs: fn fetch_session_data(&self, access_key_id: &str) -> BoxFuture<'_, OpResult<Option<SessionData>>>;. The reference code still has the earlier three-argument signature, and the text says that.
1974 FIXED-TEXT "Plain writes and transactions on one document", Drawbacks "Undefined" is dropped in both places. I did not find the word on Couchbase's transactions page either, and no citation is given.
10 (and the acceptance intro at 1799, row 6.3) FIXED-TEXT Status line, acceptance intro, row 6.3, item 12 row Item 12 is listed in all three, and item 12's row says that the YCSB run with the lease on every table and its refusal counts has not been run.

Review body

  • Round 5 items you listed as resolved, and the two that stay open (lines 889 and 1386): nothing to change. Line 889 is the commit-point gate: see 1343. Line 1386 is item 15, which stays OPEN as above.
  • The two divergences in [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 (a table being restored is hidden from the data plane; DeleteTable on it answers ResourceInUseException): dropped from the list in [RFC] Couchbase storage backend (crates/storage-couchbase) #1183 and the PR description. On your reading of the AWS DeleteTable reference both match the service. I did not re-read that page for this revision. The RFC itself never listed them as divergences.
  • A1 and A2: A1 is stated as one of the two behaviours the design depends on and is not tested: no run has held a COMMIT WORK past its commit_by, so the takeover rule's assumption stays OPEN in item 1.
  • The rows that stay OPEN until a reviewer reads the reference repository: 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2. Row 5.2 is also OPEN for the limits of Run G.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 8, and for the answer to each comment. I read the RFC at 4c0e275 against main at 1be1012.

Revision 8 resolves most of round 6: the comments on lines 10, 309, 845, 894, 965, 981, 1036, 1040, 1133 and 1287. It also resolves those on lines 1343, 1716, 1745, 1766, 1847, 1850, 1913 and 1974, and the two restore behaviours in #1183. The commit-point gate run is what my reply of 1 December asked for. With cleanup off, 24 of 200 trials reached the gate, and the reader resolved each staged record through its transactional read. The comment on line 904 is resolved in part (see line 1001). Line 909 is resolved in the design, with four windows left open. Line 28 stays open until a reviewer can read the reference repository, as your answer says.

The FIXED-CODE answers are in that repository, which I can't read yet, so this review checks the design the RFC states. Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay open for that reason, as the RFC says.

Three inline comments need a change to the design or its tests: lines 1001, 1008 and 1353. The others are smaller corrections.

One point doesn't fit inline. Since #1464 merged on 2 December, main checks that a PR title is a conventional commit subject. The title becomes the subject of the squash commit. "RFC: Couchbase storage backend" fails that check: RFC is not an accepted type. The other RFC PRs use docs(rfc): ..., for example #1396 and #970. Please retitle this one docs(rfc): Couchbase storage backend.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
failure, a visibility wait that reached 15 s, an unknown outcome that the
token resolved as committed, or a clean commit with a `ConditionCheck` or an
unchanged image) and a `committing` marker (an unknown outcome that no token
resolves: no `ClientRequestToken`, or a token read that itself fails; its

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lists the unknown outcomes that keep a committing marker as a request without a ClientRequestToken and a failed token read. Lines 1437-1440 also keep the leases when the token is absent. There, a token that is absent now may belong to a commit still in progress. Your answer on line 904 says that a token read that finds nothing releases the leases. If the code does that, a plain write or a second transaction can go ahead while that COMMIT WORK can still pass its commit point. That is the write skew that revision 7 closed. Please keep the leases committing until commit_by for an absent token and for another fingerprint, and state that one rule here and at line 1438.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
"Global and Local Secondary Indexes" says of the backfill; the code behind
revision 7 blocked them for 30 s after a `committed` marker and then let a
plain write through by KV. That is the price of the change. No run has
produced a stuck unstaging, so how long it would block is not measured.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run G produced this state. With cleanup on, the records of the six tracked trials stayed staged for 126 to 495 s (line 1663). Your answer also says that 13 visibility waits reached the 15 s bound, which leaves committed markers while documents of those transactions are still staged. So the block can be measured, and Gap A (b), which every taker now relies on, can be tested with the kill harness. Please change this sentence and lines 1029-1033 to say so. Then, in the harness, send a PutItem, an UpdateItem with ADD and a TransactWriteItems to the item of a gate trial while that trial's documents are still staged. Record each answer over time, and the item's value after the unstaging.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

**Limits of the round-6 code changes.**

- **A process death in a short window.** A taker's protection of a marker starts when it marks its own lease `committing`. Between taking a `committed` marker over and that marking, the taker's lease has only its short expiry (the transaction lease expiry for a `TransactWriteItems`, the single-write expiry for a plain write), and a request dropped while the runtime is shutting down, or a panic of the detached section, is not restored either. If the server process dies in that window, the lease expires, the next writer clears it as an ordinary expired plain lease and writes by KV, and the original document may still be staged. The window is the duration of one write and needs a process death. It is **not fixed**; the way to close it is to write the takeover lease with the 24 h expiry and the original marker in it.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Between a takeover and the taker's own committing mark, the marker lives only in the taker's short lease. A process death, a panic or a shutdown loses it, and the drop guard does not run while the runtime shuts down (line 1129). The next writer then writes by KV onto a document that may still be staged. The cleanup can then overwrite that acknowledged write, which RFC-0003 4.4 rules out. This bullet already names the fix. Please make it the design. The taker's lease would carry the original marker with the 24 h expiry. Every writer would then treat an expired lease that carries a marker as that marker.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
conditional write that loses every attempt to other plain writers answers
503 `ServiceUnavailable`, which the SDKs retry, as the MongoDB backend does
after its 50 attempts; `TransactionConflictException` is answered only when the
item is held by a `TransactWriteItems` lease, or by a `committing` lease that

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since change (C), a committing lease that no client transaction holds ends the wait in 503, as lines 653-656 and 1109-1115 say. This sentence still gives TransactionConflictException for every committing lease that can't be taken over yet. Please limit it to a committing lease whose txn is true or absent.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
taker that puts a marker back (after a failed settle, or because its own
transaction committed nothing) restores it as it was, with its original
`exp` and the native expiry it had left (at least 60 s, at most 24 h), so
a restore does not move the marker's `exp`, though a lapsed marker is kept for at least 60 s after each touch, and a clean commit that proves nothing (a `ConditionCheck` or an identical image, also over a taken marker) writes the marker again with a fresh 24 h.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A restore keeps a lapsed marker for at least 60 s after each touch. So while an unstaging is stuck and writers keep arriving, the marker never expires, and the item is refused past 24 h. Lines 1003-1004, 1194, 1356 and row 4.4 give 24 h as the bound. Please state the bound as 24 h, and after that for as long as a writer touches the marker at least once every 60 s.

on that item, a plain write answers 503 with nothing written, a background
rewrite skips the item). Every taker writes through a query-service
transaction, which Couchbase orders after the committed one, and none clears
a marker and then writes by KV: a plain write, a stream-table write, the GSI

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TTL sweeper also writes items, through the normal delete path (line 1734). Please name it in this list and at line 1202. A reader can then see that it takes the lease and treats a marker as a plain write does.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
on a single node at `durability = none`, where the write skew of
"Corrections in revision 7" did not show; on three nodes only the
transaction files, the write-skew test, the skew driver and the checks below
ran. The full suite on three nodes has not been run (**OPEN**). Several

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence says that the full suite on three nodes has not been run, and marks it OPEN. Line 2151 and the 389b8bc row at line 2188 report that run, and the description says the same. Please scope this sentence to the revision 7 code, drop the OPEN mark here, and point at the 389b8bc row.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
|---|---|---|---|
| 6.1 | Evaluation semantics | Delegates to `extenddb_core::expression::evaluate_condition` on the read image; no native pushdown | CR-10 to CR-13, upstream `test_conditional_writes.py`, `test_conditional_operator.py` |
| 6.2 | No hidden unused code | The crate-level `#![allow(unused_variables, unused_imports, clippy::too_many_arguments)]` of `engine.rs` and `catalog.rs` is gone, with the 3 unused imports and the 5 dead items it hid (measured 2026-11-05, removed 2026-11-24, commit `b0c272f`; `[ref-repo]`). One targeted, commented `#[allow(dead_code)]` remains, on the sidecar-format detector the proposed v3.1 → map-form data migration will call | **OPEN** until a reviewer reads the reference repository. `cargo rustc --lib -- --force-warn unused_imports --force-warn unused_variables --force-warn dead_code`: that one item |
| 6.3 | Documentation describes the system as built | Every mechanism described in this RFC is implemented and on the live code path, or is marked OPEN: rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 are OPEN until a reviewer reads the reference repository, and, in "Engineering items of revision 3", items 1, 2, 5, 8 and 12 have OPEN parts, item 13 is blocked on the pin and item 15 is two OPEN gaps (Gap A and Gap B, see its row, which leaves rows 4.4 and 4.5 OPEN in part); Capella is stated as unvalidated, the failover-sweep claim cites a specific nightly run, every conformance figure names its suite revision, and the scaling figures cite measured runs. Also recorded here for honesty: nightlies #46 through #58 `[ref-repo]` reported a **baseline** sweep of 908 of 913 with the same 5 non-passes every run (`test_abac.py` ×3, `test_auth_permissions.py::test_explicit_deny_all_service_operations`, `test_cross_account_isolation.py::TestStreamAccountScoping::test_shard_iterator_only_returns_owning_account_records`). Triaged 2026-11-09 as test-suite skew: the nightly's heavy lane skipped the "clone upstream at the pinned rev" stage, so the sweep ran the stale `e41f370` test checkout (913 collected) against the auth-cluster build. What the pinned `7b828b0` run of 2026-11-24 (under "Evidence") shows: the `test_auth_permissions.py` and `test_cross_account_isolation.py` cases pass, and three `test_abac.py` cases fail, all three `aws:SourceIp` loopback cases, behind Docker Desktop's bridge on the machine that ran it. Whether the nightly's three `test_abac.py` non-passes were those cases, and whether they pass on the Linux agent, is settled by the first nightly after couchbaselabs/extenddb-couchbase#237 `[ref-repo]` (merged 2026-11-24: the clone stage runs in both lanes and `scripts/sweep-under-failover.sh` refuses a checkout that does not match the Cargo pin); until then the skew triage covers two of the five, not all five | Jenkins `extenddb-couchbase-nightly` #51 console `[ref-repo]`; #237 `[ref-repo]`; the pinned run under "Evidence" |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Row 6.3 says that every conformance figure names its suite revision. The six-test copy at line 2172 and the files at lines 2173 and 2185 say that the revision was not recorded. The parity row at line 2130 names none. Please let 6.3 say "names its suite revision or says that it was not recorded", and name the pin in the parity row.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
cleanup off the log shows resolved lines for the staged numbers; the first
resolution came 16.0 to 16.4 s after the kill, which is `txtimeout` plus 15 s,
and the reader then delivered all 10 records of the trial while a KV get still
missed the staged ones. The 1 s young-gap rule never fired wrongly: no number

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The 1 s young-gap rule" appears only here, and the reader's rules at lines 1538-1549 name no such rule. Please define it there: what the 1 s is, and what the reader does with a gap younger than it. Otherwise, please drop the clause and keep the sentence after the colon.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
it, tip `b66f6c7` `[ref-repo]`, pushed to the private repository (the
lease changes are in `5a14ccf` to `823f7e8` and `8d941da` (a test change); `e2fa27f` adds the
identical-image rule for single-item writes, `1c44cc6` the commit-point
harness, `389b8bc` one test, and `b66f6c7` the rename of the harness

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description names two rename commits, d0dc673 and b66f6c7, but this list gives b66f6c7 as the only change since the runs below. Please add d0dc673 here and at line 1687.

…, exact-enough comparison, staged-key runs, single-item write ends its own lease)

Answers the round-7 review. The RFC text now states the lease a taker
writes when it takes a marker over (it carries the original marker), the
rule for an unknown COMMIT WORK, the 4-ulp comparison used by the
taker's settle, the visibility wait and the identical-image rule, the
single-item write whose own task ends its lease, the staged-key and
number-change probes of the commit-point gate harness, the stream
reader's dependence on assumption A1, and the new costs and limits.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
@suravarjjala suravarjjala changed the title RFC: Couchbase storage backend docs(rfc): Couchbase storage backend Dec 3, 2026
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, thank you for the review of revision 8 and for the line-by-line check of it. Revision 9 is pushed to this PR (head 61f1df56), and the code behind it is the branch fix/round7-push of the reference repository, on top of fix/round6: the backend code is at aaaac8b, and the branch tip is 9843eeb, which includes ce16a55, a commit that changes a test only. Your line numbers are those of revision 8 (4c0e27547) and the table follows your order; the revision-9 lines are those of the RFC file at the head sha above, and the section names are given beside them.

What changed since revision 8, in the code at aaaac8b and in the text:

  • The marker a taker took over is carried in its lease (your comment on line 1353): a lease that has expired and carries a marker stands for that marker for every writer, so the process death between a takeover and the taker's own committing mark, and a restore that fails twice, are closed by design (SIGKILL tested; row 1353).
  • The unknown-outcome rule is stated once (your comment on line 1001): only a token with this request's fingerprint proves the commit point passed; every other unknown outcome keeps the leases committing until commit_by (row 1001).
  • A defect your comment on line 1082 led to, fixed at aaaac8b. Looking at the pair you asked for (N "1.5", then N "1.5000000000001") showed that the comparison behind the visibility wait, the identical-image rule and the taker's settle took doubles within a relative 1e-12 as equal. For that pair, a taker that took over a committed marker could settle at once on the pre-commit KV image while the commit was still staged, and then decide from it (its condition, its ADD base and its ALL_OLD came from 1.5). What stood between that taker and the staged change was only the order Couchbase gives its query transaction, which is Gap A (b) and is not tested. The comparison is now within 4 ulps (FLOAT_CLOSE_ULPS, at most about 8.9e-16 relative), one function for all three uses. The tolerance is 4 ulps, not zero, so a real change within it (N "1.0000000000000002" to N "1.0000000000000004", one ulp apart, both stored as native numbers) is still taken as unchanged, and the taker's settle can still pass on the pre-commit image for it, with the consequences described above: a condition on the number and ALL_OLD evaluated on the pre-commit image, and an ADD built on the old base, which can be lost only if the staged document's META().cas equals the KV cas, which no run has shown. An exact comparison is not a fix, because the query service and the KV may print the same double differently (a unit test of the repository records a normalisation of about 1.7e-16 relative; no run of ours saw it live), so the tolerance is precautionary and the residual stays OPEN (Gap A (b) and (e)). The change from 1e-12 to 4 ulps closes the defect for every change larger than 4 ulps, shown live (371 and 317 failed conditions on the old build, none on the new). The pair, about 450 ulps apart, is now an ordinary changed write; identical images keep committed. My earlier statement that the rule carried no loss of safety, because every pair the wait calls equal also keeps its lease committed, was wrong for the taker: that protection leaves a marker for the next writer whose item may still be staged. Unit tests: 361 passed, 365 with fault-hooks, at 100eeee, and 367 and 371 at aaaac8b. The two fault-hook tests that used the pair were rewritten at 1f48ec1 and passed at 30 s and 1 s there. A live probe of a taker meeting a staged item whose number changes by the pair shows the defect on the build before the fix and not after it: on that build (119b91f) the PutItem whose condition names the new value was refused with ConditionalCheckFailed 371 times and the DeleteItem 317 times, decided from the pre-commit image, and the ALL_OLD answers were wrong, while no ADD was lost (6 samples, an inference); on the fixed build 29 of 29 trackers were consistent at 1f48ec1 and 20 of 20 at aaaac8b. The yield is small (5 to 9 gate trials a run). I did not verify that the query service never prints a double with 15 significant digits; if it does, such a document stays unsettled and the taker hands the lease back, the safe side, and the constant has to be raised.
  • A single-item write's own transaction task ends its lease (found by reading the code after round 7, not by a test; fixed at aaaac8b). The RFC said that a request dropped by its client puts the marker back, which was true only of an escalated write. For a single-item write on a stream-enabled table that holds an ordinary lease, a client that timed out while the transaction ran left the lease committing until commit_by (50 s at the default txtimeout) even after a clean commit, because the code that recorded the outcome and released the lease was in the dropped request. Now the detached task that runs the transaction ends the lease for the outcome it knows, and a lost COMMIT answer still keeps it committing until commit_by, as your rule says. Residuals, all in the text: a task that dies silently (a panic) after its transaction started leaves the lease as it was, plain until exp, or committing once the pre-commit hook has marked it (covered by a unit test and by reading, not by a live panic test); a plain write that is not a stream-table write, dropped mid-write, leaves a plain lease until its exp; escalated writes and replace_at_cas rewrites now run detached, so a dropped escalated write commits and releases where before the drop cancelled it and restored the marker. The stream-table client-timeout test and the changed dropped-marker test pass at 30 s and at 5 s; the ambiguous-commit-after-a-drop test passes at 5 s only (its waits are written for a 5 s txtimeout, and at 1 s the held transaction would expire before COMMIT) and skips at 30 s and 1 s. In the RFC: "The takeover rule", the paragraph "A request dropped by its client does not decide the lease" (line 1394), and item (5) of "What the lease rules of revisions 8 and 9 cost" in Drawbacks (line 2865).
  • A second kill-harness run for line 1008, which follows only trials in which the probed item's own document is staged: 51 tracks, 51 of 51 met a staged own document at the first probe. The first run stays as a second run with its own setting (row 1008). The same harness was run again at aaaac8b (18 trials, 6 gate trials, 16 trackers, all consistent, no 5xx other than 503).
  • The stream reader is stated as a second user of assumption A1, with its wording made conditional on A1 (not tested; no code adds a margin). Its cost is now stated too: one transactional read per trimmed number, 64 per call, met only by a checkpoint older than the 24 h retention.
  • Clauses added, no change in behaviour: a Query on a CREATING index is not refused and can miss items (a difference from DynamoDB); a retry of the index pass rescans the whole table, so a hot item can hold the index CREATING indefinitely (from the code, not run); an UpdateTable holds the server's create lock through the index build and first backfill; and the restore heartbeat starts only after the target's CreateTable returns.
  • Assumption A3 (a transaction reported expired was rolled back) is written down beside A1 and A2, and "Operational requirements" asks for the old server to be stopped before the new one starts.
  • Scoping of what passed. The full three-node upstream suite, the lease driver, the absent-item test and test_transact_get_snapshot were last run at 389b8bc. The lease code changed after it, so they are not results for the tip; the runs that cover the changed code (the fault-hook file, the regression files, the SIGKILL test, the probes) are listed under "Testing". Regression at aaaac8b: 29 of 29 in 4 of 5 runs and 28 of 29 once, the failure being test_reindex_reconcile::test_conditional_delete_on_phone_edited_item ("stored document not found"); the same test failed once earlier at 119b91f, and the cause was not found. One 30 s client timeout in a test_txn_lease stream-table test, seen once at 1f48ec1, was not reproduced in 5 solo passes and 4 full runs at aaaac8b, and its cause was not found. The whole fault-hook file passed at the default txtimeout at aaaac8b (32 passed, 4 skipped); at 1 s: 31 passed, 1 failed (the known test_a_conflicting_transaction_in_the_commit_window_cancels_it_does_not_also_commit), 4 skipped (298 s, at ce16a55).
  • Smaller corrections: the main-relative figures (364 commits behind 1be10124), the 24 h wording in every place, the unit-test row, "Run G" defined at first use, the kill-harness account kept in one place, and the new costs in Drawbacks and open question 3.

What was not done, stated plainly: a real change of up to 4 ulps is still taken as unchanged by the comparison, and an exact comparison is not a fix, so that residual stays OPEN (Gap A (b) and (e)); a panic hook, a SIGTERM test, a test of a restore that fails twice and a live chained takeover are not written, so those two windows are closed by design and SIGKILL tested only; the control at 389b8bc was run for the second kill-harness run and not for the first; the full upstream suite on three nodes was not rerun after 389b8bc; the unknown-outcome rule has a unit test only; no live test makes the detached transaction task panic.

Inline comments, in your order

Line (rev 8) Verdict Revision-9 location What it is, and what was not verified
1001 FIXED; my round-6 answer on line 904 was wrong "The takeover rule", the stuck-unstaging paragraph (line 1106); the "Limits" paragraph of the TransactWriteItems text under "Transactions" (line 1753, the rule at line 1769) You are right, and my answer on 904 ("a token read that finds nothing is 'not committed' and releases") was wrong. The code did not release in that case, and it does not now; the RFC text at 1001 was incomplete. An ambiguous COMMIT WORK ends in one of three ways (ambiguous_lease_fate in engine.rs): a token with this request's fingerprint and every body visible releases the leases; the same token with a body not yet visible rewrites them committed; every other case keeps them committing, namely no ClientRequestToken, an absent token, a token of another fingerprint and a failed token read. The wording now says it once, and at both places: in every case but the first, the leases stay committing, no taker takes them over before commit_by (the mark plus txtimeout plus 15 s plus 5 s), and from commit_by a taker may. 8ec1983 puts the decision in a named function with a unit test (behaviour unchanged; 351 unit tests passed there). I dropped "known behaviour": this is read from the code and has a unit test only, because the test hook cannot make a token invisible, so no live test runs it. A retry with the same ClientRequestToken that is still waiting when token_wait ends (txtimeout plus 10 s, shorter than commit_by, which is txtimeout plus 20 s) answers TransactionConflict and releases nothing, since it holds no lease. While checking this rule against the code after round 7 I found one case that was not the rule: a client that times out on a single-item write to a stream-enabled table, with a clean commit, left the lease committing for 50 s. The rule says a lost COMMIT answer keeps the lease, not a client timeout; that case is fixed (the first section above, and Drawbacks item 5).
1008 FIXED (text, and two runs); Gap A (b) stays OPEN "The takeover rule", the stuck-unstaging paragraph (line 1124); "Limits" (line 1686); "DynamoDB Streams", "Writes onto the item of a gate trial" (line 2038, the one full account); item 15 Gap A (b) and (d) (line 2794); row 4.4 (line 2692) You are right that Run G (the gate run with cleanup off) produced the state, so the sentences that no run had produced a stuck unstaging are gone. The second kill-harness run follows only trials in which the probed item's own document is staged (harness e94c95f, three nodes, txtimeout 30 s, cleanup on): 51 tracks, 17 each of PutItem, UpdateItem with ADD and TransactWriteItems, and in 51 of 51 the first probe met the item's own staged document; writes were refused until a takeover of the committed marker acknowledged one, and after the unstaging (seen 23 to 522 s after the kill) 51 of 51 tracks were consistent, with no acknowledged write lost and no 5xx other than 503. The first run is kept with its own setting (119b91f, txtimeout 1 s, 10-put transactions): 120 trials, 21 gate trials, only one with the item's own document staged, and 12 answers of 500, of which 4 are unexplained and not reproduced. Limits: the lease log shows takeovers and ends but not KV writes, so the absence of an observed KV write onto a staged document is not a proof; the late bins rest on 3 or 4 trials; the probes use integer attributes, so the number-change defect has its own probe. The full account, the figures and the control run are in the RFC under "DynamoDB Streams", "Writes onto the item of a gate trial" (line 2038).
1353 FIXED (code and text); closed by design, SIGKILL tested "The takeover rule" (the paragraph "The taker's lease carries the marker", line 1161); "Limits of the round-6 code changes" (lines 1683 and 1684); item 15 Gap A (d) (line 2794); row 4.4 (line 2692); the status summary in the front matter (lines 3 to 51) You are right that the bullet already named the fix, and I built it as you asked: a taker's lease carries the original marker in a marker field, written in the same CAS that takes the marker over, and every writer treats an expired lease that carries a marker as that marker; a chain of takeovers keeps the original marker's exp. The process-death window and the restore that fails twice are closed by design; SIGKILL tested: the SIGKILL test passed at 30 s and 1 s at aaaac8b, and the whole fault-hook file passed at the default txtimeout there (32 passed, 0 failed, 4 skipped); at 1 s it gave 31 passed, 1 failed (the known 1 s-only test), 4 skipped (298 s, at ce16a55). A panic, a SIGTERM shutdown, a restore that fails twice and a live chained takeover are not tested. The guarantee holds only once every server runs the new code, so "Operational requirements" says to stop the old server first. What stays open is limit (iii) of Gap A (d): a taker's lease over a lapsed marker is protected for the larger of 60 s and its lifetime plus 30 s, then Couchbase expires it, together with the marker's expiry and the mixed fleet. The detail is in "The takeover rule" (the paragraph "The taker's lease carries the marker", line 1161) and in item 15, Gap A (d) (line 2794).
638 FIXED "Writes and conditional writes", "Bounds and answers" (lines 691 to 694); "Plain writes and transactions on one document", the plain-write bullet (line 1373) and the outcomes table (line 1515) The sentence now gives TransactionConflictException only for a committing lease whose txn is true or absent, and says that a committing lease that no client transaction holds ends the wait in 503, as change (C) and the 10 s rows already said.
935 (also 1003-1004, 1194, 1356 and row 4.4) FIXED "The takeover rule" (lines 1104 and 1182); the lease-state table (line 1517); "Limits" (line 1686); row 4.4 (line 2692); and the places that gave 24 h alone (the status summary, the backfill paragraph, item 15 (d) and item 5, row 2.4, row 4.5) The bound is stated as 24 h, and after that for as long as a writer touches the marker at least once every 60 s, because a restore keeps a lapsed marker for at least 60 s after each touch and never moves the marker's exp. Two sentences disagreed and are now one: a restore, or a chain of takeovers, never extends the marker's exp, while a clean commit that proves nothing writes a new marker with its own 24 h. The measured staged times (23 to 928 s with cleanup on) sit beside the bound; no run held an unstaging for the bound or kept writers arriving every 60 s for 24 h, so the bound itself is not tested.
1082 FIXED (text and code); your comment found a defect "Plain writes and transactions on one document", the paragraph on mutation actions that leave an image unchanged (lines 1255 to 1361, the defect at line 1280); "Corrections in revision 8" (B) (line 1620); item 15 Gap A (b) and (e) (line 2794); "Testing" You were right that the pair is a real change, and following it showed a worse problem than the one you named; see the first item above. The comparison is stated in one place (images_match: key order ignored, integers exact, doubles within 4 ulps; the idempotency token by its fingerprint and account_id), and the 4 ulps are a tolerance, not zero: a real change within them (N "1.0000000000000002" to N "1.0000000000000004") is still taken as unchanged, the taker's settle can still pass on the pre-commit image for it (a condition on the number and ALL_OLD evaluated on it; an ADD built on the old base can be lost only if the staged document's META().cas equals the KV cas, which no run has shown), and an exact comparison would not fix it, because the query service and the KV may print the same double differently (a unit test of the repository records a normalisation of about 1.7e-16 relative; no run of ours saw it), so this residual stays OPEN (Gap A (b) and (e)); the change from 1e-12 to 4 ulps closes the defect for every change larger than 4 ulps, used by the visibility wait, the identical-image rule and the taker's settle. The pair is now a changed write in both fault-hook tests that used it (test_identical_image_actions_in_a_transaction_keep_a_committed_lease: a Put of exactly the item's image keeps a committed lease, the pair as a Put in the same TransactWriteItems releases it and the new value is read back; and the single-item stream-table test), rewritten at 1f48ec1; both passed at 30 s and 1 s at 1f48ec1, and the whole file passed at 30 s at aaaac8b. Not verified: item_unstaged itself is async over a live connection and is covered through its comparison, not called in a unit test; the live probe of the settle is described in the first item above (29 of 29 trackers consistent at 1f48ec1, 20 of 20 at aaaac8b, and the defect seen on the earlier build).
2363 FIXED Engineering item 15, Gap A (e) (line 2794) The sentence now cites the C++ SDK error-handling page, its section on transaction_result.unstaging_complete: the flag "indicates whether all documents were able to be unstaged (committed)", and "For most use-cases it is not an issue if it is false" (both quoted from the page). So the SDK can report a success with the flag false, and the premise that COMMIT WORK answers only after the unstaging is still not from Couchbase's documentation. The wording "reviewer's reading" is gone.
984 FIXED "The takeover rule", assumption A2 (lines 1068 to 1091, the page quoted at line 1082); "Operational requirements", the "Clocks" bullet (line 2312) The transactions page says, under Deployment Considerations, "Use of transactions requires Network Time Protocol (NTP) to be used to synchronize time across all cluster-nodes." The text cites it and says what it covers: the cluster nodes. A2 is about the clock of the ExtendDB server that writes and compares commit_by, and that host is not a cluster node, so the page does not cover it. "Operational requirements" now names the ExtendDB server hosts: synchronised by NTP, with the clock not stepping forward by more than the 5 s margin between the mark and the check. That 5 s is the margin A2 allows, not a guard in the code; the only clock guard I found is the TTL sweeper leader's 60 s check against cluster time. Not verified: that the reference deployment's hosts run NTP.
962 (and 1202) FIXED "The takeover rule", the list of takers (line 1050); the outcomes table, the key-that-does-not-exist row; "Corrections in revision 8" (A) (line 1597); "Time to Live" (line 2090) The TTL sweeper is named in all of those lists. It deletes expired items through the normal delete path, so it takes the item's lease and treats a marker as a plain write or a stream-table write does; a delete that fails to settle is logged and left for the next cycle. Read from the code (ttl_worker.rs calls the engine's delete_item; I found no sweeper bypass); not run against a marker.
2124 FIXED "Testing", "Runs behind revision 7" (line 2510) The sentence is scoped to the revision-7 code, the OPEN mark is gone, and it points at the 389b8bc row, where the full suite on three nodes is reported. That row stands for the backend as of 389b8bc; the suite was not rerun after it, and "Testing" says so, with the lease driver, the absent-item test and test_transact_get_snapshot.
2281 (and the parity row at 2130) FIXED Row 6.3 (line 2712); the parity row in "Testing" (line 2516) Row 6.3 now says that every conformance figure names its suite revision or says that it was not recorded; the summary and the Evidence list say the same. The parity row names the pin 7b828b0; I assumed the parity suite is the one at that pin, as the row beside it says for the upstream files, and the run did not record it, so the pin in the row is my assumption: tell me if you know otherwise.
1673 FIXED "DynamoDB Streams", the paragraph on the reader of Run G (lines 2021 and 2022) There is no such rule. The Rust reader (contiguous_prefix, resolve_aged_gaps, stream_gap_grace in engine.rs) waits txtimeout plus 15 s before it resolves a gap; the only "1 s" is the harness's txtimeout (so the grace was 16 s, as the 16.0 to 16.4 s says) and a test fixture. I dropped the clause and kept the sentence after the colon: no number was skipped without a transactional hit. Reading the reader again for this revision, I found that the sentence "a record that commits late is still delivered, exactly once" was unconditional; it is now conditional on A1, and the reader is named as a second user of A1 (line 1899).
165 and 1687 FIXED The reference-repository summary (lines 191 and 192); "DynamoDB Streams" (line 2035); row 5.2 (line 2700) d0dc673 is named beside b66f6c7 in all three places: d0dc673 moved the directory to scripts/commit-point-gate/, b66f6c7 renamed the content (names, variables, README), and the backend code is not changed by those two commits.

Review body

  • Line 909, the four windows. Two are closed by design in the revision-9 code: a server process that dies, a runtime that shuts down or a panic between a taker's takeover and its own committing mark (SIGKILL tested; a panic and a SIGTERM shutdown not tested), and a restore that fails twice (not tested live). Two stay open: the expiry of a marker (24 h, and after that for as long as a writer touches it at least once every 60 s, together with the expiry of a taker's lease over a lapsed marker, at least 60 s), and a mixed fleet (which with one server per catalog arises only in an overlap of an old and a new process, and is now an operational requirement).
  • Rows that stay OPEN until a reviewer has read the reference repository (2.4, 3.5, 4.1, 4.3, 5.2, 6.2), and line 28 (the invitation): unchanged. The read invitation sent on 2026-12-01 is still pending as of 2026-12-03; I will send another if it lapses.
  • Title: changed to docs(rfc): Couchbase storage backend.
  • The commit-point gate is the run you described. Its results stand as reported; the probes of staged items are under 1008.
  • The FIXED-CODE answers of the round-6 reply can only be checked in the repository, as you note. Revision 9 adds answers of that kind under 1353 (the taker's lease carries the marker) and 1082 (the comparison within 4 ulps), and the test runs under 1008.

…g taken has no guard)

The text said a request dropped before its first transaction ends the lease.
That holds only once the lease is taken: the drop guard is created after the
lease write returns, so a request dropped while that write is in flight leaves
the lease for its full life (50 s at the default txtimeout). Stated as an open
residual in the takeover rule, Drawbacks (5) and the status lines; no line
numbers move.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, a correction to my reply above, in the text only. The RFC head is now 06681217 (it was 61f1df56); the commit changes 8 lines and no line numbers move, so the line numbers in my table are still those of the file.

The revision-9 text says a request dropped by its client ends the lease when no transaction is in flight ("the request died before its first transaction"). That holds only once the lease has been taken. The drop guard is created after the lease write returns, so a request dropped while that write is in flight leaves the lease for its full life, 50 s at the default txtimeout, and a following writer waits 10 s and answers 503 until it lapses (a lease that took a marker over carries the marker, so no marker is lost). This window has no test and is open. The text now says so in "The takeover rule", in Drawbacks item (5) and in the status lines, and the PR and issue descriptions say the same. Nothing else changes: the other windows of the lease end in the task are as described in my reply.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 9, and for the answer to each comment. I read the RFC at 61f1df5 against main at b3510a9, then your correction at 0668121. The correction changes 8 lines and moves none of the lines below. It names an open window: a request dropped while its lease write is in flight. The takeover rule, Drawbacks item (5) and the status lines now state that window, as your comment says.

The three conditions of round 7 are met:

  • Line 1001: every unknown outcome now keeps the leases committing until commit_by. Only a token with this request's fingerprint proves that the commit point passed.
  • Line 1008: the RFC now gives the measured staged times. The kill harness sent a PutItem, an ADD and a TransactWriteItems to items whose own document was still staged, and 51 of 51 tracks were consistent.
  • Line 1353: the taker's lease now carries the original marker, written in the same CAS that takes the marker over.

Revision 9 also resolves the comments on lines 638, 935, 1082, 2363, 984, 962, 2124, 2281, 1673 and 165. The new title passes main's title check.

One change before I approve: the 4-ulp comparison on line 1299. With it, the taker's settle can still pass on the pre-commit image. The reason given for keeping a tolerance doesn't hold against line 1344. The other inline comments are smaller corrections.

The description and your answer put the 4-ulp residual in Gap A (b) and (e). Row 4.4 and item 15 say that (e) is closed, and they put the residual under (b). The revision 8 section of the description also calls (e) closed. Please make the three agree. The RFC's version, (b) only, reads right to me.

The code answers are still in the reference repository, which I can't read yet. So rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay open, as the RFC says.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
statement of revisions 8 and 9 that this carried no loss of safety, because every
pair the wait calls equal also keeps its lease `committed`, was wrong for the
taker: that protection hands the next writer a `committed` marker whose item may
still be staged, and the settle, with the same tolerance, could not tell. The tolerance is 4 ulps (`FLOAT_CLOSE_ULPS`, at most about 8.9e-16 relative), not zero, so a real change within it is still taken as unchanged: N `"1.0000000000000002"` to N `"1.0000000000000004"` are two valid DynamoDB numbers one ulp apart, both stored as native numbers because both round-trip through f64, and `images_match` calls them equal. For such a change the taker's settle can still pass on the pre-commit image, with the consequences described above: a condition on the number and `ALL_OLD` evaluated on the pre-commit image, and an `ADD` built on the old base, which can be lost only if the staged document's `META().cas` equals the KV cas, which no run has shown. It cannot be removed by comparing exactly, because the query service and the KV may print the same double differently (a unit test of the repository records a normalisation of about 1.7e-16 relative; no run of ours saw it live), so the tolerance is precautionary and the residual is **OPEN** (Gap A (b); it also bears on the identical-image rule of (e), which is closed for exactly identical images). The change from 1e-12 to 4 ulps closes the defect for every change larger than 4 ulps, shown live: 371 and 317 failed conditions on the old build, none on the new. What

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With 4 ulps, a real change within the tolerance still lets the taker's settle pass on the pre-commit image. A condition, ALL_OLD and an ADD base can then come from the state the commit replaced. That is the failure the probe on 119b91f measured. The reason given for keeping a tolerance is a normalisation seen only in a unit test. And line 1344 already calls a document that stays unsettled the safe side. Please measure whether a KV read and the query service ever give a stored double different bits. Use values such as 1.0000000000000002, 5e-324 and 1.7976931348623157e308. If they don't, please compare exactly in item_unstaged, and keep images_match for the wait and the identical-image rule. If they do, please say how Query, Scan and TransactGetItems keep the exact numbers of row 1.3. All three read through the query service.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
unstaging. On the revision-8 code a single-node run (`durability = none`)
found the `committed` marker still present 35 s after it was written, the
next `PutItem` taking it over and running as a query transaction, and the
lease cleared afterwards `[ref-repo]`. The overwrite itself is not reachable

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 7 asked to change this sentence as well as the one at line 1124, and it's unchanged. The kill harness now holds an item's own document staged (line 2040), and item 15 (d) calls it such a harness. Please say that here. Also say that the overwrite needs one of three open cases, and that no run produced any of them. The cases are a marker that expired, an expired taker's lease over a lapsed marker, and a mixed fleet.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
| 4.1 | Unconditional writes never fail under contention | A bare unconditional `PutItem` with no `ReturnValues` takes the item's lease (a KV insert), makes one KV write and removes the lease (a read and a CAS remove): there is no CAS on the item and no retry of the write itself, and the last writer wins. **This differs from RFC-0003 4.1**, which says: "Two concurrent unconditional `PutItem` calls on the same key must both succeed (last-writer-wins semantics). The backend must not surface internal concurrency-control mechanisms (e.g., WriteConflict, version mismatches) as client-visible errors for unconditional single-item writes." (`docs/rfcs/0003-backend-acceptance-criteria.md` on `main`.) The 503 and the `TransactionConflictException` below are the lease, which is a concurrency-control mechanism of this backend surfaced to the client on an unconditional write, so they differ from that sentence, in three cases. (1) Between plain writes on a table without a stream: the second waits on the first's lease with jittered backoff and answers 503 at the end of a 10 s bound; the lease is held for one KV write, so in practice two racing calls both succeed, and one fails only if the other holds the item for more than 10 s; a plain write that crashed leaves its lease until it expires (30 s), and writes to that key can answer 503 until then. An escalated plain write, which takes over a `committed` lease or a `committing` lease past its `commit_by` and runs as a query-service transaction on any table, holds the lease across that transaction, not for one KV write, and a plain write that waits on it meets the same 10 s bound. (2) On a stream-enabled table the lease spans a query-service transaction (up to `txtimeout` plus 20 s): the same 10 s bound and 503 apply to a writer that waits on it, and a crashed holder blocks its key for that long. (3) After a `COMMIT WORK` of a client `TransactWriteItems` whose outcome is unknown, writes to the item's keys answer `TransactionConflictException` (a plain write, after 10 s) or cancel with `TransactionConflict` (a `TransactWriteItems`, after 2 s) for up to `commit_by`, 50 s at the default `txtimeout`; after the unknown outcome of a single-item write on a stream-enabled table or of an escalated write, a plain write answers 503 after 10 s and a `TransactWriteItems` cancels after 2 s, for the same time. All three are recorded in the `docs/differences-from-dynamodb.md` rows that the implementation PR adds (`main` has no Couchbase entry yet). A fourth point belongs to row 4.3 as well: a stream-table write and an escalated write mark their own lease `committing` before `COMMIT WORK`. In the code behind revision 7 the lease did not record whether a client `TransactWriteItems` or such a write holds it, so a second `PutItem` that met it and was still waiting at 10 s answered `TransactionConflictException` although no transaction held the item, a divergence from 4.1 and from the sentence of row 4.3 that plain-writer contention never surfaces as a transaction conflict. In the revision-8 code the lease records it (`txn`), and that second `PutItem` answers 503 at 10 s; a client transaction's own `committing` lease still gives `TransactionConflictException` (case 3), and a lease with no `txn` field, written by an older binary, is read as a transaction's. Sharing the lease between plain writers, so that only a transaction excludes them, is the alternative; it is a follow-up if the reviewers prefer it. What a plain write answers when it meets a transaction's lease is under "Transactions". With `ALL_OLD` it is a CAS loop of 64 attempts / 10 s that answers 503 at exhaustion, as MongoDB does; no CAS detail is client-visible (`cas_contended`) | **OPEN** until a reviewer reads the reference repository. The tests that race bare puts on one key are in upstream `test_put_item_create_race.py` (8 writers, 15 rounds, every put must succeed): `::test_racing_puts_on_a_gsi_table_leave_only_the_final_entry`, `::test_racing_puts_on_an_lsi_table_leave_only_the_final_entry` and `::test_racing_puts_on_a_stream_table_all_succeed`, with `::test_racing_puts_with_all_old_all_succeed` for the `ALL_OLD` loop. Recorded run: the file 9 passed at the pin `7b828b0`, single-node demo stack, durability none `[ref-repo]` (a second run, 9 passed). `test_concurrency.py::test_parallel_inserts` is not evidence here (its threads write distinct keys), and `TestAtomicCounter::test_atomic_counter`, which passed 1 of 1 on the same run, belongs to row 4.4. No test drives two plain writers into the 10 s bound or a crashed lease. After a `COMMIT WORK` whose outcome is unknown, writes to its keys are unavailable until `commit_by` (50 s at the default `txtimeout`): a plain write answers `TransactionConflictException` after 10 s when a client transaction holds the lease and 503 when it does not, a `TransactWriteItems` cancels after 2 s (see "The takeover rule"). On the revision-8 code, `tests/test_fault_hooks.py` `[ref-repo]` (single node) holds a stream-table put at its commit and shows the second `PutItem` answering 503 after about 10 s, a held escalated put giving 503, a held client `TransactWriteItems` giving `TransactionConflictException`, and a lease with its `txn` field removed giving `TransactionConflictException`. CR-03 `[ref-repo]` |
| 4.2 | Conditional writes: correct error on race | The CAS loop re-evaluates the condition against the winner's image and returns `ConditionalCheckFailedException` | CC-01, upstream `test_put_item_create_race.py::test_racing_puts_check_their_condition_against_the_winner`, `::test_racing_conditional_creates_have_one_winner` |
| 4.3 | Transaction conflict mapping | A plain write meeting a `transact_write` lease returns `TransactionConflictException`, and so does one that waits out its 10 s bound behind a `committing` lease that a client transaction holds, before its `commit_by`; a transaction that meets a foreign `transact_write` lease, or cannot take its other leases in 2 s, returns `TransactionCanceledException` with `TransactionConflict` on the contended item only; a plain write meeting a `transact_get` or `plain` lease retries and answers 503 at its 10 s bound; plain-writer contention does not surface as a transaction conflict: a stream-table or escalated write marks its own lease `committing` before `COMMIT WORK` with `txn` false, so a second `PutItem` that waits out 10 s behind it answers 503, and a lease with no `txn` field (written by an older binary) is read as a transaction's (the revision-8 code; the code behind revision 7 answered `TransactionConflictException` there, see row 4.1) (implemented `[ref-repo]`; see "Transactions") | **OPEN** until a reviewer reads the reference repository. TX-08 `[ref-repo]`, CC-09 `[ref-repo]`, upstream `test_transact_write_conflict.py`, upstream `test_transact_absent_item_isolation.py` (the test that caught the write skew; suite at the pin `7b828b0`, 5 of 5 tests in 10 runs on three nodes; its target for the port is 6 of 6 on `main`, not run), `scripts/write-race-test.py` `[ref-repo]`, `tests/test_txn_lease.py` `[ref-repo]`, `tests/test_fault_hooks.py` `[ref-repo]` (the `txn` cases, single node), the three-node harness's commit-point hold `[ref-repo]` |
| 4.4 | UpdateItem serializes | CAS read-modify-write with jittered backoff; arithmetic and `ADD` never take the sub-document path; on a stream-enabled table each write is a transaction that holds the item's lease, so two on one key do not meet at the document: the second waits on the lease and writes after the first releases it, and both succeed; the first keeps its lease until its commit is visible to a KV read (`bf67ee2` `[ref-repo]`; revision 6 left this row OPEN in part because three commit paths released without that wait), and the paths that can still conflict at the document are listed under "DynamoDB Streams". **OPEN** in part (Gap A, engineering item 15): (b) the ordering of a takeover's query-service transaction after a committed one is untested, and every taker now relies on it (observed, not tested: the second kill-harness run followed 51 tracks whose item's own document was staged, 31 acknowledged writes by takeover, all 51 consistent; "DynamoDB Streams", "Writes onto the item of a gate trial"); (d) a plain write can still be overwritten by Couchbase's cleanup, so an acknowledged `UpdateItem` could be lost, which RFC-0003 4.4 rules out (a backend "must not return errors to the client for contention that DynamoDB handles transparently, nor silently discard a committed write"), but only in three cases: a marker that has reached its expiry (24 h, extended while a writer touches it at least once every 60 s) with unstaging still pending, the expiry of a taker's lease that carries a lapsed marker (at least 60 s) with unstaging still pending, and a mixed fleet; the two more of revision 8, a process death between a takeover and the taker's own `committing` mark and a restore that fails twice, are closed by design in the revision-9 code by the taker's lease carrying the marker (SIGKILL tested live; a panic, a SIGTERM shutdown and a restore that fails twice not tested) (the revision-7 route, a `committed` lease lapsing after 30 s, is closed in the revision-8 code, at the cost of refusing writers for 24 h, and after that for as long as a writer touches the marker at least once every 60 s while an unstaging is stuck; measured with cleanup on, the documents stayed staged for 23 to 522 s at a `txtimeout` of 30 s and 42 to 928 s, median 222 s, at 1 s); (e), a `ConditionCheck` item's lease deleted after a clean commit with no check, is closed in the revision-8 code. No acknowledged write was lost in a run, the kill-harness probes included (writes that were applied and answered 500, 2 of the first run's 12, were not acknowledged and are listed under "Writes onto the item of a gate trial") | CC-02, CC-03, `scripts/concurrency-property-test.py` (`prop_add_counter`, `prop_optlock_counter`), upstream `test_concurrency.py::TestAtomicCounter::test_atomic_counter` |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the second kill-harness run, every acknowledged takeover wrote after its document unstaged. Line 2040 says "after each, the probed document was no longer staged". The settle compares integers and strings exactly, so it waited for the unstaging. The run therefore shows the refusal and the settle, and a broken write-write ordering would pass it too. Please say so here and in item 15 (b), and cite the 6 ADD samples on 119b91f for the ordering. Please also add a track whose kill transaction holds a ConditionCheck or an identical-image Put on the probed item. Then the taker's transaction meets a staged document, which is the case (b) is about.

Also on this row, "extended while a writer touches it" reads as if the marker's exp moves. The takeover rule says that the exp never moves, and that each touch keeps the lapsed marker for another 60 s. Please use its wording here.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
lease, and the first request's leases stay `committing` until `commit_by`.
That is read from the code (`engine.rs`: `ambiguous_lease_fate`,
`takeover_allowed`, `commit_by_ms`); the decision has a unit test only, and no
live test runs it, because the test hook cannot make a token invisible. So a stuck unstaging blocks every writer of the item, the plain

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason given here covers only the cases that have a token. A TransactWriteItems with no ClientRequestToken has no token to hide. So a lost COMMIT WORK answer, like the one the single-item test injects (line 1440), would run this rule live. Please add that case, and check that a plain write waits until commit_by and that a second transaction cancels. Otherwise, please say that the unit test is the only cover for it too.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
says `CREATING`, but it does not change what a `Query` answers. This is a
difference from DynamoDB, and a row for it goes into
`docs/differences-from-dynamodb.md` with the implementation PR; the fix (read
the row's `IndexStatus` on an index `Query`) is not made. Only `Query` was

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DynamoDB refuses a Scan of a CREATING index as well as a Query. The developer guide's page on managing global secondary indexes says "You can't Query or Scan the index until it is ACTIVE". Please check the index Scan path, and put both operations in the planned row. main already has the service's wording, measured for a vector index. It is VECTOR_INDEX_BACKFILLING_SCAN_PREFIX in crates/core/src/types/table.rs: "Cannot read from backfilling global secondary index: ".

second writer still waiting after 3 s; and an old-format lapsed lease that is
cleared as before. The whole file passed (31 passed, 3 skipped at the default
`txtimeout`; 32 passed, 1 failed, 1 skipped at 1 s, the failure being the known
test that fails at that setting). One test kills the server with SIGKILL at the pause

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With a marker that has 24 h left, this test would still pass if the taker's document got only the lease's lifetime plus 30 s. That holds as long as the restart and the next write come within that time. Please start the next writer only after both the lease's lifetime plus 30 s and 60 s pass. Then check that the taker's document is still there with its marker field.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
| # | Criterion | How the backend meets it | Evidence |
|---|---|---|---|
| 5.1 | Atomicity with data writes | Records are written in the data transaction | ST-04, upstream `test_streams.py` |
| 5.2 | Per-shard ordering | Numbers are taken before commit; `GetRecords` walks the shard in sequence order and stops at an unresolved number, which only a skip marker written after a definite failure, or a transactional read of the record after the age, resolves (see "DynamoDB Streams"), designed so that no reader passes a number whose record may still appear (implemented; the freeze hold that tests it ran twice and its gate failed both times, with 0 records resolved by a transactional read; a later run that killed the coordinating query engine with query cleanup off reached the gate in 24 of 200 trials, and 101 of the 102 `stream gap` lines in its backend log are records resolved by a transactional read; one three-node cluster, 1 s `txtimeout`, 10-put transactions; see "DynamoDB Streams") | **OPEN** until a reviewer reads the reference repository, and for the commit-point hold: its freeze runs failed the gate both times, and the run that reached it is one harness on one cluster whose harness is in the repository (`scripts/commit-point-gate/`, added in `1c44cc6` and renamed in `d0dc673` and `b66f6c7` `[ref-repo]`) only as a copy that was not rerun (see "DynamoDB Streams"). ST-03, DC-07 `[ref-repo]`, upstream `test_streams.py`; RFC-0003's stress scenario "consumer reading during concurrent writes" (RFC-0003:160, not a test in `upstream/tests/`) is covered only for gaps, by the stream reader of `scripts/txn-commitpoint-test.py` `[ref-repo]` (the three-node harness's commit-point hold: a query engine frozen 60 s, longer than the age); event types and cross-table leakage under concurrent writes are not yet tested |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 1898-1908 now make the reader's no-skip guarantee depend on A1. They say that if A1 fails, an iterator can step over a number whose record commits later. This row and the Streams row of the design summary (line 2416) still state the guarantee without that condition. Please add "under assumption A1 (not tested, engineering item 1)" in both places.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
taker: that protection hands the next writer a `committed` marker whose item may
still be staged, and the settle, with the same tolerance, could not tell. The tolerance is 4 ulps (`FLOAT_CLOSE_ULPS`, at most about 8.9e-16 relative), not zero, so a real change within it is still taken as unchanged: N `"1.0000000000000002"` to N `"1.0000000000000004"` are two valid DynamoDB numbers one ulp apart, both stored as native numbers because both round-trip through f64, and `images_match` calls them equal. For such a change the taker's settle can still pass on the pre-commit image, with the consequences described above: a condition on the number and `ALL_OLD` evaluated on the pre-commit image, and an `ADD` built on the old base, which can be lost only if the staged document's `META().cas` equals the KV cas, which no run has shown. It cannot be removed by comparing exactly, because the query service and the KV may print the same double differently (a unit test of the repository records a normalisation of about 1.7e-16 relative; no run of ours saw it live), so the tolerance is precautionary and the residual is **OPEN** (Gap A (b); it also bears on the identical-image rule of (e), which is closed for exactly identical images). The change from 1e-12 to 4 ulps closes the defect for every change larger than 4 ulps, shown live: 371 and 317 failed conditions on the old build, none on the new. What
tests it: unit tests, 361 passed at `100eeee` and 367 at `aaaac8b` (365 and 371 with `fault-hooks`;
`a_change_of_300_ulps_is_not_equivalent` checks that `images_match`, the settle's

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the test's name says 300 ulps, but the pair at line 1283 is about 450 ulps apart. Please say which pair the test uses.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
| 5.2 | Per-shard ordering | Numbers are taken before commit; `GetRecords` walks the shard in sequence order and stops at an unresolved number, which only a skip marker written after a definite failure, or a transactional read of the record after the age, resolves (see "DynamoDB Streams"), designed so that no reader passes a number whose record may still appear (implemented; the freeze hold that tests it ran twice and its gate failed both times, with 0 records resolved by a transactional read; a later run that killed the coordinating query engine with query cleanup off reached the gate in 24 of 200 trials, and 101 of the 102 `stream gap` lines in its backend log are records resolved by a transactional read; one three-node cluster, 1 s `txtimeout`, 10-put transactions; see "DynamoDB Streams") | **OPEN** until a reviewer reads the reference repository, and for the commit-point hold: its freeze runs failed the gate both times, and the run that reached it is one harness on one cluster whose harness is in the repository (`scripts/commit-point-gate/`, added in `1c44cc6` and renamed in `d0dc673` and `b66f6c7` `[ref-repo]`) only as a copy that was not rerun (see "DynamoDB Streams"). ST-03, DC-07 `[ref-repo]`, upstream `test_streams.py`; RFC-0003's stress scenario "consumer reading during concurrent writes" (RFC-0003:160, not a test in `upstream/tests/`) is covered only for gaps, by the stream reader of `scripts/txn-commitpoint-test.py` `[ref-repo]` (the three-node harness's commit-point hold: a query engine frozen 60 s, longer than the age); event types and cross-table leakage under concurrent writes are not yet tested |
| 5.3 | Account and table isolation | Shard id embeds the table id; records carry the table id and every read is scoped by it | upstream `test_cross_account_isolation.py` (one case in this file failed in the nightly baseline for a test-suite-skew reason, see 6.3; it passes against the pinned suite), `test_stream_table_reuse.py` |
| 5.4 | Correct event types | `INSERT` / `MODIFY` / `REMOVE` with images per view type; an unchanged item emits no record | ST-01, ST-05, upstream `test_streams.py` |
| 5.5 | Retention and cleanup | `idx_stream_ts` plus a delete at 2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: since the task ends the lease, the client's timeout no longer matters here. A lost COMMIT answer keeps the lease committing until commit_by either way, so please say it that way.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

**Writes onto the item of a gate trial** (the round-7 review's request on the takeover rule; Gap A (b)). This is the one full account of two kill-harness runs and a short third one at `aaaac8b`; the other places in this RFC point here. The first two ran the lease and takeover rules of the revision-9 branch before the comparison fix (the backend as of `493242d`, fault-hooks image) `[ref-repo]` on three nodes, `durability = majority`, with query cleanup on throughout (`queryCleanupLostAttempts` and `queryCleanupClientAttempts` true, never changed) and one table per trial. A trial is one `TransactWriteItems` on a fresh stream-enabled table; the coordinating query engine is killed with SIGKILL just after the first document of the transaction is visible by KV (Run G's trigger, with a shorter delay); a tracker then probes items of that transaction while its documents are staged, one kind of write per track (`PutItem`, `UpdateItem` `ADD cnt 1000`, or a `TransactWriteItems` of an `Update` on the item and a `Put` of a fresh key), every 1 to 2 s until the unstaging is complete, and records for each probe the time since the kill, the answer, the lease before and after, and the item by KV read and by transactional read.

*Second run, the one that tests a write onto a staged item document.* Harness `e94c95f` `[ref-repo]`, 40 puts per transaction, `txtimeout` 30 s (a 40-put transaction takes 20 to 25 s and does not fit a `txtimeout` of 1 s). Right after the kill the harness classifies every key of the transaction (a transactional read returns the transaction's value and a KV read does not) and follows only trials with at least one such key, up to three distinct staged keys per trial, one per write kind. In 66 trials, all 66 writers answered ok and 19 trials (29%) had an item document of their own staged; they gave 51 tracks, 17 each of `PutItem`, `ADD` and `TransactWriteItems`, and in 51 of 51 the first probe, 0.05 to 0.08 s after the kill, met the item's own staged document (staged was read just before the probe, tens of milliseconds earlier). Answers over time: the first probe of a `PutItem` or `ADD` track answered `TransactionConflictException` after 10 s (the original writer's `committing` lease) and the first of a `TransactWriteItems` track was cancelled after 2 s; later probes answered 503 (`PutItem`, `ADD`; each is the documented warning "the item's last transaction is committed but not yet visible" in the backend log) or were cancelled (`TransactWriteItems`) until a takeover of the `committed` marker acknowledged one. 12 `PutItem`, 11 `ADD` and 8 `TransactWriteItems` probes were acknowledged that way while the document had been staged just before (0.3 to 1.9 s each); after each, the probed document was no longer staged, and the backend log shows `lease takeover op=committed` followed by `lease end ... Release` for each, and no `Keep` or `Restore`. The unstaging of the kill transaction was seen complete 23 to 522 s after the kill (17 trials). After it, 51 of 51 tracks were consistent (`PutItem` left the last acknowledged value; `ADD` kept the transaction's value with a count of 1000 times the acknowledgements; `TransactWriteItems` kept its values and the fresh key), no acknowledged write was lost, no value of the transaction was overwritten, no acknowledged probe was followed by a state in which the transactional read differed from the KV read, no probe answered a status other than 200, 400 (conflict or cancelled) or 503, and the backend log of the window has no ERROR line. A control with the same harness and parameters on the revision-8 backend at `389b8bc` (release build with fault hooks, own container) gave the same: 17 trials, 7 with a staged item document, 21 tracks, 21 of 21 consistent. The kills still landed 4 to 46 ms (median 7 ms) after the first visible document, no earlier than in Run G, so the yield comes from the transaction size, not from the kill offset. Limits of this run: the backend log shows takeovers and ends but not KV operations, so the absence of any KV write onto a staged document is an absence of observation and not a proof; the late time bins (120 s and after) rest on 3 or 4 trials; at most 9 trackers ran at once; and the numbers probed are integers and strings, so a change smaller than the old float tolerance is in neither run.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: 19 trials had a staged document of their own, but the RFC gives the unstaging time for 17. Please say what happened in the other two. Row 4.4 and Drawbacks quote "23 to 522 s" as the measured range.

…)/(b) residual, kill-harness runs, cancel-safe lease acquisition)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, thank you for round 8. Revision 10 is pushed to this PR (head 98604456). The code behind it is the branch fix/round9-push of the reference repository, on top of fix/round7-push (pushed 2026-12-03): the backend code is cdf2b37, the branch tip is fb97722. Your line numbers are those of the RFC as pushed for revision 9, and the table follows your order; the revision-10 lines are those of the RFC file at the head sha above, with the section names beside them.

What changed, in the code at cdf2b37 and in the text:

  • The taker's settle compares exactly (your comment on line 1299; the measurement and the answer to your question are in the table row for 1299). item_unstaged now compares exactly (exact_images_match), and images_match with its 4 ulps stays in the visibility wait and the identical-image rule, which compare the backend's own document. A real change within 4 ulps now keeps the lease committed and the next taker's settle waits for the unstaging (2 s, then 503, cancel or skip); live at cdf2b37: 253 probes met the staged own document, 6 were acknowledged after the unstaging, 247 refused, none computed on the pre-commit image, and a 17-digit-double cycle was consistent (20 trackers). The 4-ulp residual is gone for that settle, on parsed f64. What stays open, smaller and not closed: the number form a second transaction reads from a committed document that is still staged (row 1299).
  • The new track (line 2692). A ConditionCheck and an identical-image Put on the probed item stage nothing that any read shows (an inference from the 25 ms acknowledgement, not proof); no taker met a staged document of those items by that route, so they do not exercise (b). The one-ulp Put does leave the item's own document staged under the old tolerance: at aaaac8b 142 probes met it, 7 were acknowledged, each after the document unstaged, 135 were refused, 0 lost. That shows the refusal, not the ordering; at cdf2b37 the exact settle masks the case.
  • Lease acquisition is cancel-safe. The correction comment of 2026-12-03 said a request dropped while its lease is taken was open. It is fixed (93d2a4d) and tested at cdf2b37: a guard around each lease write has a spawned task remove OUR plain lease by id, or put the carried marker back. On a build with the guard disabled both acquisition tests fail. Residuals: the cleanup tries twice with no backoff and then lets the lease lapse (a KV outage that caused the ambiguous error also defeats it); it is skipped if no runtime handle is available (shutdown); "up to 50 s" is for a stream-table lease, a plain KV write's lease is 30 s.
  • Runs. Full upstream suite at 9843eeb (backend behaviour that of aaaac8b; 918acb6 between them changes two comment lines, in conn.rs and engine.rs): 1248 passed, 41 failed (the baseline groups of the 389b8bc run exactly), 16 skipped, 1 xfailed; and the same suite at fb97722 (backend code identical to cdf2b37; release image, three nodes, 30 s, the same chunks): 1248 passed, 41 failed, 16 skipped, 1 xfailed, 0 differences in status against the 9843eeb run test id by test id (1306 ids), so the two runs match exactly (caveats: the bucket was deleted and recreated before the run, the in-repo Rust tests were not part of it, and it covers what the suite covers, not the kill-harness windows). At cdf2b37: fault-hook file 35 passed, 0 failed, 3 skipped at 30 s, at 1 s 1 failed, 33 passed, 4 skipped; the failure is the long-standing test_a_conflicting_transaction_in_the_commit_window_cancels_it_does_not_also_commit, cause not established (the held transaction answers ServiceUnavailable after its release where the test expects ok; a hold longer than a 1 s txtimeout is the likeliest reason, not confirmed); regression 29 of 29 on the second run (the first failed during a Couchbase query-service authorization outage, code 2120; I attribute it to the outage, and the rerun was clean); probes consistent, with one 500 in the identical-image rerun (C, PutItem, trial 5, 23.9 s after the kill: commit outcome unknown, not retried: query-txn POST failed, with the kill of another trial's query node 7.4 s into the probe; counted with the other 500s, the final state was consistent); unit tests at fb97722 (backend code cdf2b37) 370 passed, 374 with fault-hooks ("Runs at cdf2b37", line 2764).

Inline comments, in your order

Line (rev 9) Verdict Revision-10 location What it is, and what was not verified
1299 FIXED (by measurement); the staged number form stays open "Plain writes and transactions on one document", the settle, its precondition, the measurement and "What a real change within 4 ulps does now" (lines 1381 to 1387); "Limits of the round-6 code changes" (line 1815) Exact comparison in item_unstaged, as you asked. Measurement (Couchbase 8.0.0, committed unstaged documents): 350 raw documents (including 1.0000000000000002, 5e-324, 1.7976931348623157e308, subnormals, odd tokens), 442 documents written through the API and 140 staged writes read after their commit: 0 differences in bits or tokens between a KV read and a whole-document read through the query service; only -0.0 reads as 0. Your question, how Query, Scan and TransactGetItems keep row 1.3's exact numbers: by path, GetItem, Scan and TransactGetItems 442 of 442 documents; Query 261 (all 221 of the plain table, 40 of the 221 of the stream table); the read of a ConditionCheck 120 (60 per table); no disagreement where a path was observed. Not checked: which statement shapes the backend generates for each read; the measured calls had no ProjectionExpression, and a projection prints plain decimal text. Two counts not to confuse: 62 of 350 is serde_json (no float_roundtrip) parsing a random double one ulp off the correctly rounded value, which is why the visibility wait keeps the tolerance; 52 of 350 is projection output, the plain-decimal and exponent texts of one double parsing to different values. The normalisation pair in the unit tests was a hand-written literal, never observed. Precondition: "exact" means exact on parsed f64; this build has no float_roundtrip; a one-ulp change counts as a change only because native_number (item.rs) stores a native number only if serialise, parse and canonicalise reproduce it, and a document edited from the Couchbase side (XDCR, SQL++, Eventing) bypasses that; the live proof used 7 hand-picked pairs. Open: the number form a second transaction reads from a committed document that is still staged: 146 probes on 6 tracks, 3 + 3 distinct values, parsed doubles only (the probe files hold json.loads values, "text" is a Python repr, the wire text was not recorded), 0 different; a transaction's own view of its staged write differed in text from the post-commit KV token for 97 of the 140 staged writes (105 against the literal written; bits the same in all 140), so the form is not assumed equal. If it differs, the settle only waits, the safe side you named on line 1344; if it differed permanently the item is refused (503) until it is unstaged, which is the availability cost.
1156 FIXED "The takeover rule", the overwrite sentence (line 1211) and the sentences on the kill harness (lines 1215 to 1216) The kill harness holds an item's own document staged, and item 15 (d) calls it such a harness (line 2946). The overwrite needs one of three open cases (a marker that expired, an expired taker lease over a lapsed marker, a mixed fleet); no run produced any of them.
2692 PARTLY (text and a new run); (b) stays OPEN in part Row 4.4 (line 2844); item 15 Gap A (b) (line 2946); "DynamoDB Streams", "Fourth run" (lines 2172 to 2176) The second run's acknowledged takeovers all wrote after their document unstaged, so it shows the refusal and the settle. The 7 acknowledgements of the one-ulp variant were each after the document unstaged too, so they show the refusal and no more; at cdf2b37 the exact settle masks the case. The ordering rests on the 6 ADD samples on 119b91f only, one cluster, observed, not a test. ConditionCheck and identical Put tracks: no taker met a staged document by that route (an inference from the 25 ms acknowledgement, not proof), so (b) stays OPEN in part. The marker exp sentence now uses the takeover rule's wording: it never moves, each touch keeps the lapsed marker for another 60 s.
1119 FIXED (run live) "The takeover rule" (line 1161) My reason covered the token cases only. The no-token case has live tests: at the default txtimeout a second TransactWriteItems is cancelled with TransactionConflict, a plain write is refused with TransactionConflictException after its 10 s wait (not a 503) before commit_by, and both succeed after it (53 s). At 1 s: 1 failed, 33 passed, 4 skipped, and the plain write's half-way check is skipped; the failure is test_a_conflicting_transaction_in_the_commit_window_cancels_it_does_not_also_commit, cause not established (see the Runs bullet). The token cases still have a unit test only.
777 ANSWERED (checked; the fix is not made) "Global and Local Secondary Indexes" (line 813) Checked in the code, not run: neither query nor scan checks an index status, so both answer on a CREATING index. Both operations go in the row for docs/differences-from-dynamodb.md; the planned fix returns main's "Cannot read from backfilling global secondary index: " for both. main measured that wording for a Scan of a backfilling vector index; a Query of one gets another message there, so for a Query it is by analogy.
1204 FIXED (code; run live); the floor is unit-tested only "The takeover rule" (line 1270) The next writer starts only after the taker lease's lifetime plus 30 s and 60 s (82 s at the default, 62 s at 1 s), after checking the taker's document is there as a plain lease with its marker. Solo runs: passed solo at 1 s (67 s) and at 30 s (87 s). Your short-marker case is not covered live: the marker had 24 h left, so the test cannot tell the 24 h from the lifetime-plus-30 s floor, and that floor is unit-tested only. A panic, SIGTERM and a restore that fails twice stay untested.
2700 FIXED Row 5.2 (line 2852); the Streams row of the design summary (line 2548); "DynamoDB Streams" (line 2024) "Under assumption A1 (not tested, engineering item 1)" is in row 5.2 and the Streams row; the Streams section states the reader's dependence on A1 itself. The front matter names these three places.
1301 FIXED Same section as 1299 (line 1391) The test named with 300 ulps uses N 1.5 against N 1.5000000000001, about 450 ulps apart, 6.7e-14 relative; the name is kept.
2869 FIXED Drawbacks, item (5) (line 3017); "The takeover rule", acquisition (line 1538) The task ends the lease, so the client's timeout no longer matters: a lost COMMIT answer keeps the lease committing until commit_by either way. The acquisition text is replaced by the fix above; residuals: a drop in the short KV write between a plain lease being returned and its release leaves a 30 s lease; a lease write landing after the cleanup's single read leaks until its exp; the cleanup's two tries with no backoff and the skipped cleanup at shutdown (Runs bullet above).
2040 FIXED "DynamoDB Streams", second run (line 2166) 19 trials had a staged own document and gave 51 tracks (17 each of PutItem, ADD, TransactWriteItems; the 17 trials with a PutItem track hold 48 of them, the other two 3). The PutItem tracks were unstaged 23.4 to 521.7 s after the kill; over all 51 tracks 22.3 to 522.5 s. The other two trials had one and two staged own documents, got no PutItem track, and were followed to the end (24 s and 91 s). Row 4.4 and Drawbacks are consistent; the fourth run's range is 1.6 to 322 s (40 trials, median about 60 s).

Review body

  • The (e)/(b) consistency point. Your reading was right: (e), a ConditionCheck item's lease deleted after a clean commit, was closed at revision 8 and stays closed. The 4-ulp residual was a defect of the settle; the exact settle removes it for committed documents (exact on parsed f64), so it is open neither under (b) nor under (e). What stays open, smaller and not closed, is the number form a second transaction reads from a committed document that is still staged (row 1299). (b), the order the query service gives a write-write conflict, stays OPEN in part as an observation, not a test. Row 4.4 (line 2844), item 15 (line 2946), the front matter (line 3) and the revision-10 section of the PR description say this; the PR's older revision-8 section says only that (e) is closed by (B).
  • Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 and line 28 stay OPEN until a reviewer can read the reference repository: a read invitation is pending (pending on 2026-12-03), and the rows stay open until a reviewer can read it.
  • What was not done: no live panic test; the staged-by-another-transaction number form is only partly measured; the four unexplained 500s of the first run stay unexplained, and the one 500 of the identical-image rerun is counted with the other 500s; the full suite was run at fb97722 (the backend code of cdf2b37) and matches the 9843eeb run, but it does not cover the kill-harness windows; the Query/Scan refusal on a CREATING index is planned, not made; the short-marker floor is unit-tested only.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 10, and for the answer to each comment. I read it at 9860445 against main at c057660.

The round 8 condition is met in part. item_unstaged now compares exactly, and the 4-ulp tolerance stays only in the visibility wait, the identical-image rule and single_write_txn_body. One case is still open, in how the settle parses its two reads. It is the one change I need before I approve. See the comment on line 1387. The other inline comments are smaller corrections.

Revision 10 resolves the other round 8 comments: lines 1156, 1119, 777, 1204, 2700, 1301, 2869 and 2040. On line 2692, the fourth run added the tracks I asked for. Its ConditionCheck and identical Put items met no staged document of their own, and the RFC says so and keeps (b) open in part. The RFC, the description and #1183 now give one account of (e).

The code answers are still in the reference repository, which I can't read yet. So rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay open, as the RFC says.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

*The measurement* (Couchbase Server 8.0.0, three nodes, `durability = majority`; the question was whether a KV read and the query service ever give a stored double different bits). It covered committed, unstaged documents only: 350 raw documents written to the bucket directly, with values such as 1.0000000000000002, 5e-324, 1.7976931348623157e308, subnormals and odd tokens (only these could carry 5e-324 and 1.7976931348623157e308, which are outside DynamoDB's range: the API refuses them with `ValidationException`); 442 documents written through the API (221 DynamoDB-valid values into a plain table and a stream-enabled table); and 140 staged writes, read after their commit. For every document a KV read and a whole-document read through the query service, inside and outside a transaction, returned the same number token and the same bits: 0 differences. The only difference between the two services was that the query service returns -0.0 as 0. The five API read paths covered different numbers of documents: `GetItem`, `Scan` and `TransactGetItems` 442 of 442; `Query` 261 (all 221 of the plain table, 40 of the 221 of the stream-enabled table); the read of a `ConditionCheck` inside a transaction (the item that a failing condition returns) 120 (the first 60 per table). Where a path was observed it returned the same number as the others: 0 disagreements; a path was not observed on the documents it did not cover. That is the answer to how `Query`, `Scan` and `TransactGetItems`, which also read through the query service, keep the exact numbers of row 1.3 for whole items: they were measured through the API, without a `ProjectionExpression`, and returned the stored number. A `SELECT` of one field (a projection, the shape a `ProjectionExpression` may need) renders a double as plain decimal text where the stored token has an exponent, and turned -0.0 into 0 (3 values): the bits are otherwise the same and the text is not, and serde_json then parses the plain-decimal text and the exponent text of the same double to different values for 52 of 350 doubles. That 52 is about projection output; the 62 of 350 above is a different count, serde_json's own parse of a random double landing one ulp off the correctly rounded value, and has nothing to do with projections. Which N1QL statement shapes the backend generates for each read (a whole document or a projection, for `GetItem`, `Query`, `Scan` and `TransactGetItems`, with and without a `ProjectionExpression`) was not checked: the measured reads are the API calls without a `ProjectionExpression` and the raw whole-document and one-field `SELECT`s above, so a path that reads through a projection is not covered, and a projection result is not assumed to keep the number. In the 140 staged writes, a transaction's own view of its own staged write was plain decimal text that differed from the literal written for 105 and from the token a KV read returned after the commit for 97 (the 97 is the figure that bears on the settle, the 105 compares with the literal); as parsed doubles it was the same in all 140; and a KV read after the commit equalled a transactional read after the commit in 140 of 140. The settle does not read a transaction's own view, but it does read what a second transaction sees of a staged document (below), and that was not measured this way. The normalisation pair 1795661746.1234567 / 1795661746.123457, which a unit test of the repository carried as the reason for a tolerance, was a hand-written literal in the unit tests and was never observed; both tokens were among the measured documents, and both services returned each unchanged.

*What a real change within 4 ulps does now.* The identical-image rule still takes it as unchanged, so the lease of its item stays `committed` after the commit. The next taker's exact settle then does not pass until the item is unstaged: a bounded wait (`TAKEOVER_SETTLE_MAX`, 2 s), then 503 for a plain write, `TransactionConflict` for a `TransactWriteItems` and a skip for a background rewrite. A document that stays unsettled is the safe side, as said below: given the precondition above, an exact settle can only wait longer, never settle early; the cost of waiting is availability: if the text form that the settle compares differed permanently, the item would be refused (503 for a plain write, `TransactionConflict`, a skip) until it is unstaged. Measured live at `cdf2b37`, with the one-ulp variant of the fourth run ("DynamoDB Streams", "Writes onto the item of a gate trial"): 253 probes met the item's own staged document; 6 were acknowledged, each after the item unstaged, and 247 were refused (196 with 503, 45 `TransactionCanceled` after about 2 s, 6 `TransactionConflict`); no acknowledged write was computed on the pre-commit image. And in the live cycle with 17-digit doubles (seven pairs of doubles that differ by one ulp or by a few digits, the `ADD` results compared exactly), 20 trackers were consistent and no settle refusal came after the unstaging (a timing of the first acknowledgement after the unstaging, 7 to 150 ms with a median of 23 ms, is in the run notes and was not re-derived from the probe files, so it is not given here). Only partly measured: the number form that a second transaction reads from a committed document that is still staged. 146 probes on 6 tracks (3 of the 17-digit cycle, 3 of the numeric probe) in which a transactional read saw the staged value gave a value identical to the final KV value in bits and in the Python repr of the parsed double, 0 different; these are parsed doubles only (the probe files hold `json.loads` values, so "text" is a Python repr and the raw wire text was not recorded); 3 + 3 distinct values; the 453 and 230 probes of those runs on tracks with a later acknowledged write are not covered. A transaction's own view of its own staged write differed in text from the post-commit KV token for 97 of 140 staged writes (above), so the form a second transaction reads is not assumed to be the final one. That residual is smaller, not closed. If it differed from the later KV body, the settle would only wait: a mismatch ends in 503 for a plain write, `TransactionConflict` for a `TransactWriteItems` or a skip, which is the safe side.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says that a staged number in another text form can only make the settle wait. The settle parses both reads with serde_json without float_roundtrip. That parse gives the plain-decimal and exponent texts of one double different values for 52 of 350 doubles (line 1385). So for a one-ulp change, the staged form can parse to the old double, and the settle passes on the pre-commit image. Please parse the settle's two reads with a correctly rounded parser, such as serde_json with float_roundtrip. Or say that this case can settle early, and keep it open under (b) in row 4.4 as well as item 15.

the default `txtimeout` for a stream-table write, and a following writer waited 10 s and
answered 503 until it lapsed. Now `take_plain_lease_opts` arms an `AcquireGuard` around
each lease write (the insert of a new lease, and the CAS that takes a marker over). If the
request is dropped, or the write fails with an error that may hide a write that landed,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guard's task removes OUR plain lease by its id when a lease write fails with an error that may hide a landed write. The text doesn't say what the acquisition does next. If it writes the lease again under the same id, the task can remove the new lease while the write runs under it. Please say that the request then ends with an error, or that a new attempt takes a new id.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

What C and I show, and what they do not. No read shows the own document of a `ConditionCheck` item or of an identical-`Put` item staged (an xattr read of the staged state shows nothing, even for a document staged in an open transaction, tested with raw N1QL), and the taker acknowledged in about 25 ms (median 22 to 26 ms; the longest 9 to 10 s) while other keys of the transaction were still staged. A `ConditionCheck` stages nothing, and an identical `Put` does not leave the item's own document staged, as far as any read shows: an inference from the latency, not a proof. So these two variants do not exercise Gap A (b), the case in which a taker meets a staged document of its own item. The U variant does: the item's own document is staged (KV `n` 1.5, transactional `n` 1.5000000000000002) under a lease that the old tolerance left `committed` or `committing`. At `aaaac8b`, 142 probes in 76 tracks met such a document (the first probe met it in 10 tracks). 7 were acknowledged (`ADD` 3, `PutItem` 2, `TransactWriteItems` 2), each after 0.67 to 11 s of call time (0.67, 1.05, 3.5, 7.96, 9.67, 10.78 and 11.06 s) and each with the item unstaged after it; none was acknowledged with the item still staged. 135 were refused: 503 for 22 (`ADD` 11, `PutItem` 7, `DeleteItem` 4), `TransactionCanceled` for 103, `TransactionConflict` for 7, and 500 for 3. In the backend log a takeover (`lease takeover op=committed`) came within about 50 ms of the probe, and the taker's own query transaction then ran for 8 to 11 s inside the query service (the write meeting the staged document) before `lease end Release`; the refusals are `the item stayed contended for 10.2 s; nothing was written` followed by `lease end Restore`. So what the log shows is that the taker's own transaction waited inside the query service for its write to meet the staged document and then either wrote or gave up at the 10 s deadline, while the settle passed at once on the image that the tolerance called equal; 0 were lost, and no acknowledged write was computed on the pre-commit image. The 7 acknowledgements were each after the document had unstaged, so, as for the second run, they show the refusal and not the order of a write onto a document that is still staged: this variant does not show the ordering itself. At `cdf2b37` the exact settle waits that case out, which masks it. This is an observation on one cluster, not a test of the ordering. 9 answers of 500 in the run (all `InternalServerError`) each had a backend ERROR line `query-txn POST failed: error sending request` (commit outcome unknown, not retried, for a `TransactWriteItems` and for a stream write) within 0.2 to 9 s, and the kill of another trial's query node at the same moment (9 of 9); none left an inconsistent final value, and no other ERROR line occurred.

The rerun at `cdf2b37`, the code of revision 10 (exact settle): 25 trials, 16 gate trials, 64 tracks, all 64 final states consistent, with one 500 (`InternalServerError`: C, `PutItem`, trial 5, 23.9 s after the kill; backend log `stream write: commit outcome unknown, not retried: query-txn POST failed`, and the kill of another trial's query node 7.4 s into the probe, attributed by the nearest kill, not proven). In its U variant 253 probes met a staged own document: 6 were acknowledged, each after the item unstaged, and 247 were refused (196 with 503, 45 `TransactionCanceled` after about 2 s, 6 `TransactionConflict`); the exact settle waits that case out, as designed. A live cycle with 17-digit doubles at `cdf2b37` (`fb97722`; seven pairs of doubles that differ by one ulp or by a few digits, the `ADD` results compared exactly): 21 trials, 6 gate trials, 20 trackers, all consistent, and no settle refusal came after the unstaging (the 7 to 150 ms of the run notes is not re-derived from the probe files). The numeric probe (20 trials, 4 gate trials, 11 tracks) and the staged-key probe (20 trials, 4 gate trials, 12 tracks) were repeated at `cdf2b37` as well: all consistent. The one 500 of the rerun is counted with the other 500s of these runs (the nine of the fourth run at `aaaac8b`, each with the same ERROR line and a kill of another trial's query node, and the four unexplained ones of the first run); it left a consistent final state. Limits: the yield of own-staged probes is small (142 of about 2,000 U probes, and 7 acknowledgements among them; `DeleteItem` was never acknowledged with the own document staged at `aaaac8b`); the own document's staged state is observable only for U; the backend log shows takeovers and ends, not KV operations; and the order of the writes was observed on one cluster.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At aaaac8b, which still had the 4-ulp settle, the U tracks were all consistent too, and no acknowledged write came from the pre-commit image. So these outcome checks pass on both builds. item_unstaged isn't called in a unit test (line 1397), so no test named here fails if it goes back to images_match. Please say that the refusal path is what shows the change: about 2 s, then 503, against 10.2 s of contention on aaaac8b. Or add a U tracker whose condition names the new n, as the numeric probe has.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
(the full three-node run of the upstream suite was made at `389b8bc` and again at
`9843eeb`, whose backend code is that of `aaaac8b`; the changes of revision 10 (the
exact settle and cancel-safe lease acquisition) came after the second run and the
full suite has not been rerun on them, and the runs that cover that code are listed

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says the full suite hasn't been rerun on the revision 10 changes. But "Runs at cdf2b37" reports the run at fb97722, the backend code of cdf2b37, with no differences from the 9843eeb run, and the description and #1183 say the same. Please make this sentence say that. The revision 10 status line (line 17) and the last sentence of the full-suite row (line 2726) should name that run too.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
which reads the lease and, by the decision `acquire_drop_action`, removes OUR plain lease by
its id with a CAS, puts a carried marker back (`restore_taken_lease`; it never deletes a
marker), and never touches a `committing` or `committed` lease or another writer's lease.
The guard is disarmed when the lease is returned to the write (whose own guard then takes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: a plain PutItem, DeleteItem or UpdateItem has no guard of its own after the acquisition returns its lease (lines 1553 to 1555). Please add "where it has one" here.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
lapsed marker taken for a plain lease), an expired taker lease over a lapsed marker
(the lease that carries the marker protects it for the larger of 60 s and its
lifetime plus 30 s only), and a mixed fleet (an older server clears an expired
lease that carries a marker and writes by KV). The change closes the other two

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "the other two windows" reads as two of the three cases listed before it. Please name them: the two windows of revision 8, a process death between a takeover and the taker's committing mark, and a restore that fails twice.

…ct compare everywhere, plain-lease guard kept armed, runs at 71939c0)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, thank you for round 9. Revision 11 is pushed to this PR (head 10a3f3fca3626b0bfcb6bb2f249fdd113b38cfe7). The code is the branch fix/round11-exact of the reference repository (private pull request #247, not merged), tip 71939c0, on top of the commits of fix/round10-push (a local branch, all of its commits are in fix/round11-exact; first commit d43712b) and fix/round9-push (tip fb97722, backend code cdf2b37). Your line numbers are those of revision 10 (head 98604456); mine are lines of the revision-11 RFC at the head above. The table follows your order. The details are in the RFC; this reply gives the verdicts. The repository is private: the read invitation of 2026-12-01 is pending and lapses on 2026-12-08, and I will send a new one on Monday, 7 December.

What changed in the code, 71939c0:

  • The parse is correctly rounded (your required change). backend/Cargo.toml enables serde_json's float_roundtrip (d43712b); Cargo.lock has one serde_json and cargo tree -e features -i serde_json shows the feature on it, so both reads of the settle use it (KV: content_as::<Value>, conn.rs:1447; query service: resp.json(), conn.rs:498). I did not take your second option. The counts 62 of 350 and 52 of 350 now say "before d43712b".
  • The 4-ulp tolerance is gone everywhere: FLOAT_CLOSE_ULPS, images_match and json_equivalent are deleted and all four comparisons use exact_images_match (engine.rs:1656). "Exact" is exact on the parsed f64; a document edited from the Couchbase side can carry two tokens of one double, so the claim is for documents this backend writes.
  • Also changed, not asked for. A lease under the request's own id after a write that reported failure is adopted with its marker (engine.rs:7683, engine.rs:8400; helper unit-tested, call sites not). A failed read of the OS randomness fails the request when a lease id is drawn (engine.rs:1795); lease ids only: leader::node_id and catalog_cas_backoff still ignore a failure, cas_backoff falls back to the clock, two sites panic. A review of revision 11 found that the acquisition guard was disarmed on a "not written" lease answer before the read that follows; that is found by review of revision 11, fixed in 71939c0, partly tested (below).

Runs. cargo test --lib at 71939c0: 383 passed, 387 with fault-hooks; lint passes (from the run notes of the commit; I did not rerun them for this text). Fault-hook file at 30 s on image r11g: 36 passed, 0 failed, 3 skipped; the SIGKILL test alone passed. The live probes ran on the image of 8d6d8ac, not on 71939c0, which differs only by the guard fix: gate_num17 13 of 13 trackers consistent, all unstaged (longest about 120 s), O never acknowledged; gate_ident variant U 28 of 28, all unstaged (longest about 130 s), 444 probes acknowledged while staged, all consistent. The 731.7 s tracker and the never-unstaged D tracker of the earlier run did not reproduce (longest of 41 trackers: 129.8 s); they match a host sleep (probe gaps of about 300 s against the Mac's power log; I did not reproduce a sleep). The spread of about 14 s to about 130 s is Couchbase's own transaction cleanup (a 60 s window, a 15 s attempt expiry); it is the availability cost of the exact settle (503 "committed, not yet visible" meanwhile). The full upstream suite at 71939c0: 1245 passed, 41 failed, 3 setup errors, 16 skipped, 1 xfailed; 3 differences in status against the run at 9843eeb, all in tests/test_fgac_leading_keys.py::TestLeadingKeys (CreateTable answered 500 with Couchbase code 2120 while ns_server was killed (exit 137) on the cluster nodes; the three tests passed 9 of 9 on a quiet cluster; the cause is a correlation from the logs, not shown to be the backend and not proven to be the cluster; the suite was not repeated on a memory-healthy cluster; the other 41 failures are the same 41 test ids as in the baseline). The run before it was at fb97722 (1248 passed, 41 failed, 16 skipped, 0 differences in status against 9843eeb). Not tested: the two adoption call sites, the pinned-image path, performance, the live probes on 71939c0 itself.

The guard gap, found by review of revision 11, fixed in 71939c0, partly tested. The guard now stays armed after a "not written" answer until the read shows the lease is not ours (AcquireState::disarm_unless_ours, engine.rs:2361, called at engine.rs:7677). Tested by a unit test of the helper (not of the call-site order) and by a live fault-hook test that fails on a mutant image (r11g-mut) and passes on the fixed one. Not tested: a takeover CAS that landed with its answer lost (no hook), a failing read after Ok(false), the deadline path with the guard armed. A known residual: the acquisition of a TransactWriteItems and of a TransactGetItems has no guard; a landed insert whose answer is lost leaves a lease that lapses after TXN_LEASE_TTL, 10 s (RFC lines 1901 and 1913 to 1931).

Still open, smaller: whether the query service prints a different double (not another spelling) for a committed, still staged document: 146 probes on 6 tracks, parsed doubles only (from run notes; the probe files are scratch). The settle would only wait (503).

Retargeted to main b6c85950 (375 commits past the pin; the eleven commits since 1be10124 change no trait signature or cited test file; the RFC branch merges into it without conflict and RFC number 0000 and the docs/rfcs/README.md process still hold). The 4 MB transaction size is not enforced upstream (docs/dynamodb-limits.md:89).

Inline comments, in your order

Comment (rev 10 line) Verdict Revision-11 lines In short
4787426558 (1387), the settle's parse CHANGED (code); unit-tested; one residual open status 3; 1491, 1523, 1589; 2229 Parse fixed. Evidence: two unit tests (5,000 random doubles in both spellings; one double in two spellings agrees, a one-ulp neighbour does not). They call serde_json::from_str; that the SDK and resp.json() use the same build rests on Cargo.lock and cargo tree. A review probe (scratch): 981,660 texts, 0 wrong. Not shown: that the old build fails the live probes.
4787426576, acquisition after a failed lease write PARTLY (read from the code; two pause-after-clean-write tests; the guard gap fixed and partly tested) 1857, 1891, 1901, 1913 to 1931, 1944 The request ends with an error; a new attempt takes a new id (engine.rs:7630; ? at engine.rs:7659 and engine.rs:7764). The loop reuses the id after Ok(false), a missing lease and a cleared lapsed lease. Own-id adoption: plain path engine.rs:7683; in acquire_leases_as only the request's own re-acquire loop (engine.rs:8400). A TransactWriteItems and a TransactGetItems acquisition has no guard. The docstrings of the two older acquisition tests in tests/test_fault_hooks.py still end "NOT RUN."; they ran and passed; I did not edit the code repository.
4787426595 (1397), a test that fails if the settle goes back PARTLY (unit tests of the compare and a text scan; wiring not behaviourally tested) 1589, 1662, 3197 item_unstaged is still not called in a unit test; it calls settle_images_agree (engine.rs:1646). item_unstaged_settles_with_the_exact_compare (engine.rs:18912) is a text scan: four tolerance symbols file-wide, images_match only inside two function bodies. Mutation checks: 3 and 4 tests failed; the alias mutation of the settle failed only the scan (weak). First suggestion taken: refusals at a 2.02 s and 2.01 s median at d43712b, against 10.2 s of contention at aaaac8b; not a controlled comparison. The settle starts no new poll after 2 s; one poll can run longer.
4787426614, the full-suite sentence CHANGED (text) 3, 50, 179, 3091, 3146, 3209 Names the run at fb97722 (backend code of cdf2b37) and gives the line for the run at 71939c0: 1245 passed, 41 failed, 3 setup errors, 16 skipped, 1 xfailed; 3 differences in status against the run at 9843eeb, all in tests/test_fgac_leading_keys.py::TestLeadingKeys (CreateTable answered 500 with Couchbase code 2120 while ns_server was killed (exit 137) on the cluster nodes; the three tests passed 9 of 9 on a quiet cluster; the cause is a correlation from the logs, not shown to be the backend and not proven to be the cluster; the suite was not repeated on a memory-healthy cluster; the other 41 failures are the same 41 test ids as in the baseline).
4787426651, "where it has one" CHANGED (text) 1848 A plain PutItem, DeleteItem or UpdateItem has no guard once the acquisition returns its lease.
4787426669, "the other two windows" CHANGED (text) 117, 1309 Named: a process death between takeover and the taker's committing mark, and a restore that fails twice. "Closed by design" is now "addressed in code" everywhere, including rows 4.4 and 4.5 and item 15. SIGKILL at one point is the only test.

Review body

  • Round 8: changed nothing except where a number moved with the comparison.
  • Applied without being asked: the "closed" claim for (e) rests on an inference (a ConditionCheck stages no document); the 450-ulp probe is one pair; bounds are stated at the default txtimeout; the DynamoDB behaviours are stated as observations without a source; the developer-guide quote on ACTIVE is as a review fetched the page on 2026-12-03, not fetched by me; the upgrade path of legacy access-key secrets is open (line 2676).
  • Rows 2.4, 3.5, 4.1, 4.3, 5.2, 6.2 and line 28 stay OPEN until a reviewer can read the reference repository.
  • Not done: the live probes on 71939c0 itself; the three untested paths of the guard fix; the guard of TransactWriteItems and TransactGetItems acquisition; the two adoption call sites; the pinned-image path; performance; the four unexplained 500s of the first run.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 11, and for the answer to each comment. I read it at 10a3f3f against main at 5826e1b.

The round 9 condition is met. Both reads of the settle now go through one serde_json with float_roundtrip, so the two spellings of one double parse to the same double. The public code agrees: the SDK's content_as and reqwest's Response::json both call serde_json::from_slice. Lines 1544, 2176 and 112 and the two Nits are resolved too.

I have one question before I approve, on line 1624. As written, it reads as 444 writes acknowledged on the item's own staged change, which the exact settle should refuse. A reply there is enough if those probes met something else.

The other inline comments are smaller corrections to text that revision 11 added. None of them blocks my approval.

CI hasn't run on this PR yet, because the workflow runs from the fork wait for a maintainer to approve them. I'll approve when CI has run on this head and line 1624 is answered.

The code answers are still in the reference repository, which I can't read yet. So rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay open, as the RFC says.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
I reran both harnesses on the image of `8d6d8ac` (not `71939c0`): `gate_num17.py` 40
trials, 5 gate trials, 13 trackers, 13 of 13 consistent and unstaged (the longest about 120 s;
`O` never acknowledged), and `gate_ident.py` variant U 9 trials, 7 gate trials, 28 trackers, 28 of
28 consistent and unstaged (the longest about 130 s), with 444 probes acknowledged while the item

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says 444 probes were acknowledged while the item was staged. In variant U the item's own document is staged (KV n 1.5, transactional n 1.5000000000000002). The exact settle answers 503 on such a document unless it unstages within about 2 s. Rows 4.4 and 15 also say a write onto a staged own document was seen only in the 6 ADD samples on 119b91f. Please say what was staged for these probes, and whether the kill transaction had committed. If it was the item's own committed change, please say how these writes were acknowledged.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated

With the parse now correctly rounded, a different spelling of one double no longer matters; the
residual is a different double, which is smaller, not closed, and cannot be proved offline. If
it differed from the later KV body, the settle would only wait: a mismatch ends in 503 for a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says that if the second read gave a different double, the settle would only wait. If that double equals the item's pre-commit value, the two reads agree and the settle passes on the pre-commit image. Line 2229 allows this ("a different double could"). Please say that this case can settle early, here and at lines 1597 and 1729. Row 4.4 and item 15 already keep it open, so only the wording changes.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
*The settle.* `item_unstaged` reads the item by KV (`kv_get`, `conn.rs:2057`) and by a
transactional read in the query service (`txn_peek`, `engine.rs:11327`) and compares the two with
`settle_images_agree`, which is `exact_images_match`. Both reads are parsed by one serde_json,
1.0.151, which has `float_roundtrip` since `d43712b` (`backend/Cargo.toml:38`; `Cargo.lock` holds

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both checks named here, the unit tests and cargo tree -e features -i serde_json, include dev-dependencies. Cargo doesn't turn on a feature that only a dev-dependency asks for in a release build, so both checks would pass with float_roundtrip under [dev-dependencies] alone. Please say that line 38 of backend/Cargo.toml is under [dependencies], and give the tree check without dev edges (cargo tree -e normal,features -i serde_json). Please also say that kv_get (conn.rs:2057) reads through kv_get_cas and content_as (conn.rs:1436, conn.rs:1447).

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
them (`FLOAT_CLOSE_ULPS`, `fn floats_close`, `fn ulps_apart`, `fn json_equivalent`); it looks for
`images_match` only inside the bodies of `item_unstaged` and `settle_images_agree`, so a function of
that name added elsewhere would pass it. The other uses of the compare (visibility, identical keys,
the pinned image) are pinned by behaviour tests with a one-ulp and a 450-ulp pair, not by the scan

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says the visibility wait, the identical keys and the pinned image are pinned by behaviour tests with a one-ulp and a 450-ulp pair. Of the tests named, only a_change_of_300_ulps_is_not_equivalent reaches commit_body_visible, commit_doc_visible and identical_mutation_keys, and it uses the 450-ulp pair. Line 3211 says the pinned-image path has no test. So a tolerance of a few ulps at one of those call sites would pass every test named. Please say that, or add the one-ulp pair to that test.

acquisition of a `TransactWriteItems` and of a `TransactGetItems` has no `AcquireGuard`: those
requests run detached, so a client that gives up does not strand their leases, but an error that
hides a landed insert leaves that lease until it lapses (`TXN_LEASE_TTL`, 10 s, not renewed). That
is read from the code, not tested, and the fix of `71939c0` does not touch it. **A known residual,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The lease insert of a TransactWriteItems can land with its answer lost. A plain write on that item then answers TransactionConflictException at once for up to 10 s, though no transaction holds the item. Behind a lost read lease of a TransactGetItems, it waits to its 10 s deadline and answers 503. Row 4.1 lists three cases where the lease differs from RFC-0003 4.1, and this is a fourth. Please add it to row 4.1.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
CAS-retry counter is exported today). A 100-action `TransactWriteItems` can
exceed the 30 s `txtimeout` at WAN latency
(couchbaselabs/extenddb-couchbase#177 `[ref-repo]`).
- **Multi-node scaling** (Couchb

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list is headed "Not run live". This item names the full upstream suite on the revision-11 code, then reports its run at 71939c0 in the same sentence. The suite did run on that code, on a release image, as "Runs behind revision 11" says. Please move the item out of this list. If it stays, please make it name what wasn't run: a repeat on a memory-healthy cluster and a run on a fault-hooks image.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
predates it: its `fetch_session_data` (`backend/src/catalog.rs` at
`bf67ee2`) takes `account_id`, `role_name` and `session_name`, the
signature before #1523, and has to be rewritten to read by access key ID. Three later changes
on `main` are port items too (eleven commits since `1be10124`, none of which changes a trait signature

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1411 (c8e66fb5), one of the eleven commits, changes tests/test_table_operations.py, which row 10.3 cites. It renames test_delete_of_a_deleting_table_returns_its_description to test_delete_of_a_deleting_table_is_refused and adds two tests of a DELETING table's description. The trait half of this sentence holds (crates/storage/src changes by one line, in snapshot.rs), but the test-file half doesn't. Please say that #1411 changes that file, here and in the description.

the base index, also without.

**Scan** is a SQL++ scan of the table's partition; a parallel-scan segment is
selected by hashing the encoded primary key (`SHA-256` of `_xdb.pk` and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main moved one commit past b6c85950 after this revision. #1087 (5826e1beac) adds tests/test_scan_segments.py. Its tests check that every item of a partition key comes back from one segment, and that a start key from another segment is refused. The file's docstring gives both as measured on DynamoDB. The rule here hashes _xdb.pk and _xdb.sk together, so one key's items spread over several segments. Please add #1087 to the port items, with the change to hash the partition key alone, and cite the new file in row 7.3.

Comment thread docs/rfcs/0000-couchbase-backend.md Outdated
CAS-retry counter is exported today). A 100-action `TransactWriteItems` can
exceed the 30 s `txtimeout` at WAN latency
(couchbaselabs/extenddb-couchbase#177 `[ref-repo]`).
- **Multi-node scaling** (Couchb

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: lines 117, 1281 and 2224 say that only the revision-11 code handles a retry under the same lease id. Line 1954 says the revision-9 code deleted the marker there. Please add the same clause here and in (d) of row 4.4.

…text corrections)

Text only; the code is that of revision 11 (private main 5e58bea, same tree as 71939c0).

- The 444 "acknowledged while staged" probes are relabelled: staged meant other
  keys of the kill transaction, not the probed item. The probes did not test
  writes on the item's own staged change; that stays open under rows 4.4 and 15
  (b), with a designed, not yet run, test.
- A different double equal to the pre-commit value can let the settle pass early.
- float_roundtrip: Cargo.toml line under [dependencies], cargo tree -e
  normal,features -i serde_json, kv_get read path.
- One-ulp test named; lost lease insert added as a fourth difference in row 4.1;
  full-suite item moved out of "Not run live"; upstream ExtendDB#1411 and ExtendDB#1087 noted
  (test_table_operations.py, test_scan_segments.py); same-lease-id clause in 4.4 (d).

Signed-off-by: Raju Suravarjjala <raju@couchbase.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@suravarjjala

Copy link
Copy Markdown
Author

@LeeroyHannigan, thank you for round 10. Revision 12 is pushed to this PR (head 22bf4bd97880eac2485d8acb3a004dd7b0a02ae0). It changes text only: the code is that of revision 11 (tip 71939c0 of the revision-11 branch, merged into the private main as 5e58bea, same tree; #248, ea21e46, merged after it), and no live run was made for it: one unit test was run in a scratch export with mutants, and cargo tree was run offline on an export. The live probes ran on earlier images (8d6d8ac); the unit tests at 71939c0. The line numbers of the table are those of revision 12 at the head above; yours are revision 11's.

Line 1624 first (4793245531). The count was mislabelled, and I have corrected it in the RFC (front matter line 50; "What the 444 probes were", line 1664; the table row at line 3306).

  • What it measured. In gate_ident.py, "staged" meant that other keys of the same kill transaction (its 40 fresh-key Puts, or a stream record) were still staged and visible only through the transactional read. It did not mean the probed item. In all 444 probes the probed item had no transaction xattr, and its KV image and its transactional image were identical (n = 1.5000000000000002). The probes had no condition expression; they were unconditional writes onto an own document that had already unstaged (128 PutItem, 180 ADD, 133 TransactWriteItems, 3 DeleteItem). I inferred the commit: the transactional read showed new values that KV did not, and as far as I know that happens only after the ATR commit. I did not read the ATR, and nothing else supports the inference. Why the own document unstaged before the other keys I don't know, and that limits what the inference shows: the 444 show an unstaged own document at the probe, not the order of unstaging inside the transaction.
  • What met a staged own document. 170 probe rows had the xattr present before the probe: 112 answered 503, 53 answered 400, 5 answered 200. The 400s: 46 TransactWriteItems probes cancelled with TransactionCanceledException ([TransactionConflict, None]) and 7 plain writes refused with TransactionConflictException ("Transaction is ongoing for the item"), from the error names the harness recorded. Why these were 400 and not 503 I have not determined; I did not trace those rows to the code.
  • The 5 acknowledgements. Each had a staged own document in the snapshot before the write and an unstaged one in the snapshot after it (the writes took 0.05 to 1.9 s). The snapshots are taken around the write, not at it, so the data cannot place these 5 writes relative to the unstaging. They are not among the 444. These 5 are unresolved. "None of the 444 was accepted on the item's own staged change" holds by the definition of the 444 (own document already unstaged); it is not a finding about the 5. The 6 ADD samples on 119b91f are still the only evidence for (b).
  • What it did not test. This run did not test conditional writes on the item's own staged change. It did not show an acknowledged write onto one either. That stays open under rows 4.4 and 15 (b) (lines 3379 and 3481, with a sentence added to each, and the engineering item at line 2299).
  • The planned test. gate_own.py, a copy of the variant U harness, not yet run. Probes with a condition on the old number (n = :old, never to be acknowledged) and on the new one, sent within a few hundred ms of the kill; the item's own xattr read before and after each write, and the ATR state read; an acknowledgement counts for (b) only if the xattr is present both before and after the write; probes whose own document had already unstaged are counted apart. It has no date. It may never meet a staged own document; that outcome leaves (b) open, not closed.

Inline comments, in your order.

Comment (rev 11 line) Verdict Revision-12 lines In short
4793245531 (1624) CHANGED (text) 50, 1645, 1664 to 1690, 3306; rows 4.4, 15 As above.
4793245541 (1658) CHANGED (text) 79, 1620, 1713, 1799, 2300; rows 4.4 and 15 A different double that equals the item's pre-commit value makes the two reads agree and the settle can pass early on the pre-commit image. Stated at each place you named. Open; no run has shown a different double.
4793245546 (1494) CHANGED (text); the command was run 1506 to 1519 backend/Cargo.toml:38 is under [dependencies]. The check is cargo tree -e normal,features -i serde_json. I ran it offline on an export of private main 5e58bea: the float_roundtrip node's only dependent is extenddb-storage-couchbase. The output also has a second serde_json root without the feature, reached only through sqlx-macros (a proc-macro). kv_get (conn.rs:2057) calls kv_get_cas (conn.rs:2063, 1436), which reads with content_as (conn.rs:1447). The line numbers are at 5e58bea; I did not re-check them on the newer private main.
4793245555 (1442) CHANGED (text); the test exists, see below 1453, 1718 to 1730 Named and run, see "Where your description differs".
4793245568 (1901) CHANGED (text); read from the code, not tested 1978, row 4.1 (line 3376) Row 4.1 now lists a fourth difference: the lease insert of a TransactWriteItems or TransactGetItems that landed and whose answer is an error such as a timeout (an "exists" answer is read and a lease under the caller's own id is adopted). A plain write meets TransactionConflictException at once behind a TransactWriteItems lease (up to 10 s), and waits to its 10 s bound behind a TransactGetItems lease, with a 503 only if the lease is still there. See the hedge below.
4793245575 (3091) CHANGED (text) 3187, 3308 The full-suite item is out of "Not run live". The list now names what was not run: a repeat on a memory-healthy cluster, and a run on a fault-hooks image.
4793245587 (2793) CHANGED (text) 2865 to 2872, row 10.3 (3430); description #1411 (c8e66fb5) changes tests/test_table_operations.py. The sentence now says twelve commits, no trait signature changed (#1087 edits a trait doc comment and adds util::scan_segment), two changed a cited test file (#1411, and #1087 in tests/test_read_paging.py, where a helper moved to conftest.py).
4793245607 (776) CHANGED (text) 786, 2878 to 2884, row 7.3 (3407) #1087 (5826e1be) is a port item: hash the partition key alone for the segment. tests/test_scan_segments.py is cited in row 7.3. The reference code hashes pk_enc, sk_enc together (segment_hash, engine.rs:11871 at 5e58bea). What the reference GSI scan hashes I did not trace; the text says so.
4793245620 (3231, nit) CHANGED (text) 1292, rows 4.4 (d) and 15 (d) The same-lease-id clause is added. It names fb97722, because that is what line 1954 of revision 11 describes (the revision-10 code, not the revision-9 code).

Where your description differs from the code.

  • The one-ulp test exists (4793245555). image_compare_is_exact_without_a_tolerance (engine.rs:18735 at 71939c0) puts the pair N 1.5 and N 1.5 plus one ulp through commit_body_visible, commit_doc_visible and identical_mutation_keys, and requires each to see a change. I ran it in a scratch export of 71939c0: it passes. I then added a 4-ulp tolerance in the scratch copy only: in the number compare, it fails at the first assertion; only in commit_body_visible, it fails at that assertion; only in the compare in identical_mutation_keys, it fails at that assertion. I did not mutate commit_doc_visible alone: outside the idempotency collection it calls commit_body_visible. The pinned-image path (single_write_txn_body) is covered by neither test, as the RFC says (revision 12, lines 1453 and 3310). The 450-ulp test is labelled as the 450-ulp pair.
  • TransactGetItems, 503 against a lapse (4793245568). You wrote that behind a lost read lease a plain write waits to its 10 s deadline and answers 503. From the code (on_lease answers Wait for a transact_get lease; the wait is bounded by CAS_DEADLINE, 10 s; the lease lives TXN_LEASE_TTL, 10 s, from its insert; a lapsed lease is cleared and the writer proceeds) a write that starts after the insert should normally see the lease lapse first. This assumes the read lease has the same 10 s TTL as the write lease; acquire_read_leases gives it TXN_LEASE_TTL at 5e58bea. TXN_READ_DEADLINE (5 s) bounds the TransactGetItems itself, not the writer. The text says it waits up to 10 s and answers 503 only if the lease is still there at the deadline. No test shows either outcome.

CI. Thank you for the note. The workflow runs from this fork wait for a maintainer to approve them. I can't approve them from the fork; could a maintainer approve the runs on 22bf4bd97880eac2485d8acb3a004dd7b0a02ae0?

Repository access. The read invitation of 2026-12-01 lapses on 2026-12-08. I will send a new one by 8 December, planned for Monday, 7 December. Rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay open until you can read the reference repository.

Not done. gate_own.py is not run (it has no date, and it may never meet a staged own document, which would leave (b) open); the live probes are on the image of 8d6d8ac, not 71939c0; the pinned-image path has no test; the TransactGetItems wait is not tested.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for revision 12, and for the answer. I read it at 22bf4bd against main at 5826e1b.

Line 1624 is answered. Every place that reports the variant U rerun now says the 444 writes met an own document that had already unstaged. It also says that none of them carried a condition. The round 9 condition stays met, and the other round 10 comments are resolved. Thanks for the corrections on 1442 and 1901.

The inline comments are small corrections to text that revision 12 added. None of them blocks my approval. If you fix them, one push for all of them is easiest, because the workflow runs of each new head need a maintainer's approval again.

I'll approve once CI has run on the head.

The code answers are still in the reference repository, which I can't read yet. So rows 2.4, 3.5, 4.1, 4.3, 5.2 and 6.2 stay open, as the RFC says.

migration. Two Couchbase limits are cluster-wide: 1,000 scopes and 1,000
collections per cluster ("Scopes and Collections"), and 10,000 indexes per
cluster (the Operator documentation). In the shared tier every GSI, LSI and
TTL index of every table is an index on `

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence follows the one about the second kill-harness run, so "That run" reads as that run, which had 31 acknowledged writes. The 444 come from the variant U rerun on the image of 8d6d8ac. Please name that run here, at line 2299 and in row 15.

acknowledged while the item was staged") was wrong.

The probes that did meet an own document that was still staged (xattr present before the probe)
were 170 rows: 112 refused with 503, 53 with 400, and 5 acknowledged with 200. The 400s, from the error name and message the harness recorded in each row: 46 `TransactWriteItems` probes cancelled with `TransactionCanceledException` ("Transaction cancelled ... [TransactionConflict, None]"), and 7 plain writes (3 `PutItem`, 3 `DeleteItem`, 1 `UpdateItem`) refused with `TransactionConflictException` ("Transaction is ongoing for the item"); the 503s are "Service is temporarily unavailable". Why these answered 400 and not 503 I have not determined: they are the names row 4.1 gives for contention with a transaction's lease, but I did not trace these rows to the code path. The 5 acknowledged writes had a staged

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these 400s are what the design gives. A TransactWriteItems never gets a 503 here: line 1615 and row 4.3 give it TransactionConflict, which covers the 46 cancellations. For the 7 plain writes, row 4.1 case 3 gives TransactionConflictException after 10 s behind a client transaction's committing lease, as in the second run. Please say so here and in the description, with the call times of the 7 if the harness recorded them.

migration. Two Couchbase limits are cluster-wide: 1,000 scopes and 1,000
collections per cluster ("Scopes and Collections"), and 10,000 indexes per
cluster (the Operator documentation). In the shared tier every GSI, LSI and
TTL index of every table is an index on `

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case (4), an unconditional write answers TransactionConflictException while no transaction holds the item, so a client sees it. The row now records only the first three cases in docs/differences-from-dynamodb.md. Please add the fourth there too, or say why it stays out.

migration. Two Couchbase limits are cluster-wide: 1,000 scopes and 1,000
collections per cluster ("Scopes and Collections"), and 10,000 indexes per
cluster (the Operator documentation). In the shared tier every GSI, LSI and
TTL index of every table is an index on `

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The port item at line 2888 says a GSI scan needs the index's partition key hashed, and tests/test_scan_segments.py checks gpk on its GSI byGroup. This row says "hash _xdb.pk alone", which covers only the table. Please add the GSI case here.

503 for a plain write, `TransactionConflict` for a `TransactWriteItems` or a skip, which is the
safe side. The exception is not safe: if the second read gave a different double that equals
the item's pre-commit value, the two reads agree and the settle can pass early, on the
pre-commit image (the case of "A real change of up to 4 ulps" in Drawbacks; open, and no run

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "A real change of up to 4 ulps" is the bullet at line 2300, under Transactions, not in Drawbacks. Please point there.

migration. Two Couchbase limits are cluster-wide: 1,000 scopes and 1,000
collections per cluster ("Scopes and Collections"), and 10,000 indexes per
cluster (the Operator documentation). In the shared tier every GSI, LSI and
TTL index of every table is an index on `

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: row 4.4 (d) and line 3330 now say that only the revision-11 code handles a retry under the same lease id. Item (ii) here still credits the revision-9 code alone. Please add the same clause here.

@navareamol navareamol self-assigned this Dec 4, 2026

@navareamol navareamol left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main changed after the last read, and one rule is missing from the RFC. #1093 (merged today) makes UpdateTable answer UPDATING. On every backend a change to ProvisionedThroughput, BillingMode, TableClass or StreamSpecification keeps the stored status ACTIVE, writes now plus control_plane_delay_seconds to status_transition_at, and the table reports UPDATING until then. A second capacity change inside the window is refused with ResourceInUseException (docs/design/04-component-storage.md, lines 645 to 647). The commit also adds crates/storage/src/update_window_conformance.rs, which each backend runs against its own database, and tests/python/test_update_table_status.py. The RFC never mentions UPDATING, status_transition_at or control_plane_delay_seconds. The in-crate checks at line 3442 and the port list do not include update_window_conformance, and the row that says the full upstream suite passes was run before this change. Could you add the check to both lists, say where the Couchbase catalog keeps status_transition_at, and say whether the suite still passes with the new test file?

Lines 736 and 2914 state Couchbase limits (a 246 byte key in a named collection, 1,000 scopes and 1,000 collections per cluster). They match the Couchbase documentation as I read it. Please link the pages there, since the 240 byte threshold and the scope design depend on them: https://docs.couchbase.com/php-sdk/current/concept-docs/documents.html and https://docs.couchbase.com/server/current/learn/data/scopes-and-collections.html.

I will approve once the UPDATING window and update_window_conformance are covered, together with the open points Lee has on this head and CI passing on it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RFC Request for Comments, a proposal open for discussion before implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants