(clear-pending! registry keys seq)Drop each of keys whose pending seq is still exactly seq. Called by the
worker after it has applied this tx's batch to the memtable, so the read path
already sees the write. The equality guard is essential: a newer in-flight
commit may have raised the entry to a higher seq, and that must survive until
its own apply -- never evict a newer pending seq.
Drop each of `keys` whose pending seq is still exactly `seq`. Called by the worker after it has applied this tx's batch to the memtable, so the read path already sees the write. The equality guard is essential: a newer in-flight commit may have raised the entry to a higher seq, and that must survive until its own apply -- never evict a newer pending seq.
(create-registry)(create-registry init-seq)Create the global tx registry. init-seq seeds both the commit-order counter
and the applied high-water mark (on startup the replayed/recovered data is
already materializable by the read path, so applied == init-seq; 0 for a fresh
store).
Create the global tx registry. `init-seq` seeds both the commit-order counter and the applied high-water mark (on startup the replayed/recovered data is already materializable by the read path, so applied == init-seq; 0 for a fresh store).
(current-applied registry)The max seq the worker has applied to the memtable. begin-tx pins its
snapshot to this (see the applied note above).
The max seq the worker has applied to the memtable. `begin-tx` pins its snapshot to this (see the `applied` note above).
(current-seq registry)The highest commit-order seq assigned so far. A begin-tx pins this as its
snapshot; non-tx reads use Long/MAX_VALUE instead (always latest).
The highest commit-order seq assigned so far. A begin-tx pins this as its snapshot; non-tx reads use `Long/MAX_VALUE` instead (always latest).
(deregister-snapshot! registry s)Remove one live tx pinned at snapshot seq s (decrement, dropping the key at
zero). Called on commit-tx / rollback-tx.
Remove one live tx pinned at snapshot seq `s` (decrement, dropping the key at zero). Called on commit-tx / rollback-tx.
(mark-applied! registry seq)Advance the applied high-water mark to seq (monotonic max). Called by the
group-commit worker AFTER it has published the memtable apply, so any reader
that observes the new applied value can materialize every seq <= it.
Advance the applied high-water mark to `seq` (monotonic max). Called by the group-commit worker AFTER it has published the memtable apply, so any reader that observes the new applied value can materialize every seq <= it.
(min-active-snapshot-seq registry)The minimum snapshot seq over all live txs, or -- when none is active -- the current seq (nothing older than 'now' needs preserving).
Reads current-seq FIRST, then the active set, and returns their min. Order
matters for the no-active-tx race: any tx that begins after this read pins a
snapshot >= the current-seq we observed (the counter only grows), so a floor
of the observed current-seq never exceeds a future live tx's snapshot -- GC
stays safe.
The minimum snapshot seq over all live txs, or -- when none is active -- the current seq (nothing older than 'now' needs preserving). Reads `current-seq` FIRST, then the active set, and returns their `min`. Order matters for the no-active-tx race: any tx that begins after this read pins a snapshot >= the `current-seq` we observed (the counter only grows), so a floor of the observed current-seq never exceeds a future live tx's snapshot -- GC stays safe.
(next-seq! registry)Atomically assign and return the next commit-order seq.
Atomically assign and return the next commit-order seq.
(pending-seq registry k)The in-flight committed seq for user_key k, or nil. Read under the commit
lock as part of conflict detection.
The in-flight committed seq for user_key `k`, or nil. Read under the commit lock as part of conflict detection.
(record-pending! registry keys seq)Mark each of keys as having an in-flight commit at seq (the larger seq wins
if one is already pending -- commits are ordered by the commit lock, but max
keeps it order-independent). Called under the commit lock after seq assignment.
Mark each of `keys` as having an in-flight commit at `seq` (the larger seq wins if one is already pending -- commits are ordered by the commit lock, but `max` keeps it order-independent). Called under the commit lock after seq assignment.
(register-snapshot! registry s)Register a live tx pinned at snapshot seq s (increment its multiset count).
Called on begin-tx.
Register a live tx pinned at snapshot seq `s` (increment its multiset count). Called on begin-tx.
(seed-seq! registry n)Reset the commit-order counter AND the applied high-water mark to n (recovery
seeds them to the max replayed seq: later writes get strictly higher seqs, and
the recovered data is already materializable so applied == n). Init only.
Reset the commit-order counter AND the applied high-water mark to `n` (recovery seeds them to the max replayed seq: later writes get strictly higher seqs, and the recovered data is already materializable so applied == n). Init only.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |