# Compatibility

> Supported RPCs, limits, differences from etcd and the evidence behind them.

---

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

---

This page documents the API scope, resource bounds, deliberate behavioral differences, and verification evidence for `pgetcd` `v0.1.0-rc2` (local tag on commit `81691bc`, verified on 2026-11-08) and the earlier 2026-10-08 frozen acceptance candidate (`0.1.0-p1`). `v0.1.0-rc1` (commit `250df4c`) is superseded; its results are kept where noted.

## MVP scope {#scope}

`pgetcd` provides a subset of the etcd v3 gRPC API backed by a single PostgreSQL 18 primary.

| Area | Supported in `v0.1.0-rc2` |
| --- | --- |
| Deployment | One PostgreSQL 18 primary; one gateway process per tenant; one database and one SQL role per tenant |
| KV | `Range`, `Put`, `DeleteRange`, and `Txn`, including historical reads, comparisons, nested branches, and `prev_kv` |
| Compaction | `Compact`, logical compaction only |
| Leases | `LeaseGrant`, `LeaseRevoke`, `LeaseTimeToLive`, `LeaseLeases`, and `LeaseKeepAlive` |
| Watch | Multiple watches per stream, start revisions, filters, `prev_kv`, progress notification, fragmentation, and reconnect |
| Cluster and maintenance | `MemberList` and `Status`, reporting one logical tenant member; the `Alarm` list query, which returns an empty list |
| Client authentication | Mutual TLS with client certificate URI SAN `spiffe://pgetcd/tenant/<tenant>` |
| Platforms | Linux amd64 and arm64; PostgreSQL 18.6 |
{.wide}

Target use cases for the MVP:

- Applications using the official etcd Go `clientv3` or `etcdctl` (configuration, service discovery, and Lease-backed coordination).
- Kubernetes `kube-apiserver` storage for small clusters or development and test clusters.

Not supported in `v0.1.0-rc2`:

- **Unimplemented RPCs (return gRPC `Unimplemented`)**: `RangeStream`, physical `Compact` (`physical=true`), all `Auth`/`User`/`Role` RPCs, cluster membership changes (`MemberAdd`, `MemberRemove`, `MemberUpdate`, `MemberPromote`), Maintenance RPCs other than `Status` and the `Alarm` list query (alarm activation and deactivation, `Defragment`, `Hash`, `HashKV`, `Snapshot`, `MoveLeader`), and the `Lock` and `Election` services.
- **High-availability semantics**: no automatic fencing or response-consistency guarantee across a PostgreSQL primary switchover. After a primary promotion, the operator updates `PGETCD_DSN` and restarts the gateway.
- **HTTP/JSON gateway**: only gRPC is served.
- **Replica reads, more than 8 tenant databases per PostgreSQL instance, in-place schema upgrade migration, or performance SLAs**.

### Why Patroni is not supported {#patroni}

Patroni's `etcd3` client does not speak gRPC. It talks to the etcd HTTP/JSON gateway (`/version`, `/v3/kv/range`, `/v3/kv/txn`, `/v3/lease/grant`, `/v3/watch`). Because `pgetcd` `v0.1.0` serves only gRPC, Patroni cannot use it as a DCS.

An HTTP/JSON gateway and Patroni validation are planned for MVP+1. Even then, a `pgetcd` instance used as a Patroni DCS must run on a separate PostgreSQL cluster; hosting a Patroni cluster's DCS inside the same PostgreSQL cluster creates a circular dependency during failover.

## RPC coverage {#rpc}

