adapter: buffer a transaction's blind read-then-write until commit - #37924
Open
aljoscha wants to merge 1 commit into
Open
adapter: buffer a transaction's blind read-then-write until commit#37924aljoscha wants to merge 1 commit into
aljoscha wants to merge 1 commit into
Conversation
This was referenced Jul 29, 2026
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 29, 2026 07:14
f0dcc43 to
d017928
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 29, 2026 09:35
d017928 to
5d0c001
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
2 times, most recently
from
July 29, 2026 10:57
16b05d1 to
efb54b1
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 29, 2026 11:44
efb54b1 to
cf8e804
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 29, 2026 12:19
cf8e804 to
143170a
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 29, 2026 13:25
143170a to
cc74c44
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
2 times, most recently
from
July 29, 2026 15:26
27be3b3 to
af343a1
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 29, 2026 15:51
af343a1 to
8a514a6
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 30, 2026 06:02
8a514a6 to
a741eb6
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 30, 2026 06:24
a741eb6 to
ed20ee4
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
2 times, most recently
from
July 30, 2026 07:04
e1ac18d to
ae8eeca
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
2 times, most recently
from
July 30, 2026 08:10
0766855 to
d34e32f
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
July 30, 2026 08:34
d34e32f to
df5a2de
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
August 5, 2026 06:16
df5a2de to
ec6c426
Compare
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
August 5, 2026 12:13
ec6c426 to
022b928
Compare
A read-then-write inside a multi-statement transaction was refused outright, because a write that commits immediately cannot be rolled back at transaction end. That is the right answer only for a write that reads persisted state. One whose selection reads nothing produces diffs that are valid at any timestamp, so it can be buffered as a session write op and land with the rest of the transaction, which is what a constant INSERT already does. Two predicates decide it and they have to agree. Before planning, the syntactic one on `depends_on()` refuses a read-dependent write while refusing is still possible. During execution, the subscribe answers the same question dynamically, and the loop's `Committed` arm asserts it has no write timestamp to apply inside a transaction, which is that disagreement made observable. It is a soft assertion because the write is durable by then. `max_concurrent_occ_writes` is sampled once at startup, so `ALTER SYSTEM SET` on it silently did nothing. The statement is accepted and now warns that the change takes effect when environmentd restarts. `RESET ALL` names every parameter rather than one, so it compares values instead of names. The test for the parameter's domain constraint lands here too, though the constraint itself arrives with the path that reads the parameter.
aljoscha
force-pushed
the
aljoscha/occ-07-transactions-and-vars
branch
from
August 5, 2026 13:05
022b928 to
5368027
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Part 7 of 7 in a stack that moves
DELETE,UPDATEandINSERT ... SELECToff the coordinator onto the session task, using optimistic concurrency
control. Design doc:
20260210_incremental_occ_read_then_write.md(lands in part 6).
Part 6 refuses a read-then-write inside a multi-statement transaction, because
a write that commits immediately cannot be rolled back at transaction end.
That is the right answer only for a write that reads persisted state.
Closes SQL-593
Description
A write whose selection reads nothing produces diffs that are valid at any
timestamp, so it can be buffered as a session write op and land with the rest
of the transaction, which is what a constant
INSERTalready does.Two predicates decide this and they have to agree. Before planning, a
syntactic one on
depends_on()refuses a read-dependent write while refusingis still possible. During execution the subscribe answers the same question
dynamically, and the loop's
Committedarm asserts it has no write timestampto apply inside a transaction, which is that disagreement made observable. It
is a soft assertion because the write is already durable by then.
Separately:
max_concurrent_occ_writesis sampled once at startup, soALTER SYSTEM SETon it silently did nothing. The statement is still accepted, andnow warns that the change takes effect when environmentd restarts.
RESET ALLnames every parameter rather than one, so it compares values instead of names.
The parameter also gets a domain constraint of at least 1, since zero permits
would leave every read-then-write waiting out its
statement_timeout.Verification
Tests for a non-constant
INSERTin a transaction being buffered andcommitting with the transaction, for a read-dependent write in a transaction
being refused, for a read-only transaction, and for the startup-only variable
warning on
SET,RESETandRESET ALL.