This is the multi-page printable view of this section.
Design
- 1: PostgreSQL as the authority
- 2: Certified publication
- 3: Lease, Watch and history
- 4: Runtime boundary
- 5: High availability roadmap
- 6: Recovery design
- 7: The frozen native line
- 8: Status review, 2026-11-08
- 9: MVP goal (v0.1.0)
pgetcd’s companion repository accumulated 357 dated design and implementation records during development. This section condenses the architectural decisions that govern the current codebase and separates the active MVP scope from post-MVP roadmap and frozen research work.
Current goal and review
- Status review, 2026-11-08 — Where the project stood before the MVP decision: code almost untracked, P3 drifted into kernel accounting, and why the work did not converge; with the outcome up to
v0.1.0-rc2. - MVP goal (v0.1.0) — Approved on 2026-11-08: the
v0.1.0-rcNrelease candidate is the only completion condition, with the single-primary scope, the lean release checklist and the rule that verification stays proportionate to an MVP. The current candidate isv0.1.0-rc2(commit81691bc).
Core architecture decisions
- PostgreSQL as the authority — Why revisions, transactions, Leases, and event history live in logged PostgreSQL tables under a single meta-row lock rather than sequences or gateway caches (Design 0005).
- Certified publication — Why read requests write a WAL barrier, why responses wait for synchronous
COMMIT, and why unknown commits are never replayed (Design 0006). - Lease, Watch and history — Why Lease deadlines rebuild with a full TTL on restart, why
NOTIFYis only a wake hint, and how anchor generations support atomic compaction (Design 0007). - Runtime boundary — Why
pgetcd,pgsilo, andpgrediskeep separate gateway processes and extensions until shared runtime integration is built (Design 0004).
Post-MVP roadmap and research
- High availability roadmap — Target 3-node synchronous replication topology, primary fencing requirements, and single-container fault-injection findings (Design 0028, Design 0119).
- Recovery design — Point-in-time recovery protocol rebasing (
pgetcd-restore) and per-gateway publication revision journals (Design 0029, Design 0030). - The frozen native line — Summary of the 340+ records exploring custom wire stacks, Go runtime accounting, and the Linux shared-kernel accounting boundary (Design 0119, Design 0320, Design 0357).
1 - PostgreSQL as the authority
Condensed from Design 0005 (accepted 2026-10-08, following architecture v1.0 dated 2026-10-05).
Decision
pgetcd splits the etcd v3 server into a stateless Go protocol gateway (pgetcd) and a single C/PGXS PostgreSQL extension (pg_etcd, with internal C helpers in pg_kvcore linked into the same shared library). PostgreSQL 18 is the implementation baseline.
All authoritative state—current revision R, compact revision C, history floor F, live KV rows, complete event history, revision manifests, Lease records, and cluster identity—lives in regular WAL-logged PostgreSQL tables inside the tenant database. Protocol reads and writes both route to the PostgreSQL primary.
Each logical etcd request executes inside one READ COMMITTED transaction:
- Lock the single row in
etcd.meta(SELECT ... FOR UPDATE). - Acquire a fresh PostgreSQL snapshot after the lock wait completes.
- Evaluate the request against that snapshot.
- Allocate at most one revision (
R + 1) if the request performs one or more actual KV mutations; leaveRunchanged on reads, no-op deletes, Lease-only operations,Compact, or rollbacks.
Why sequences and gateway caches are rejected
PostgreSQL SEQUENCE (nextval) advances outside transactional commit order: if two transactions call nextval concurrently or one rolls back, committed rows can appear out of revision order or contain uncompacted revision gaps, breaking etcd Watch cursors and Txn revision comparisons.
Similarly, caching the current revision or Lease expiration clock inside the Go gateway breaks as soon as two gateway processes share a tenant database or a gateway restarts. Keeping etcd.meta and etcd.leases in logged tables makes PostgreSQL the single source of truth across gateway restarts and multi-gateway deployments.
Keeping pg_kvcore as an internal static library inside pg_etcd avoids stabilizing a second public C/SQL ABI before another extension needs it.
Costs and trade-offs
Locking etcd.meta per request provides strict per-tenant serial ordering and a simple post-lock snapshot invariant, at the cost of serializing requests within a single tenant database.
Every mutation writes live KV state, complete new/previous event tuples, and a revision manifest row into WAL, requiring regular PostgreSQL VACUUM and sufficient background worker capacity. Multi-request batching and table partitioning require separate designs and are outside the MVP scope. See Transactions and revisions and Schema.
2 - Certified publication
Condensed from Design 0006 (accepted 2026-10-08).
Decision
Before sending any state-observing gRPC response to a client, pgetcd requires two steps:
- In-transaction certification: Capture a consistent post-lock snapshot inside
pg_etcd. If the request does not already write WAL after that observation (for example, a read or a failed comparison), update the logged counter inetcd.publication_barrier. - Synchronous commit before publication: Buffer the provisional response in the gateway’s Publisher component and execute a synchronous
COMMIT(synchronous_commit = on). Release the buffered response to the gRPC stream only afterCOMMITsucceeds with zero PostgreSQL warnings.
This rule applies to Range, read-only or false-branch Txn replies, Watch creation (Created), Watch event batches, Watch progress notifications, MemberList, Status, and state-dependent errors (ErrCompacted, ErrFutureRev, ErrLeaseNotFound).
A single certified snapshot can serve multiple Watch streams during one tail cycle, but an earlier barrier never certifies a snapshot taken later.
Why read barriers are required
In PostgreSQL synchronous replication, a committing backend writes its WAL record and makes the transaction locally visible in shared memory before waiting for the synchronous standby to flush WAL. If an operator cancels that backend (pg_cancel_backend), terminates it, or restarts the primary before the standby acknowledges the LSN, another local backend running a plain SELECT can read locally visible rows that never reached the synchronous standby. If a failover then promotes the standby, any etcd response derived from that uncertified read would violate linearizability.
By writing a WAL-logged row to etcd.publication_barrier after taking the read snapshot and requiring that transaction’s own synchronous COMMIT to succeed without warnings, pgetcd guarantees that the standby has flushed both the barrier’s LSN and every earlier LSN visible in the read snapshot.
Plain SELECT queries, empty transactions, pg_current_wal_lsn() reads, UNLOGGED table writes, or barriers written before the snapshot do not establish this WAL ordering. The trade-off is that every read and state-dependent error pays a small WAL write and synchronous commit round-trip.
Unknown commit outcomes
The Publisher retains its database connection and inflight admission slot until COMMIT returns a known result. If COMMIT fails, returns a PostgreSQL warning (such as a canceled synchronous-replication wait), or loses its connection before the result is known, the buffered gRPC response is discarded and an error is returned to the client.
The gateway never automatically replays a transaction whose COMMIT outcome is unknown, because the transaction may have committed on the server just before the connection dropped. Retrying clients must resolve ambiguity using Txn predicates or application idempotency keys. See Transactions and revisions.
3 - Lease, Watch and history
Condensed from Design 0007 (accepted 2026-10-08).
Lease durability and full-TTL rebuild
pgetcd stores durable Lease facts—Lease ID, a 128-bit grant generation (grant_hi, grant_lo), granted TTL (granted_ttl_sec), renewal sequence (renew_seq), and attached-key byte ledgers—in etcd.leases. Monotonic expiration deadlines live in shared memory managed by a supervised PostgreSQL background worker (pg_etcd preload).
Before deciding whether a Lease has expired, the extension acquires locks in strict etcd.meta-then-etcd.leases order and refreshes shared-memory state from any newer committed renew_seq. It never holds a shared-memory lock while waiting for a PostgreSQL row lock.
When PostgreSQL or the Lease background worker restarts, tenant readiness (/readyz) closes while a new worker generation reconstructs runtime deadlines from etcd.leases. Every surviving Lease receives a full granted_ttl_sec starting from the reconstruction timestamp before readiness reopens. This conservative choice prevents premature Lease revocation and accidental key deletion across restarts, at the cost of delaying expiry by up to one full TTL per restart.
Watch event boundaries and wake hints
etcd.events stores both the complete new tuple and the complete previous tuple (prev_*) for every PUT and DELETE, paired with a per-revision summary in etcd.revision_manifest. The gateway’s Watch service reads events through etcd._tail_v2, verifies the manifest’s event count and byte budgets, certifies the scanned watermark, and advances watcher cursors only across complete revisions.
PostgreSQL LISTEN / NOTIFY messages are treated strictly as wake hints. A missed notification never loses events or stalls a stream permanently, because periodic polling (watch.poll_interval_ms) reads the durable event table directly. Stream-wide progress (watch_id = -1) is emitted only when every watcher on the stream is caught up; a Created response confirms registration only, not historical catch-up.
History anchors and atomic compaction
Rather than mutating historical events in place, Compact(rev) builds a complete baseline snapshot of all live keys at revision rev inside etcd.history_anchor under a new generation number. Within the same transaction, it updates etcd.meta to switch anchor_generation and set F = C = rev, then deletes older anchor generations and events strictly below F.
Events at the boundary revision F itself—including DELETE tombstones—remain in etcd.events. Keeping boundary tombstones ensures that historical Range reconstruction at F properly masks deleted keys and that Watch streams starting at F still observe the deletion event. See Watch, Lease and history.
4 - Runtime boundary
Condensed from Design 0004 (accepted 2026-10-08).
Decision
Within Mimus, pgetcd implements the etcd v3 gRPC gateway and pg_etcd C extension, alongside pgsilo / pgs3 for S3 object storage and pgredis for Redis. Although an earlier parent plan (“WOK”) considered combining the Go gateways for etcd, S3, and Redis into a single multi-protocol Go daemon, Design 0004 keeps the current pgetcd binary, module name, pg_etcd extension, and internal pg_kvcore boundary separate until shared runtime integration is explicitly designed and verified.
Why gateways stay separate
Each protocol gateway has distinct network framing, concurrency patterns, and PostgreSQL failure semantics:
- etcd (
pgetcd) requires HTTP/2 gRPC with tenant mTLS, per-requestetcd.metaserialization, read certification barriers, synchronousCOMMITbefore response publication, and a preloaded C background worker for Lease expiration. - S3 (
pgsilo) streams large binary object payloads over HTTP/1.1 with SigV4 authentication and chunked transfer encoding. - Redis (
pgredis) serves RESP2/RESP3 commands over persistent TCP connections with pub/sub and blocking list semantics.
Merging these listeners into one process without unified admission control would allow a memory spike or slow stream in one protocol to starve Lease keepalives or Watch delivery in pgetcd.
Requirements for future integration
Before any shared gateway runtime or cross-protocol extension layer is adopted, it must define and test:
- Process lifecycle, configuration reload, and per-protocol memory/connection admission limits.
- Tenant isolation and credential mapping across protocols.
- Explicit rules for whether protocols share a database, schema, or transaction boundary.
In the current architecture, each protocol installs its own schema and keeps its acceptance and release regression evidence independent. Passing an etcd regression suite does not certify another protocol or cross-protocol table access. See Architecture and Status.
5 - High availability roadmap
Production high availability is a post-MVP roadmap design (Planned). The current MVP release candidate (v0.1.0-rc2) runs against a single PostgreSQL 18 primary and does not automate primary failover or fencing; after a primary switchover, operators must restart the pgetcd gateway.
Target topology
The post-MVP production HA design calls for three PostgreSQL 18 data nodes, an independent Distributed Consensus Store (DCS), and at least two stateless pgetcd gateways per tenant. The PostgreSQL cluster and its DCS must bootstrap independently—never host a Patroni cluster’s own DCS inside the pgetcd service backed by that same PostgreSQL cluster.
The target Patroni synchronous replication settings are:
To prevent split-brain writes or stale reads during a network partition, an isolated or stalled old primary must be fenced via hardware/kernel watchdog.mode: required or validated STONITH before a standby promotes. A VIP, load balancer health check, or SQL pg_is_in_recovery() query is not a substitute for primary fencing.
Admission and route retirement
In the target HA lifecycle, each gateway incarnation starts with client admission closed. Opening admission requires verifying:
- Valid primary authority and an eligible synchronous standby.
- Matching database identity, extension version (
0.1.0), schema version (2), and SQL ABI (1). - A successful logged publication barrier commit.
- Completed Lease background worker reconstruction for the current worker generation.
When primary authority or worker readiness is lost, the gateway must immediately close new request admission, terminate active Watch delivery, and wait for in-flight SQL connections and sender goroutines to drain before retiring the route.
Component fault-injection findings (Design 0028)
On 2026-10-14, research candidate 1205/v6 ran component-level synchronous replication and physical promotion fault tests on Linux amd64 with PostgreSQL 18.6 (three PostgreSQL instances per test container):
| Fault test | Result | Observed behavior |
|---|---|---|
| Abnormal SyncRep writer | 102 / 102 PASS (34 cancel, 34 terminate, 34 disconnect) | Local state left visible by a canceled SyncRep wait is withheld by the read barrier; canceling the barrier returns zero bytes; restoring the synchronous standby allows a normal COMMIT to publish |
| Protocol observation gating | PASS | Range, read-only Txn, and state-dependent Compact errors wait for synchronous barrier certification before leaving the gateway |
| Fresh Lease promotion | 50 / 50 PASS | After synchronous flush/replay and standby promotion, the new Lease worker reconstructs durable Leases with a new owner generation and a full TTL; synchronous standby covers the new watermark |
| Old-primary crash and restart | 1 / 1 PASS | Crashed primary recovers local state but withholds uncertified reads until synchronous replication and qualified promotion complete |
These runs validated the C extension and Publisher COMMIT invariants across physical replication promotions inside a single container. They do not establish multi-host network partition tolerance, independent DCS/watchdog fencing, or automatic gateway endpoint switching.
Post-MVP acceptance gates
Before claiming production HA support in a future release, the roadmap (Design 0119 / ha-recovery) requires:
| Area | Target gate |
|---|---|
| Failover promotions | At least 50 planned and fault-driven promotions in a 3-node PostgreSQL + independent DCS + 2-gateway topology, with target RTO <= 30 s when an eligible synchronous candidate exists |
| Synchronous replication faults | At least 100 seeded abnormal SyncRep fault scenarios with zero exposed uncertified state |
| Endurance | 72-hour mixed-fault run with zero linearizability violations, premature Lease expirations, or silent Watch stalls |
| Multi-tenant capacity | Measured steady-state runs across 1, 3, and 20 tenants (requiring an extension of the current 8-database Lease worker allowlist) |
Upgrade boundaries
Rolling gateway upgrades require a compatible SQL ABI (etcd._abi()). An incompatible pg_etcd extension upgrade requires a maintenance window: draining gateways, taking a verified backup, running the SQL migration, restarting PostgreSQL sessions that loaded the old shared library, and verifying /readyz before reopening client traffic.
6 - Recovery design
The offline protocol recovery tool (pgetcd-restore) and per-gateway publication revision journals (PGETCD_REVISION_JOURNAL) were prototyped in P3 research candidates (1212/v5 and 1216/v4, 2026-10-14) and are not included in the MVP release tree (v0.1.0-rc1, v0.1.0-rc2). This page documents their design as part of the post-MVP roadmap.
Why physical PITR needs protocol rebasing
When PostgreSQL restores a physical base backup and replays archived WAL to a recovery target (Point-in-Time Recovery, or PITR), the restored database state can end at a revision R_restored that is lower than the highest revision R_exposed already returned to etcd clients before the outage.
If a gateway reopened traffic directly on R_restored:
- Subsequent writes would reuse revisions
R_restored + 1 .. R_exposedwith different keys and values, violating etcd revision monotonicity. - Active Watch clients holding cursors at
R_exposedwould either stall waiting for future revisions or silently miss the state rollback.
Safe recovery therefore requires knowing a trustworthy upper bound on R_exposed, rebasing the database’s current and compact revisions strictly above max(R_exposed, R_restored), and rotating the logical cluster_id and member_id so clients detect a new cluster incarnation and relist.
Per-gateway revision journals (Design 0030)
If the original PostgreSQL primary is still accessible in maintenance mode after traffic drains, an operator can query its final etcd.meta.revision directly. If the primary disk is lost, however, the backup alone does not record how many later revisions gateways published before the crash.
Design 0030 (prototyped in candidate 1216/v4) addresses this by wrapping the gateway’s Publisher with an optional per-gateway revision journal (PGETCD_REVISION_JOURNAL):
- At startup, the gateway records the source database and cluster identity in its local journal file before opening client listeners.
- After each normal synchronous
COMMIT, the wrapper writes any new high-water revision to the journal and callsfsyncbefore returning the KV, Lease, Watch, or diagnostic result to the client. - If writing or syncing the journal fails (for example,
ENOSPC), the wrapper withholds the gRPC response and closes admission for subsequent SQL calls.
During recovery after source loss, the operator collects the journal files from all gateways that served the tenant and merges them with the verified physical backup_manifest (pgetcd-restore export-journals) to establish a conservative upper bound R_exposed without needing a connection to the lost primary.
Transactional protocol rebase (Design 0029)
Once PostgreSQL finishes physical PITR in maintenance mode (with shared_preload_libraries = '' so the Lease worker does not start prematurely), Design 0029 (prototyped in candidate 1212/v5) runs a single READ COMMITTED transaction (pgetcd-restore restore):
- Lock
etcd.metaand take a fresh snapshot. - Verify that the restored database’s system identifier and prior logical identity match the exported recovery manifest.
- Compute the new baseline revision
R_new = max(R_exposed, R_restored) + 1, checking for 64-bit integer overflow. - Copy all live rows from
etcd.kvinto a complete new baseline generation inetcd.history_anchor. - Set current revision
R = R_new, compact revisionC = R_new, and history floorF = R_new. - Delete all prior rows in
etcd.events,etcd.revision_manifest, and olderetcd.history_anchorgenerations. - Generate fresh
cluster_idandmember_idvalues inetcd.meta, while preserving liveetcd.kvrows and durableetcd.leasesfacts. - Write a certification update to
etcd.publication_barrierand complete a synchronousCOMMIT.
When PostgreSQL restarts with pg_etcd preloaded, the Lease background worker reconstructs surviving Leases with a full TTL under a new owner generation. Clients reconnecting to the gateway observe the new cluster_id and compact_revision = R_new; old Watch cursors below R_new receive an immediate compaction cancellation (compact_revision = R_new), prompting clients (such as kube-apiserver) to relist at R_new and resume watching from R_new + 1.
Prototype verification and remaining work
In single-container Linux amd64 tests on PostgreSQL 18.6 (2026-10-14):
- Design 0029 (
1212/v5, 6/6 PASS): Restored apg_verifybackup-verified backup to revision7after clients had observed revision10; protocol rebase established baseline revision11with new cluster/member IDs, compacted old Watch cursors, reconstructed Leases with full TTL, and delivered the next Watch write at revision12. Injecting a late constraint failure (SQLSTATE 23514) rolled back all seven tables cleanly. - Design 0030 (
1216/v4, 8/8 PASS): Recovered after stopping the source PostgreSQL instance using two gateway journals (at bounds10and11), rebasing physical PITR revision7to12, and verified that a full journal tmpfs (ENOSPC) withholds the gRPC response after SQL commit.
Bringing pgetcd-restore and revision journals into a future post-MVP release requires packaging the CLI in the main release tree, automating gateway journal inventory across hosts, and integrating post-restore identity re-enrollment.
7 - The frozen native line
Condensed from Design 0119 (2026-10-16), Design 0320 (2026-10-26), and Design 0357 (2026-11-08). Over 340 records in the companion repository (0009–0356) belong to this experimental P3 “native” line, which was frozen on 2026-11-08 when the project adopted the MVP goal. The 2026-11-08 status review explains why.
Goal of the native line
After freezing the P0–P2 single-primary candidates on 2026-10-08, the experimental P3 line explored whether a gateway could precharge and bound every byte of memory and I/O before admitting a request—covering PostgreSQL wire frames, TLS handshakes, Go runtime cold start, garbage-collection workers, and Linux kernel task/socket allocations—under a fixed three-part ledger (32 MiB Raw, 15 MiB Work, 32 MiB Backing).
Under that strict rule, native connection admission (Native CLOSED) remained disabled as long as any cold-start, runtime, or kernel resource category had an unproved upper bound (Known0).
Four phases of research (records 0009–0356)
| Records | Area | What was built and tested |
|---|---|---|
0009–0026 | Custom wire and TLS transport | Fixed-extent Linux TCP socket handling, PostgreSQL SSLRequest framing without plaintext fallback, DER certificate validation, and preallocated TLS record and PostgreSQL StartupMessage / SELECT packet banks |
0031–0118 | Staged capture engine | Staged SQL transaction engine (Before probe, Target primary check, application Execute/TailV2, sole COMMIT, and After diagnostic query), preallocated 1,024-slot I/O books, and Patroni readiness/pidfd shutdown polling |
0119–0318 | Custom Go 1.27 runtime accounting | Custom Go runtime overlays (ABI V1 through V47) tracking cold-start M0 bootstrap allocations, procresize P/M births, g0/gsignal stack spans, mheap page-table levels, and GC worker nodes |
0319–0356 | Linux kernel resource accounting | Source review and isolated guest instrumentation of Debian Linux 6.12.111-1 kernel allocation and retirement paths (alloc_pid, idr_preload, __radix_tree_preload, SLUB caches, and RCU teardown) |
Runtime and shared-kernel accounting boundaries
Two findings showed why exact precharge accounting cannot be closed purely inside a gateway process on a standard runtime and OS kernel:
- Cold-launch
GOMAXPROCS(P) history (Design 0119): The Go runtime does not destroy per-PGC worker goroutines whenGOMAXPROCSdecreases. In candidate1464/v1, a process whosePhistory moved7 -> 11 -> 5 -> 2retained11worker nodes (5,632attributed bytes), whereas point observations of the launch setting (7), firstGOMAXPROCSreturn (5), and currentP(2) only declared7. Point observations at startup cannot certify an unobserved intermediate peak. - Shared Linux kernel caches and RCU retirement (Design 0320): Reviewing Debian kernel
6.12.111-1(1637/kernel-model-v1) showed thatalloc_pidcallsidr_preloadper PID namespace level, and__radix_tree_preloaddrops its local lock around each allocation while refilling a per-CPU radix-node pool that concurrent nonblocking operations can consume. That preload path strips__GFP_ACCOUNTon a slab cache withoutSLAB_ACCOUNT, bypassing SLUB memcg charging. On teardown, PID release and task-stack reclamation wait for asynchronous RCU callbacks and per-CPU caches, sowait4()completion and cgroup counter drops do not prove physical page release. Closing that boundary would require a custom kernel ABI outside PostgreSQL and the Go gateway.
Why the native line was frozen (Design 0357)
Because requiring a custom Go runtime overlay and a custom Linux kernel accounting ABI prevented shipping a usable etcd-on-PostgreSQL gateway, Design 0357 froze the entire P3 native line on 2026-11-08:
- All P3 candidate trees are preserved as research material and are disabled in the default gateway build.
- The MVP candidates (
v0.1.0-rc1,v0.1.0-rc2) build directly from the root Go 1.27.3 source tree andpg_etcdC extension, enforcing request, stream, and revision budgets at the protocol and SQL boundaries while relying on standard PostgreSQL 18 and OS resource management. See Status and Releases.
8 - Status review, 2026-11-08
Review conclusion dated 2026-11-08. It applies to the repository as it stood that morning (one commit, b4f5c72) and records the outcome up to v0.1.0-rc2 (commit 81691bc). The decisions it led to are in the MVP goal.
Question
pgetcd had been in development for about a month and kept testing without closing out. The review asked three things: what the code and tests had actually reached, why the work did not converge, and whether a basic version could be cut.
State at the review
- The single-primary subset was already accepted. On 2026-10-08 a frozen candidate passed P0 (17 items), P1 (22 groups, including a 1,000,000-call model and Watch audit) and P2 (20 groups, including the selected Kubernetes 1.36.4 / 1.37.1 conformance sets with 446 / 462 cases). It covered KV, Txn, Watch, Lease, logical Compact,
MemberListandStatuson one PostgreSQL primary. - Almost no code was in Git. The repository had one commit (
b4f5c72, 2026-10-22), a Go 1.27.3 dependency upgrade with 38 files. About 1,226 files, including the gateway command and the extension, were untracked. A clean checkout ofHEADcould not build the gateway. - The root tree had drifted from the accepted candidate. It stopped changing in mid-October except for the dependency upgrade. Compared with the frozen P2 gateway sources, 14 of 57 files differed, and the root tree had not been re-verified.
- P3 had moved away from etcd. P3 started as production HA. It then grew into an own PostgreSQL wire and TLS stack (records 0009–0118), a custom Go 1.27 runtime with byte-level memory accounting (0119–0318), and finally a patched Linux kernel with SLUB and memblock accounting (0319–0356, kernel ABI 148). The rule was that native admission stays closed until every cost category under fixed 32/15/32 MiB budgets is proven, so the target had no reachable end.
- The root tree still worked. On the review host the gateway built,
go test ./...reported 5,164 PASS / 6 FAIL / 39 SKIP (all failures in a P3 source-constraint test), and the Watch and gateway race integration passed 88 tests on a real PostgreSQL 18.6 with the official clientv3 3.6.15 and 3.7.2. - Nothing was running. The last test output was from 2026-11-04.
Why the work did not converge
- An unbounded completion target. The P3 objective required every runtime, allocator, kernel and physical cost to be proven before HA testing could even begin. Each lower layer exposed new unproven costs.
- Full revalidation for every change. Any source change required a new immutable evidence epoch, rebuilds, paired counterexamples, two-site archive readback and bilingual documentation. The project accumulated about 840 P3 evidence epochs, about 215 kernel builds and about 600 companion pages.
- Deterministic, self-imposed failures. Most failures were capacity shortfalls against the project’s own budgets, not flaky tests.
- Nothing was ever promoted. Candidates lived outside the root tree and the code was not committed, so at no point was there a releasable state.
- Environment churn. Cache cleanups removed inputs that the old offline gates needed, so the P2 gate could no longer be reproduced.
Decisions
The user decided on 2026-11-08:
- Freeze the P3 native line. Stop the own wire and TLS stack, the runtime accounting and the kernel accounting. Keep the candidate trees as research material. See The frozen native line.
- Make the MVP release candidate the only completion condition. The MVP goal replaces the 0119 completion objective and “P3 OPEN”.
- Remove defensive testing. Verification must be proportionate to an MVP: no endurance runs, full instrumentation matrices, repeated benchmark rounds, conformance rebuilds or root-cause batches for rare intermittent failures.
- Keep design records here. pgetcd design documents now live in this section.
Outcome
| Step | Commits | Result |
|---|---|---|
| Commit the code | f01c777, 4241ec7, b3d0bd2 | The root tree is in Git; large test inputs and historical notes stay ignored |
| Clear the tests | ff6f7e1, 6486cd1, a7b4206, a8851dd, 7e43446 | P3-only tests isolated behind the pgetcd_p3 build tag, a watchdog test race fixed, go vet clean on macOS and Linux |
v0.1.0-rc1 | 2b36cba, tag on 250df4c | Regression on 7e43446: all items passed except etcdctl endpoint health; benchmarks exposed the gateway withdrawing readiness under load |
v0.1.0-rc2 | fad4d2f, db0577b, 81691bc | Readiness check on a reserved slot, client requests queue up to 5 s, readiness changes logged, Alarm list query added; lean verification passed with 50/50 etcdctl probes and 0 refused requests at 128 clients |
Status lists the remaining known issues of v0.1.0-rc2, including Watch delay under sustained heavy writes.
9 - MVP goal (v0.1.0)
Approved by the user on 2026-11-08. It replaces the 0119 completion objective and “P3 OPEN” as the current completion condition, and applies to the v0.1.0-rcN candidates; the current one is v0.1.0-rc2 (commit 81691bc). Distilled from companion record 0357, which is kept as history and no longer updated. The 2026-11-08 status review explains why the goal changed.
Completion condition
The only current completion condition is the MVP release candidate v0.1.0-rcN. When it is reached, stop and report to the user; do not start a later phase automatically. The 0119 objective and P3 remain as material for later decisions.
Shared principles
pgredis, pgetcd and pgsilo use the same principles.
- Scope freeze. Do only the listed work items and fixes for problems that block the MVP. Do not add features, test tiers, evidence formats or infrastructure.
- Records. At most one short work log per working day. Status pages state the current state and known issues, not a running diary.
- Authorization. Push, remote creation, package or image publication and site deployment each need separate user authorization. Local branch commits are allowed.
- Performance. Publish measured baseline numbers and the test environment. There is no SLA, and performance does not block the release.
Verification
Keep verification proportionate to an MVP: run only functional and smoke tests that finish within minutes, and finish the whole release checklist within one or two hours. Do not run the following, and do not list them as post-MVP gates: long stability or endurance runs, full instrumentation matrices, repeated benchmark rounds, conformance tests that need a large external environment rebuilt, and diagnostic batches that chase the root cause of rare intermittent problems. If one is needed later, the user asks for it separately.
- Run the checklist once on the frozen candidate; during development run only the items a change affects. Record each item as pass, fail or not applicable, with the command and where the raw output is kept.
- Fix each failure, or list it as a known issue and state whether it blocks the release; the user decides.
- Dropped: dual independent review, full revalidation because “older results do not certify changed source bytes”, immutable evidence epochs, paired counterexamples, two-site archive readback and tests of the test infrastructure.
- Kept: no hidden or silently waived failures, and the correctness invariants: publish a response only after synchronous
COMMITsucceeds, never replay an unknownCOMMIT, keep the permission boundaries. A result belongs only to the candidate that produced it.
Scope
Supported in v0.1.0:
- One PostgreSQL 18 primary; one gateway process per tenant; clients connect with mTLS.
- The API accepted in P2:
Range,Put,DeleteRange,Txn,Compact(logical only),LeaseGrant,LeaseRevoke,LeaseTimeToLive,LeaseLeases,LeaseKeepAlive,Watch,MemberListandStatus. Fromv0.1.0-rc2theAlarmlist query is also supported, soetcdctl endpoint healthworks.
The P2 results belong to the frozen candidate of 2026-10-08 and only define the API scope; each release candidate runs its own checklist.
Target use cases:
- Applications that use the etcd Go
clientv3oretcdctl. - Kubernetes apiserver storage for small clusters or development and test clusters.
Not supported:
- HA semantics. After a PostgreSQL primary switchover, the operator restarts the gateway. There is no fencing and no response-consistency promise during the switchover.
- Other RPCs.
RangeStream, physicalCompact, Auth/RBAC, membership changes, other Maintenance RPCs (Snapshot, Defragment, Hash, alarm activation) and Lock/Election. - An HTTP/JSON gateway, and therefore Patroni. Patroni’s
etcd3client uses the HTTP/JSON gateway. This moves to MVP+1. When pgetcd later serves as a Patroni DCS, a different PostgreSQL cluster must host it: a Patroni cluster that hosts its own DCS creates a circular dependency during failover. - Replica reads, more than 8 tenant databases per PostgreSQL instance, in-place upgrade migration and performance SLAs.
Work items
| Item | Outcome |
|---|---|
| Freeze the P3 native line; keep its candidate trees as research material | Done; see The frozen native line |
| Commit the root source; a clean checkout must build the gateway and extension and pass the unit tests | Done (f01c777, 4241ec7, b3d0bd2) |
Clear go test and go vet; isolate P3-only tests; confirm the default gateway path does not enable P3 components | Done (ff6f7e1 through 7e43446) |
| Use the root Go 1.27.3 source as the release baseline and run the checklist on Linux | Done for v0.1.0-rc1 and v0.1.0-rc2 |
Version 0.1.0, Linux amd64/arm64 gateway and PostgreSQL 18 extension archives, scope page, local tag | Done; v0.1.0-rc2 on 81691bc |
Release checklist
| Item | Content |
|---|---|
| Go build and checks | go build ./cmd/..., go test ./..., go vet ./... |
| Extension | Extension build and SQL test suites |
| Watch and gateway | Watch/gateway race integration tests on a real PostgreSQL server |
| Official clients | etcd 3.6 and 3.7 official client probes |
| Primary switchover smoke | Promote a new primary manually, restart the gateway, then confirm that clients reconnect and committed data is intact; this checks the operating requirement only |
| Performance | One set of basic numbers, run once and recorded only |
The P1 mixed model audit (100,000 calls) passed on v0.1.0-rc1 and is no longer required. Kubernetes conformance is outside the MVP verification scope; the upstream k8s.io/apiserver storage probe passed 65 tests each for 1.36 and 1.37 on v0.1.0-rc1 and serves as a reference.
Deferred
- HA support: define its scope and verification when it is needed.
- HTTP/JSON gateway and Patroni validation (MVP+1).
RangeStreamand other unimplemented RPCs.- A dedicated security review.
- The shared Mimus runtime.