| RPC group | Implemented behavior | Operational limit |
| --- | --- | --- |
| `Range`, `Put`, `DeleteRange`, `Txn` | Binary keys and values, historical reads, sorting and filtering, comparisons, nested branches, read-your-own-writes inside a `Txn`, `prev_kv`, and Lease attachment | Bounded request and response sizes; one tenant per request |
| `Compact` | Logical compaction, history anchor advancement, and boundary retention | `physical=true` returns `Unimplemented` |
| `LeaseGrant`, `LeaseKeepAlive`, `LeaseTimeToLive`, `LeaseLeases`, `LeaseRevoke` | Logged Lease table, background worker expiration, and atomic deletion of attached keys on revoke or expiry | One public Lease RPC per PostgreSQL transaction; cannot mix Lease and KV calls in one transaction |
| `Watch` | Multiple watches per stream, create and cancel, filters, `prev_kv`, `RequestProgress`, fragments, and reconnect | Bounded per-tenant stream and buffer quotas; a create response alone does not advance progress |
| `MemberList`, `Status` | One logical tenant member, certified cluster/member identity, current revision, and PostgreSQL relation size | No Raft peer topology |
| `Alarm` (from `v0.1.0-rc2`) | The list query returns an empty list under a certified header; an unready tenant returns `Unavailable` | Alarm activation and deactivation return `Unimplemented` |
{.wide}

Since `v0.1.0-rc2` (commit `81691bc`), `Maintenance.Alarm` answers list queries, so `etcdctl endpoint health` reports healthy: the `etcdctl` 3.6.15 and 3.7.2 probes recorded `50 PASS / 0 FAIL` on 2026-11-08. On `v0.1.0-rc1` the same probes recorded `48 PASS / 2 FAIL`, both `endpoint health`.

## Version baseline and advertised compatibility {#versions}

The root source tree for `v0.1.0-rc2` (commit `81691bc`; no dependency change since `v0.1.0-rc1`) and the 2026-10-08 frozen P0/P1/P2 acceptance candidate use the following component versions (from `versions.lock.json` and the build metadata):

| Component or identifier | `v0.1.0-rc2` root build | 2026-10-08 frozen candidate |
| --- | --- | --- |
| PostgreSQL | `18.6` (`REL_18_6`) | `18.6` (`REL_18_6`) |
| Go toolchain | `1.27.3` | `1.27.1` |
| etcd API / `clientv3` | `3.7.2` | `3.6.15`, `3.7.2` |
| Reference etcd servers | `3.6.15`, `3.7.2` | `3.6.15`, `3.7.2` |
| Kubernetes reference trees | `1.36.4`, `1.37.1` | `1.36.4`, `1.37.1` |
| gRPC / protobuf / `pgx` | `1.84.0` / `1.36.12` / `5.11.0` | `5.11.0` (`pgx`) |
| Gateway product version | `0.1.0` | `0.1.0-p1` |
| Extension / SQL ABI / schema | `0.1.0` / `1` / `2` | `0.1.0` / `1` / `2` |
| Advertised `Status.Version` | `3.6.0` | `3.6.0` |
{.wide}

Why `Status` advertises `3.6.0`:

- When `RejectOldCluster` is enabled, `clientv3` `v3.6.15` requires at least `3.5.0` and `clientv3` `v3.7.2` requires at least `3.6.0` (a `3.5.12` negative control is rejected by the 3.7 client).
- Kubernetes `1.36.4` and `1.37.1` `feature_support_checker` parses `Status.Version` to enable `RequestWatchProgress`, rejecting versions below `3.4.31` and `[3.5.0, 3.5.13)`.
- Advertising `3.6.0` satisfies both checks and selects the same client code paths as `3.6.15` without claiming that every etcd 3.6 RPC is implemented.

## Resource limits {#limits}

| Resource | Bound |
| --- | --- |
| gRPC receive / send message size | `1,572,864` bytes (1.5 MiB) / `8 MiB` |
| SQL JSONB request envelope | `2 MiB` |
| KV / `Txn` response tree | `8 MiB` conservative budget (`p2-kv-response-v1`) |
| Ordinary Lease response / legacy Tail | `2 MiB` each |
| Complete `_tail_v2` revision | `8 MiB`; at most `4,096` events |
| Write key length | `1`–`2,048` bytes |
| `Txn` nesting depth / total comparisons and operations | Depth `8` / `128` across `compare`, `success`, and `failure` |
| Active Leases per tenant database | `1,024` |
| Keys attached to a single Lease | At most `4,096`, bounded by the complete-revoke byte budget |
| Supervised tenant databases per PostgreSQL instance | At most `8` (`pg_etcd.databases`) |
{.wide}

