<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Design on Mimus</title><link>https://mimus.pgsty.com/docs/etcd/design/</link><description>Recent content in Design on Mimus</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Sun, 06 Dec 2026 15:37:05 +0800</lastBuildDate><atom:link href="https://mimus.pgsty.com/docs/etcd/design/index.xml" rel="self" type="application/rss+xml"/><item><title>MVP goal (v0.1.0)</title><link>https://mimus.pgsty.com/docs/etcd/design/mvp-goal/</link><pubDate>Sun, 08 Nov 2026 00:00:00 +0800</pubDate><guid>https://mimus.pgsty.com/docs/etcd/design/mvp-goal/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Approved by the user on 2026-11-08. It replaces the 0119 completion objective and &amp;ldquo;P3 OPEN&amp;rdquo; as the current completion condition, and applies to the &lt;code&gt;v0.1.0-rcN&lt;/code&gt; candidates; the current one is &lt;code&gt;v0.1.0-rc2&lt;/code&gt; (commit &lt;code&gt;81691bc&lt;/code&gt;). Distilled from companion record 0357, which is kept as history and no longer updated. The &lt;a href="https://mimus.pgsty.com/docs/etcd/design/review-2026-11-08/"&gt;2026-11-08 status review&lt;/a&gt; explains why the goal changed.&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="done"&gt;Completion condition&#10;&lt;/h2&gt;&#10;&lt;p&gt;The only current completion condition is the MVP release candidate &lt;code&gt;v0.1.0-rcN&lt;/code&gt;. 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.&lt;/p&gt;</description></item><item><title>Status review, 2026-11-08</title><link>https://mimus.pgsty.com/docs/etcd/design/review-2026-11-08/</link><pubDate>Sun, 08 Nov 2026 00:00:00 +0800</pubDate><guid>https://mimus.pgsty.com/docs/etcd/design/review-2026-11-08/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Review conclusion dated 2026-11-08. It applies to the repository as it stood that morning (one commit, &lt;code&gt;b4f5c72&lt;/code&gt;) and records the outcome up to &lt;code&gt;v0.1.0-rc2&lt;/code&gt; (commit &lt;code&gt;81691bc&lt;/code&gt;). The decisions it led to are in the &lt;a href="https://mimus.pgsty.com/docs/etcd/design/mvp-goal/"&gt;MVP goal&lt;/a&gt;.&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="question"&gt;Question&#10;&lt;/h2&gt;&#10;&lt;p&gt;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.&lt;/p&gt;</description></item><item><title>The frozen native line</title><link>https://mimus.pgsty.com/docs/etcd/design/native-line/</link><guid>https://mimus.pgsty.com/docs/etcd/design/native-line/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Condensed from &lt;strong&gt;Design 0119&lt;/strong&gt; (2026-10-16), &lt;strong&gt;Design 0320&lt;/strong&gt; (2026-10-26), and &lt;strong&gt;Design 0357&lt;/strong&gt; (2026-11-08). Over 340 records in the companion repository (&lt;code&gt;0009&lt;/code&gt;–&lt;code&gt;0356&lt;/code&gt;) belong to this experimental P3 &amp;ldquo;native&amp;rdquo; line, which was frozen on 2026-11-08 when the project adopted the &lt;a href="https://mimus.pgsty.com/docs/etcd/design/mvp-goal/"&gt;MVP goal&lt;/a&gt;. The &lt;a href="https://mimus.pgsty.com/docs/etcd/design/review-2026-11-08/"&gt;2026-11-08 status review&lt;/a&gt; explains why.&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="goal"&gt;Goal of the native line&#10;&lt;/h2&gt;&#10;&lt;p&gt;After freezing the P0–P2 single-primary candidates on 2026-10-08, the experimental P3 line explored whether a gateway could precharge and bound &lt;em&gt;every byte&lt;/em&gt; 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 (&lt;code&gt;32 MiB&lt;/code&gt; Raw, &lt;code&gt;15 MiB&lt;/code&gt; Work, &lt;code&gt;32 MiB&lt;/code&gt; Backing).&lt;/p&gt;</description></item><item><title>Recovery design</title><link>https://mimus.pgsty.com/docs/etcd/design/recovery/</link><guid>https://mimus.pgsty.com/docs/etcd/design/recovery/</guid><description>&lt;div class="td-callout td-callout--important" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-exclamation" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Important&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;The offline protocol recovery tool (&lt;code&gt;pgetcd-restore&lt;/code&gt;) and per-gateway publication revision journals (&lt;code&gt;PGETCD_REVISION_JOURNAL&lt;/code&gt;) were prototyped in P3 research candidates (&lt;code&gt;1212/v5&lt;/code&gt; and &lt;code&gt;1216/v4&lt;/code&gt;, 2026-10-14) and are &lt;strong&gt;not included in the MVP release tree (&lt;code&gt;v0.1.0-rc1&lt;/code&gt;, &lt;code&gt;v0.1.0-rc2&lt;/code&gt;)&lt;/strong&gt;. This page documents their design as part of the post-MVP roadmap.&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="problem"&gt;Why physical PITR needs protocol rebasing&#10;&lt;/h2&gt;&#10;&lt;p&gt;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 &lt;code&gt;R_restored&lt;/code&gt; that is lower than the highest revision &lt;code&gt;R_exposed&lt;/code&gt; already returned to etcd clients before the outage.&lt;/p&gt;</description></item><item><title>High availability roadmap</title><link>https://mimus.pgsty.com/docs/etcd/design/ha-roadmap/</link><guid>https://mimus.pgsty.com/docs/etcd/design/ha-roadmap/</guid><description>&lt;div class="td-callout td-callout--important" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-exclamation" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Important&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Production high availability is a &lt;strong&gt;post-MVP roadmap&lt;/strong&gt; design (&lt;code&gt;Planned&lt;/code&gt;). The current MVP release candidate (&lt;code&gt;v0.1.0-rc2&lt;/code&gt;) 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.&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="topology"&gt;Target topology&#10;&lt;/h2&gt;&#10;&lt;p&gt;The post-MVP production HA design calls for three PostgreSQL 18 data nodes, an independent Distributed Consensus Store (DCS), and at least two stateless &lt;code&gt;pgetcd&lt;/code&gt; gateways per tenant. The PostgreSQL cluster and its DCS must bootstrap independently—never host a Patroni cluster&amp;rsquo;s own DCS inside the &lt;code&gt;pgetcd&lt;/code&gt; service backed by that same PostgreSQL cluster.&lt;/p&gt;</description></item><item><title>Runtime boundary</title><link>https://mimus.pgsty.com/docs/etcd/design/runtime-boundary/</link><guid>https://mimus.pgsty.com/docs/etcd/design/runtime-boundary/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Condensed from &lt;strong&gt;Design 0004&lt;/strong&gt; (accepted 2026-10-08).&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="decision"&gt;Decision&#10;&lt;/h2&gt;&#10;&lt;p&gt;Within Mimus, &lt;code&gt;pgetcd&lt;/code&gt; implements the etcd v3 gRPC gateway and &lt;code&gt;pg_etcd&lt;/code&gt; C extension, alongside &lt;code&gt;pgsilo&lt;/code&gt; / &lt;code&gt;pgs3&lt;/code&gt; for S3 object storage and &lt;code&gt;pgredis&lt;/code&gt; for Redis. Although an earlier parent plan (&amp;ldquo;WOK&amp;rdquo;) considered combining the Go gateways for etcd, S3, and Redis into a single multi-protocol Go daemon, Design 0004 keeps the current &lt;code&gt;pgetcd&lt;/code&gt; binary, module name, &lt;code&gt;pg_etcd&lt;/code&gt; extension, and internal &lt;code&gt;pg_kvcore&lt;/code&gt; boundary separate until shared runtime integration is explicitly designed and verified.&lt;/p&gt;</description></item><item><title>Lease, Watch and history</title><link>https://mimus.pgsty.com/docs/etcd/design/lease-watch-history/</link><guid>https://mimus.pgsty.com/docs/etcd/design/lease-watch-history/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Condensed from &lt;strong&gt;Design 0007&lt;/strong&gt; (accepted 2026-10-08).&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="lease"&gt;Lease durability and full-TTL rebuild&#10;&lt;/h2&gt;&#10;&lt;p&gt;pgetcd stores durable Lease facts—Lease ID, a 128-bit grant generation (&lt;code&gt;grant_hi&lt;/code&gt;, &lt;code&gt;grant_lo&lt;/code&gt;), granted TTL (&lt;code&gt;granted_ttl_sec&lt;/code&gt;), renewal sequence (&lt;code&gt;renew_seq&lt;/code&gt;), and attached-key byte ledgers—in &lt;code&gt;etcd.leases&lt;/code&gt;. Monotonic expiration deadlines live in shared memory managed by a supervised PostgreSQL background worker (&lt;code&gt;pg_etcd&lt;/code&gt; preload).&lt;/p&gt;&#10;&lt;p&gt;Before deciding whether a Lease has expired, the extension acquires locks in strict &lt;code&gt;etcd.meta&lt;/code&gt;-then-&lt;code&gt;etcd.leases&lt;/code&gt; order and refreshes shared-memory state from any newer committed &lt;code&gt;renew_seq&lt;/code&gt;. It never holds a shared-memory lock while waiting for a PostgreSQL row lock.&lt;/p&gt;</description></item><item><title>Certified publication</title><link>https://mimus.pgsty.com/docs/etcd/design/certified-publication/</link><guid>https://mimus.pgsty.com/docs/etcd/design/certified-publication/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Condensed from &lt;strong&gt;Design 0006&lt;/strong&gt; (accepted 2026-10-08).&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="decision"&gt;Decision&#10;&lt;/h2&gt;&#10;&lt;p&gt;Before sending any state-observing gRPC response to a client, pgetcd requires two steps:&lt;/p&gt;&#10;&lt;ol class="steps"&gt;&#10;&lt;li&gt;&lt;strong&gt;In-transaction certification&lt;/strong&gt;: Capture a consistent post-lock snapshot inside &lt;code&gt;pg_etcd&lt;/code&gt;. If the request does not already write WAL after that observation (for example, a read or a failed comparison), update the logged counter in &lt;code&gt;etcd.publication_barrier&lt;/code&gt;.&lt;/li&gt;&#10;&lt;li&gt;&lt;strong&gt;Synchronous commit before publication&lt;/strong&gt;: Buffer the provisional response in the gateway&amp;rsquo;s Publisher component and execute a synchronous &lt;code&gt;COMMIT&lt;/code&gt; (&lt;code&gt;synchronous_commit = on&lt;/code&gt;). Release the buffered response to the gRPC stream only after &lt;code&gt;COMMIT&lt;/code&gt; succeeds with zero PostgreSQL warnings.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;This rule applies to &lt;code&gt;Range&lt;/code&gt;, read-only or false-branch &lt;code&gt;Txn&lt;/code&gt; replies, Watch creation (&lt;code&gt;Created&lt;/code&gt;), Watch event batches, Watch progress notifications, &lt;code&gt;MemberList&lt;/code&gt;, &lt;code&gt;Status&lt;/code&gt;, and state-dependent errors (&lt;code&gt;ErrCompacted&lt;/code&gt;, &lt;code&gt;ErrFutureRev&lt;/code&gt;, &lt;code&gt;ErrLeaseNotFound&lt;/code&gt;).&lt;/p&gt;</description></item><item><title>PostgreSQL as the authority</title><link>https://mimus.pgsty.com/docs/etcd/design/postgresql-authority/</link><guid>https://mimus.pgsty.com/docs/etcd/design/postgresql-authority/</guid><description>&lt;div class="td-callout td-callout--note" role="note"&gt;&#10; &lt;div class="td-callout__title"&gt;&lt;i class="td-callout__icon fa-solid fa-circle-info" aria-hidden="true"&gt;&lt;/i&gt;&lt;span class="td-callout__label"&gt;Note&lt;/span&gt;&lt;/div&gt;&#10; &lt;div class="td-callout__body"&gt;&#10;&lt;p&gt;Condensed from &lt;strong&gt;Design 0005&lt;/strong&gt; (accepted 2026-10-08, following architecture v1.0 dated 2026-10-05).&lt;/p&gt;&#10; &lt;/div&gt;&#10;&lt;/div&gt;&lt;h2 id="decision"&gt;Decision&#10;&lt;/h2&gt;&#10;&lt;p&gt;pgetcd splits the etcd v3 server into a stateless Go protocol gateway (&lt;code&gt;pgetcd&lt;/code&gt;) and a single C/PGXS PostgreSQL extension (&lt;code&gt;pg_etcd&lt;/code&gt;, with internal C helpers in &lt;code&gt;pg_kvcore&lt;/code&gt; linked into the same shared library). PostgreSQL 18 is the implementation baseline.&lt;/p&gt;&#10;&lt;p&gt;All authoritative state—current revision &lt;code&gt;R&lt;/code&gt;, compact revision &lt;code&gt;C&lt;/code&gt;, history floor &lt;code&gt;F&lt;/code&gt;, 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.&lt;/p&gt;</description></item></channel></rss>