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
Commit cf018e1
Browse filesBrowse the repository at this point in the historyBrowse files
relay: gate push enqueue on live leases; batch matcher pipeline
Two write-amplification fixes for the push pipeline (T1a repair, T1b,
T2b of the write-amp plan):
Migration 0023 (T1b push gate): skip the push_match_queue enqueue for
communities with no active, endpoint-enabled, unexpired push lease. In
lease-less communities (most of them) every durable message paid the
full matcher cost — enqueue + claim + lease scan + delete — to conclude
"notify no one". The gate lives in the events trigger so every durable
producer is covered. The lost-wake race (event reads "no lease" while a
lease activation commits concurrently) is closed with a per-community
advisory lock: event inserts take it SHARED, lease transitions that can
make eligibility true (accept_lease_event, replace_lease) take it
EXCLUSIVE, plus a product-recovery backfill on activation.
Migration 0024 (T1a repair): the 0022 TTL-refresh trigger took FOR
UPDATE on the channel row before testing ttl_seconds, so every durable
message in a permanent channel serialized at commit time on that tuple,
each holding it across its WAL flush — one hot channel meant fully
serialized commits (observed live: 0.07ms -> ~15ms commit latency at
200 QPS). The trigger now synchronizes on a shared per-channel advisory
lock; TTL transitions in update_channel take the same key EXCLUSIVE, so
the stale-prefetch proof from 0022 is preserved without serializing the
permanent-channel hot path.
T2b (matcher batching): the relay push matcher now claims per-community
batches (single SKIP LOCKED CTE, cap 64) and loads events, leases, and
channel membership pairs in one statement each; completes and retries
are set-wise under the shared claim fence. One batch costs a constant
number of statements regardless of size. The poison-job reap moves off
the claim path to a 30s sweep (its scan is not served by the due
partial index), and idle matcher/delivery workers back off 250ms -> 2s.
The per-job claim API is deleted, not deprecated — no second code path.
Tests: batch fence contract, single-community batch claim, T1a barrier
(8 concurrent permanent-channel commits, zero channel tuple locks),
T1b forced lost-wake ordering + activation backfill, exhausted-job
sweep. Full buzz-db + buzz-relay suites green on a fresh 0001-0024
database (lone red: api::mesh_demo echo test, also red on main).
Co-authored-by: Tyler Longwell <[email protected]>
Signed-off-by: Tyler Longwell <[email protected]>
0 commit comments