# The frozen native line

> The native PostgreSQL wire and runtime accounting work, and why it was frozen.

---

LLMS index: [llms.txt](/llms.txt)

---

> [!NOTE]
> 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](/docs/etcd/design/mvp-goal/). The [2026-11-08 status review](/docs/etcd/design/review-2026-11-08/) explains why.

## Goal of the native line {#goal}

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) {#phases}

| 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) |
{.wide}

## Runtime and shared-kernel accounting boundaries {#boundaries}

Two findings showed why exact precharge accounting cannot be closed purely inside a gateway process on a standard runtime and OS kernel:

1. **Cold-launch `GOMAXPROCS` (`P`) history (Design 0119)**: The Go runtime does not destroy per-`P` GC worker goroutines when `GOMAXPROCS` decreases. In candidate `1464/v1`, a process whose `P` history moved `7 -> 11 -> 5 -> 2` retained `11` worker nodes (`5,632` attributed bytes), whereas point observations of the launch setting (`7`), first `GOMAXPROCS` return (`5`), and current `P` (`2`) only declared `7`. Point observations at startup cannot certify an unobserved intermediate peak.
2. **Shared Linux kernel caches and RCU retirement (Design 0320)**: Reviewing Debian kernel `6.12.111-1` (`1637/kernel-model-v1`) showed that `alloc_pid` calls `idr_preload` per PID namespace level, and `__radix_tree_preload` drops 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_ACCOUNT` on a slab cache without `SLAB_ACCOUNT`, bypassing SLUB memcg charging. On teardown, PID release and task-stack reclamation wait for asynchronous RCU callbacks and per-CPU caches, so `wait4()` 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) {#freeze}

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 and `pg_etcd` C 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](/docs/etcd/status/) and [Releases](/docs/etcd/releases/).

---

Backlinks:

- [Security](/docs/etcd/architecture/security/)
- [Design](/docs/etcd/design/)
- [MVP goal (v0.1.0)](/docs/etcd/design/mvp-goal/)
- [Status review, 2026-11-08](/docs/etcd/design/review-2026-11-08/)
- [Releases](/docs/etcd/releases/)
- [Status](/docs/etcd/status/)
