The 'postgres' kv-tier engine (ADR-007, feature 'postgres', default-off)
against the wave-1 trait: the sqlite engine's structural twin on a
Pooled-Postgres driver cluster.
- One engine-owned schema (default 'alkblobs'; quoted-identifier
boundary via the alkstore quote_identifier pattern) holding the B5
row shape — key bytea PK / value bytea NOT NULL / size bigint NOT
NULL, WITH (fillfactor = 90) — idempotently bootstrapped at
construction; autovacuum and the ~40x small-tier storage overhead
recorded as posture, not silence
- deadpool pool with DEFAULT_MAX_SIZE = 8 (load-bearing, POC #5 B2);
per-connection prepare_cached discipline (B5: statements die with
sessions); the synchronous_commit parity knob as connect options on
every pooled connection (default 'on', configurable, alkstore
src/opts.rs mechanics)
- CAS first-writer-wins (INSERT ... ON CONFLICT DO NOTHING) on both
put forms; metadata-only size probe riding the PK index (EXPLAIN
gate-tested); EXISTS has; materializing get cursor; degenerate
in-memory stage with both hygiene forms (fail_commit injection)
- list: the single-statement MVCC-snapshot cursor (portal-batched row
stream, keys only); crate-internal batch-delete helper
(DELETE ... WHERE key = ANY() over bytea[]), scope-noted until
wave 6; virgin-store read-only split via SQLSTATE 42P01 mapping
- 15 in-module unit tests, env-driven (ALKBLOBS_PG_*), skipping
cleanly server-less; green against the dockerized pglo-poc harness
server (:15432)
Verified: cargo test; cargo test --features postgres (84 lib tests);
cargo test --all-features (139); clippy all-targets, default +
features + all-features, -D warnings; fmt --check; doc --no-deps.
Five tasks against the wave-3 contract surface as reviewed (no
amendments from the gate):
- engine-postgres: the fleet-capable kv engine — the B5 row shape
(fillfactor 90) in one engine-owned schema, the deadpool pool with
per-connection prepared-statement discipline, the synchronous_commit
parity knob wired per-connection, ON CONFLICT DO NOTHING CAS, the
stable MVCC-snapshot list cursor, the batch-delete helper
(key = ANY($1), consumer wave 6), the read-only virgin-store split
- engine-postgres-fleet: the engine-state seam's full clause families
(ADR-012 §5's postgres row — every family yes): gc_pins + gc_window,
the joint tx ownership rule in the JointTx shape, pin_commit
atomicity, pin_renew/pin_check/arbitrate, the pg advisory lock as
the sweep lease's shipped provider; fleet activation stays wave 6
- store-postgres-construction: KvEngine::Postgres slots in, the
KvCursor arm, the dual-tier/kv-only constructors (DSN + opts +
threshold + window delay), the non-fleet posture recorded, the
pg-pure build verified
- suite-column-postgres: the first SKIP-posture column — the alkstore
pg-factory pattern reused (fresh schema per open, CASCADE teardown,
env-driven ALKBLOBS_PG_* settings), durable-schedule sweep rows,
acceptance green against the harness server (pglo-poc :15432,
verified live)
- review-wave-4: the engine-wave gate (engine-vs-contract conformance)
Verification: dependency graph validated (all ids resolve, no cycles,
topological order clean); docs-only change.
Refs: docs/plans/implementation.md §Wave 4