mirror of
https://github.com/block/buzz.git
synced 2026-10-28 21:11:48 +00:00
17 lines
822 B
SQL
17 lines
822 B
SQL
-- ── Replica heartbeat (read-replica freshness fence) ─────────────────────────
|
|
-- Portable read-side freshness observation for the replica fence (see
|
|
-- crates/buzz-db/src/replica_fence.rs and migrations/0026). Exactly one row;
|
|
-- the single-row token UPDATE is the serialization point that makes tokens
|
|
-- globally commit-ordered across relay pods. `epoch` detects token resets
|
|
-- (restore/re-seed) so a stale retained token can never masquerade as fresh
|
|
-- coverage. Deployment-global by design: describes replication topology,
|
|
-- never tenant data.
|
|
|
|
CREATE TABLE replica_heartbeat (
|
|
id smallint PRIMARY KEY CHECK (id = 1),
|
|
epoch uuid NOT NULL DEFAULT gen_random_uuid(),
|
|
token bigint NOT NULL DEFAULT 0
|
|
) WITH (
|
|
vacuum_truncate = false
|
|
);
|