You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
storage: is_vanished takes the single LMDB writer, and commits, on every EVENT #1312
Found by job 045's code lens (row 5 of #868) at 8488bf13.
users::is_vanished returns the stored flag at crates/nostream-storage/src/lmdb/users.rs:113 without writing, but crates/nostream-storage/src/lmdb/mod.rs:886 takes self.write(...), which opens an RwTxn and commits it (the helper at crates/nostream-storage/src/lmdb/mod.rs:470-485), and LMDB admits one writer at a time. The relay asks per event at crates/nostream-relay/src/handlers/event.rs:478. The Postgres arm reads on master and takes a write only when hydrating (crates/nostream-storage/src/postgres/repository.rs:217-226).
Read with find_by_pubkey and take the write only on the hydration branch. Today every event from a non-relay pubkey serialises all writers behind a transaction that usually writes nothing.
Acceptance
A store-wide concurrent-write case shows EVENT admission no longer queues behind the banned-user read.
The read path opens env.read_txn() for a pubkey that is present.
Record: docs/rewrite/reviews/2026-11-30-relay-storage.md — finding F4, lens code, tree 8488bf13.
Closed by a70e1085688b01427bf950b76133b59a5e7620fb (#1389).
is_vanished reads first (self.read + users::find_by_pubkey) and takes the LMDB writer only when no user row exists — the hydration branch, whose body still re-loads before scanning and upserting. The common path no longer opens a write transaction per event, so EVENT admission stops queueing behind a banned-user read.
Measured: before, is_vanished held me_wmutex from begin to commit even though the empty commit wrote nothing (last_txn_id did not move) and did not return within 800/785/786 ms with a writer held, 3 of 3 runs. After: one RoTxn, no RwTxn, and readers take me_rmutex while writers take me_wmutex, so the read holds nothing a writer needs.
The held-writer case is the deterministic form of the acceptance line: one create future blocked against a held writer, is_vanished on a present pubkey answering within the bound, then the writer dropped and the same future re-polled and succeeding. Red with the base body restored (Elapsed(()) after 10.21 s). parity_lmdb 52 passing unchanged, lib 151.
Accepted and stated in the spec: the read is a snapshot, so one event can slip past a racing set_vanished — the same window the Postgres arm already has. The throughput figure (p50/p95 writer wait with and without the read) remains unmeasured for lack of a bench shape.
Activity
perf(storage): read the vanished flag without the LMDB writer (#1312)
chappie-daemon commentedon Dec 4, 2026
Closed by
a70e1085688b01427bf950b76133b59a5e7620fb(#1389).is_vanishedreads first (self.read+users::find_by_pubkey) and takes the LMDB writer only when no user row exists — the hydration branch, whose body still re-loads before scanning and upserting. The common path no longer opens a write transaction per event, so EVENT admission stops queueing behind a banned-user read.Measured: before,
is_vanishedheldme_wmutexfrom begin to commit even though the empty commit wrote nothing (last_txn_iddid not move) and did not return within 800/785/786 ms with a writer held, 3 of 3 runs. After: oneRoTxn, noRwTxn, and readers takeme_rmutexwhile writers takeme_wmutex, so the read holds nothing a writer needs.The held-writer case is the deterministic form of the acceptance line: one
createfuture blocked against a held writer,is_vanishedon a present pubkey answering within the bound, then the writer dropped and the same future re-polled and succeeding. Red with the base body restored (Elapsed(())after 10.21 s).parity_lmdb52 passing unchanged, lib 151.Accepted and stated in the spec: the read is a snapshot, so one event can slip past a racing
set_vanished— the same window the Postgres arm already has. The throughput figure (p50/p95 writer wait with and without the read) remains unmeasured for lack of a bench shape.