Serialize appends per stream on a node so slow storage does not refuse contended appends #9
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (feature): concurrent writers to one stream on the same node all land their appends on slow storage, instead of a few being refused as
version_conflict.NOT built. Supervisor ruling 2026-12-02 (relayed by Mars): no package until a live mcl-martha cluster shows conflicts hurting a user.
Why
reckon-db's append is optimistic: read the version, build the records outside the transaction, verify the version inside it, and on a lost race pause and retry, up to 60 attempts (
APPEND_ATTEMPTS). On fast storage 20 writers on one stream stay clear of the cap. On slow storage they do not: on a forge runner about 25 times slower than a laptop (about 21 ms per commit), 2 of 2000 appends lost 60 races in a row. On the CI image throttled to--cpus 0.1, 36 of 2000 did (#7). The contract holds (nothing is lost, and the refusal reaches the caller), but the caller has to retry.#7 showed that tuning the pause does not fix this. A pause scaled to the measured attempt time still left 20 writers with at least 7 refusals. Any time budget safely inside reckon-gater's 5 s call timeout turned the slow tail into refusals instead. Retry gives an unlucky writer no fairness.
Sketch
Serialize appends per
{StoreId, StreamId}on the local node, so local writers queue for one stream instead of racing. Only writers on other nodes still race, through the existing guarded retry. Open points for the threat model: a lock holder that dies, a bound on the lock wait below the gateway caller's timeout (see reckon-db-org/reckon-gater#2), and the cost on uncontended streams.Done when
--cpus 0.1stand-in, all 2000 appends land.Refs #7.