~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zlay

atproto relay in zig · mirror of https://tangled.org/zat.dev/zlay

0
0
68 lines · 4.3 KB Raw History

Requirements before considering a zlay migration

The current pilot is not a migration candidate. Independent readers and correct zio wiring remove the pilot's coarse reader lock, but they do not make its synchronous write-maintenance path comparable to RocksDB. See the million-pair qualification. The next asks should target the measured work rather than introduce a general concurrent database API by assumption.

zlay integration

  1. Define the acceptable freshness and backlog budget. Index acknowledgements currently wait for durable publication and any triggered maintenance. Preserve that guarantee when evaluating alternatives. An asynchronous acknowledgement or unbounded queue would change the problem rather than solve it. Measure scheduled-arrival latency and drain time, including upstream backpressure.
  2. Choose maintenance by bytes and bounded recovery cost. The experimental segment cap is a control, not a proposed default. Larger flushes reduce repeated work but cannot bound a whole-level compaction pause. Retained log segments also cost reader refresh, open, collection and filesystem operations. Keep those costs in the qualification workload.
  3. Complete failure and shutdown qualification before deployment. Exercise the actual write owner under process termination, accepted requests during close, index failure through frame receipts, and persisted replay cursors. Unit tests of the index and receipt tracker separately are not end-to-end cursor proof. A SIGKILL test establishes process-crash recovery, not power-loss durability.
  4. Keep resync ordering explicit. The guard handles locally observed writes during an HTTP snapshot fetch. describeRepo supplies no source revision; it cannot prove that an otherwise quiet snapshot is newer than existing state. Do not claim that the storage substitution fixes this existing relay boundary.

Potential zkv work, conditional on choosing to continue

  1. Bound maintenance work per foreground interruption. Investigate selecting a bounded overlapping key range instead of merging an entire destination level, or separating immutable merge execution from short state publication. Specify crash recovery, fencing, retained input lifetimes and collection behavior first. A worker thread around today's mutable Db is insufficient: it still needs synchronization, and holding the same writer lock preserves the write stall. The existing reader API should remain usable without a new shared-memory reader model.
  2. Expose maintenance cost and debt. Allow an embedder to distinguish pending flush bytes, selected compaction input/output bytes, work completed and remaining debt. Current adapter phase counters locate elapsed time but do not measure bytes rewritten. This is needed to choose and verify a scheduling policy rather than guess from table counts.
  3. Qualify refresh under sustained publication and collection. The caller can retry a scan after Missing, but refresh itself may keep catching up while the writer advances. Establish the latency and failure contract under sustained writes and GC before promising bounded external read time. Preserve visibility of writes acknowledged before a successful fresh read.

These are requirements and possible research directions, not authorization to reshape zkv into RocksDB. RocksDB/Pebble retain read state and publish changes under short synchronization; expensive compaction runs outside that publication step. That prior art explains the ownership problem, but its complexity is not automatically appropriate for this embedded object-store engine. References and the existing API audit are in the reader design.

zeldi compatibility gate

No core zkv change is part of this pilot. Any proposed engine change needs its own case as a strict improvement for zeldi: unchanged format/API semantics or an explicit compatible transition, existing correctness tests, and measured effects on zeldi's actual read/refresh pattern, object-store requests and bytes, memory, startup/recovery and maintenance. A zlay-only latency improvement is insufficient. If achieving the relay's requirements demands tradeoffs that hurt zeldi, retain RocksDB for zlay.