Admission checks reserve serialized space for both the immediate revision and any future full-Lease revocation revision. As a result, `pgetcd` can reject large writes or Lease attachments with `ResourceExhausted` even when upstream `etcd` would accept them. See [Configuration](/docs/etcd/reference/configuration/#capacity) for gateway connection and Watch buffer settings.

## Deliberate differences and contract observations {#differences}

- **Primary-only serialized transactions**: Every request runs on the PostgreSQL primary, including `Range` with `serializable=true`. Both reads and writes lock the single `etcd.meta` row (`FOR UPDATE`), write a logged publication barrier on read-only paths, and release the gRPC response only after a warning-free synchronous `COMMIT`.
- **Deterministic tie-breaking on non-key `Range` sorts**: Upstream `etcd` `3.6.15` and `3.7.2` use a comparator that compares only the sort target (`CREATE`, `MOD`, `VERSION`, `VALUE`) via `sort.Sort`, leaving equal-target ordering unspecified. `pgetcd` always breaks ties by ascending key byte order (`key ASC`) across `ASCEND`, `DESCEND`, and `NONE`. Across 186 tie-sort test vectors against the reference servers, 59 match byte-for-byte and 127 differ only in tie-group permutation (76) or `limit` boundary selection within an equal-value group (51), with 0 semantic violations. When `sort_order = NONE` is combined with a non-key `sort_target` and a positive `limit`, `pgetcd` preserves upstream's fetch-before-sort behavior (taking the `limit + 1` key-ordered prefix before sorting by the target and truncating).
- **Revision and `Compact` edge cases (verified against etcd `3.6.15` and `3.7.2`)**:
  - A fresh store starts at revision `R = 1`; `Compact(-1)` returns `ErrCompacted`, the first `Compact(0)` succeeds, and the first modifying write allocates `R = 2`.
  - After `Compact(0)`, a top-level `Range` with `revision <= 0` resolves to the current revision and succeeds, whereas a `Range(-1)` inside a `Txn` fails preflight validation with `ErrCompacted`.
  - Inside a `Txn`, a `Range` or no-op `DeleteRange` executed before a `Put` carries the pre-write revision `R` in its own child response header, while the `Put` and top-level `Txn` header carry `R + 1`. A no-op `DeleteRange` by itself allocates no revision. Nested `Txn` response headers report `revision = 0`.
- **Watch boundary and progress rules**:
  - At the compacted revision boundary `C`, `Watch` still delivers `DELETE` events, with `prev_kv` omitted even when `prev_kv=true` was requested.
  - A watcher created with `start_revision = 0` at revision `R` can legitimately receive a `RequestProgress` notification at `R` before its first event at `R + 1`, whereas an explicit future `start_revision > R` blocks stream-level (`watch_id = -1`) progress until caught up or canceled.
- **Leases**:
  - Lease IDs and live remaining TTLs do not match another server's clock. Requesting `TTL = 1` yields a minimum granted `TTL = 2`.
  - Granting a duplicate Lease ID returns `FailedPrecondition`. Calling `LeaseTimeToLive` on an unknown or expired Lease succeeds with `TTL = -1`. Revoking an empty Lease (no attached keys) does not increment the KV revision.
  - After a PostgreSQL or worker restart, every active Lease is rebuilt with its full granted TTL, so restarts can delay expiry but never cause early expiry.
- **`MemberList` and `Status`**:
  - `MemberList` reports a single logical member for the tenant. `Status` reports that member ID as `leader` with `raftTerm = 0`.
  - `dbSize` and `dbSizeInUse` report the bytes allocated by PostgreSQL relations in the `etcd` schema (including table and index bloat), not `bbolt` file sizes.

## Kubernetes storage and conformance {#kubernetes}

Kubernetes compatibility has been tested at two levels on separate builds:

1. **Upstream `k8s.io/apiserver` storage probe on `v0.1.0-rc1` (commit `7e43446`, Linux amd64, 2026-11-08)**:
   - Kubernetes conformance is outside the MVP verification scope ([MVP goal](/docs/etcd/design/mvp-goal/#verification)). The probe below was not repeated on `v0.1.0-rc2`.
   - Instead, `v0.1.0-rc1` ran the upstream `k8s.io/apiserver` `v0.36.4` and `v0.37.1` `etcd3` storage probes against a live gateway: **65 PASS / 0 FAIL** on each version.
   - On Kubernetes `1.37.1`, where `EtcdRangeStream` is enabled by default in Beta, the storage client attempts `RangeStream`, receives `Unimplemented` with zero chunks, calls `MarkUnsupported` in `feature_support_checker`, and falls back cleanly to unary `Range`.
2. **Full storage suites and selected conformance on the 2026-10-08 frozen candidate (`0.1.0-p1`, extension `b0e08f12`, gateway `935d9fd4`)**:
   - Across all upstream packages under `k8s.io/apiserver/pkg/storage/etcd3/...` and `k8s.io/apiserver/pkg/storage/cacher/...` (including the 10,001-object `TestConsistencyCheckerDigestMatches` pagination and cache catch-up test under the 8 MiB `p2-kv-response-v1` budget and `pool_size = 32`):
     - Kubernetes `1.36.4` (commit `bb826b1d`, 12 packages, 243 top-level tests, 1,227 test nodes): **1,219 PASS / 0 FAIL / 8 upstream skips**.
     - Kubernetes `1.37.1` (commit `f78e7223`, 14 packages, 233 top-level tests, 1,209 test nodes): **1,196 PASS / 9 FAIL / 4 upstream skips**. All 9 failed nodes are in tests that explicitly assert declared unsupported capabilities: 6 leaf assertions requiring native `RangeStream` (`TestGetListStreamMultiChunk`, `TestWatchChanSync/RangeStream`, `TestWatchChanSyncStreamMatchesPaginated`, `TestWatchChanSyncStreamMetrics`), 1 test calling `WithCompactPhysical()` (`TestWatchChanSyncStreamCompactionError`), and 2 parent test nodes propagating those child failures.
   - On the same 2026-10-08 frozen candidate, the selected Kubernetes conformance suites passed **446 cases** on `1.36.4` and **462 cases** on `1.37.1` with zero runtime skips. Those results belong to the 2026-10-08 frozen candidate and were not re-run on `v0.1.0-rc1` or `v0.1.0-rc2`.

## Acceptance evidence {#evidence}

| Suite | Build and platform | Result |
| --- | --- | --- |
| `v0.1.0-rc2` official client probes | Commit `81691bc`, Linux amd64, 2026-11-08 | `etcdctl` `3.6.15` and `3.7.2`: `50 PASS / 0 FAIL`, including `endpoint health` |
| `v0.1.0-rc2` concurrency test | Commit `81691bc`, Linux amd64, default `pool_size = 32`, 2026-11-08 | 64 and 128 clients for a few minutes each: `0` refused requests, `0` readiness withdrawals; a long-lived Watch stayed connected but lagged under sustained writes |
| `v0.1.0-rc1` P1 mixed model audit | Commit `7e43446`, Linux amd64, 2026-11-08 | `100,000` mixed KV calls, `30,011` Lease calls, `20,006` controls across 2 mTLS gateways and 5,002 windows; `0` unknown outcomes; offline replay, SQL catalog audit, and 2-stream Watch audit passed |
| `v0.1.0-rc1` official client probes | Commit `7e43446`, Linux amd64, 2026-11-08 | `etcdctl` `3.6.15` and `3.7.2`: `48 PASS / 2 FAIL` (both `endpoint health`); `clientv3` `3.6.15` and `3.7.2` Watch suites passed |
| Frozen P1 1M-call mixed model audit | 2026-10-08 frozen candidate (`0.1.0-p1`) | `1,000,000` mixed calls across 16 hot keys, 4 workers, 2 gateways, and rotating Watch streams on one primary; passed independent model and Watch audit |
{.wide}

[Status](/docs/etcd/status/) has the `v0.1.0-rc2` results, performance numbers and known issues; [Releases](/docs/etcd/releases/) keeps the full `v0.1.0-rc1` results.

---

Backlinks:

- [Watch, Lease and history](/docs/etcd/architecture/watch-lease/)
- [Troubleshooting](/docs/etcd/operations/troubleshooting/)
- [Quick start](/docs/etcd/quickstart/)
- [Tutorials](/docs/etcd/tutorial/)
