08 — Empirical Limits and Failure Modes Catalog¶
Series: PostgreSQL Multi-Master & Active-Active Architectures
Author: Jean-Marie Renouard (jmrenouard) — LightPath
License: MIT License
This chapter documents every hard failure mode, SQLSTATE exception, and silent data corruption vector reproduced empirically in our Docker test harness (results/functional_limits_matrix.csv and results/logs/). Every code cited below was directly observed against running clusters.
1. Summary of Observed SQLSTATE & Runtime Failures¶
| Code / Signal | Triggering Topologies | Observed Context | Operational Severity |
|---|---|---|---|
23505 |
pg-birep, pgedge, bucardo, yugabyte, cockroach |
Uncoordinated SERIAL PK or concurrent UNIQUE(email) insert |
Fatal Apply Stall (pg-birep, bucardo) or Silent Drop (pgedge) |
55000 |
pg-birep (and native pgoutput) |
UPDATE/DELETE on keyless table (pgbench_history) without RI FULL |
Blocking DDL/DML Error |
0A000 |
citus, yugabyte |
Citus UNIQUE/PK omitting dist key or vector; Yugabyte LISTEN/NOTIFY |
Unsupported Feature Reject |
40001 |
cockroach, yugabyte (RR), citus (RR) |
Concurrent row update / serialization conflict | Requires App Retry Loop |
XCEXF |
cockroach |
CREATE TEMP TABLE with default settings (experimental_enable_temp_tables=off) |
Session Error |
42601 |
cockroach |
LISTEN / NOTIFY syntax unsupported in Go PG-wire parser |
Unsupported Feature |
57014 |
cockroach (2/3 down) |
Statement timeout during Raft majority loss (PC/EC cluster halt) |
Total Write/Read Outage |
42501 |
pgedge (container quirk) |
Default output_plugin_libraries lacked spock_output permission |
Setup Blocker Fixed with Conf |
25006 |
pg17-async/sync-streaming |
Write, DELETE, or TEMP TABLE attempted on hot standby |
Read-Only Standby Guard |
23503 |
bucardo (T13 FK race) |
Immediate child INSERT on Node 2 before async parent sync (0/10) |
Cross-Node FK Violation |
54000 / 08006 |
pgedge (T14), citus (T16) |
pgedge image SQL_ASCII chr(20013) (54000); citus worker2 SIGKILL (08006) |
Encoding / Worker Drop |
2. Detailed Anatomy of the 8 Empirical Limits (L1–L8)¶
L1 — Keyless Tables (pgbench_history Without Primary Key)¶
pg-birep(#1):INSERTreplicated, butUPDATEandDELETEfailed immediately on the publisher withSQLSTATE 55000:cannot update table "pgbench_history_nokey" because it does not have a replica identity and publishes updates.pgedge(#2): Spock silently mapped the keyless table into thedefault_insert_onlyreplication set. LocalUPDATE(delta=50) andDELETEsucceeded onnode1(UPDATE 1), while peers silently kept stale values!bucardo(#9):validate_syncrefused initialization outright:ERROR: Table "public.pgbench_history_nokey" must specify a primary key!.citus(#7): Allowed table creation, yet blockedALTER TABLE ... ADD PRIMARY KEY/SERIALaftercreate_distributed_table()withSQLSTATE 0A000. CreatingPRIMARY KEY(aid, hid)upfront unlocked full operations.yugabyte(#5) &cockroach(#6): Both succeeded natively using internal hidden keys (rowidauto-injected in CockroachDBSHOW COLUMNS).- Mitigation: Enforce explicit Primary Keys (or composite
(shard_key, id)for Citus) across 100% of tables with CI migration checks.
L2 — Uncoordinated SERIAL Primary Key Collisions¶
pg-birep(#1): IndependentSERIALsequences generatedid = 1on both nodes. Replication crashed onSQLSTATE 23505(duplicate key value violates unique constraint "uncoord_serial_pkey",apply_error_count = 1), blocking all subsequent transactions in that subscription queue.pgedge(#2) &bucardo(#9): Neither halted. Both silently overwrotenode1's legitimate row (from_n1lost,from_n2retained,spock.resolutions = 1,bucardo Conflicts = 1).citus(#7),yugabyte(#5),cockroach(#6): Zero collisions occurred (Citus1.62 mscoord seq,Yugabyte1.89 mscache=1 /1.98 mscache=100,Cockroachunique_rowid()17.72 msvsSERIAL cache=146.07 ms).- Mitigation: Mandate
snowflakeIDs, steppedINCREMENT BY Noffsets,unique_rowid(), or UUIDv7 globally.
L3 — Non-Commutative Lost Updates (balance = balance + delta)¶
- Async LWW Failure: Under competing updates (
+100and-30from1000.00, expected1070.00),pg-birepdiverged (node1 = 970.00,node2 = 1100.00), whilepgedgeLWW andbucardo_latestconverged to970.00(silently destroying+100). In Suite D (50hot accounts), drift exploded to-71,063(pg-birep),-278,698(pgedge), and-531,620(bucardo). spock.delta_applyFix (#2): Configuringlog_old_value=true, delta_apply_function=spock.delta_applyconverged all 3 nodes to exact1070.00(functional test) and0drift across27,545hot-row commits in Suite D (1,837.64 TPS).- Consensus Retry (
#5,#6,#7): CockroachDB (SERIALIZABLE) triggered9xraw40001(WriteTooOldError) and reached1100after27retries. YugabyteDB (REPEATABLE READ) hit8x40001(33retries ->1100), while Citus (READ COMMITTED) serialized cleanly (1100,40001only underREPEATABLE READ). - Mitigation: Never rely on LWW for financial balances or counters. Use
spock.delta_applyCRDTs or40001-retried consensus engines.
L4 — Secondary UNIQUE(email) Constraint Collisions¶
- The hardest async multi-master trap: Two rows with distinct PKs (
id=1onn1,id=2onn2) inserted concurrently with identicalemail = 'dup@t.io'both commit locally. pg-birep(#1) &bucardo(#9): Apply workers crashed hard onSQLSTATE 23505(accounts_email_key), freezingsync_mm(Current state: Bad, Error: 7) and halts inpg_stat_subscription_statsuntil manual row deletion.pgedge(#2): Under defaultspock.exception_behaviour = transdiscard(check_all_uc_indexes = off), Spock logged23505(exception_log = 1), discarded the remote transaction, and leftnode1 = u1vsnode2 = u2permanently diverged!citus(#7): RejectedUNIQUE(email)outright on distributed tables unless the distribution column was included (UNIQUE(dist_key, email)), returningSQLSTATE 0A000.yugabyte(#5) &cockroach(#6): Enforced globalUNIQUEcleanly (23505rejected on the second writer at commit time).- Mitigation: Include shard or tenant keys in Citus
UNIQUEindexes. Handle secondaryUNIQUEkeys in async meshes with central reservation or accept Raft consensus latency.
L5 — DDL Propagation, TRUNCATE & SAVEPOINT Limits¶
pg-birep(#1) &bucardo(#9):ALTER TABLE ADD COLUMNdid not propagate (risking tuple schema mismatch on subsequent inserts), thoughTRUNCATE TABLEpropagated across logical and trigger handlers.pgedge(#2):enable_ddl_replication=onautomatically replicatedALTER TABLEandTRUNCATEtonode2/node3.citus,yugabyte,cockroach: DDL propagated cluster-wide AND transactional DDL withSAVEPOINT/ROLLBACK TO SAVEPOINTsucceeded across all three tested engines.
L6 — PostgreSQL Features, Extensions & Runtime Quirks¶
| Feature / Extension | pg-birep / pgedge / bucardo |
citus (PG 17) |
yugabyte (2026.1.3) |
cockroach (v24.3.0) |
|---|---|---|---|---|
pg_advisory_lock |
Node-local only (no cluster sync) | Worker-scoped | Global (OK) |
Global (OK) |
LISTEN / NOTIFY |
Node-local only | Coord-local (OK) |
ERR (0A000 disabled) |
ERR (42601 syntax) |
TEMP TABLE |
Session-local (OK) |
Session-local (OK) |
Session-local (OK) |
ERR (XCEXF) unless experimental_enable_temp_tables=on |
pg_trgm / uuid-ossp |
OK |
OK |
OK |
OK (built-in emulation) |
pgvector (vector) |
Native PG extension | ERR (0A000) (on dist probe) |
OK (native YSQL) |
CREATE EXTENSION vector OK; native VECTOR(3) column OK |
Container Image Quirk (pgedge):* Rocky UBI image 17-spock5-minimal defaulted to output_plugin_libraries='pgoutput, test_decoding', throwing SQLSTATE 42501 until explicitly overridden with output_plugin_libraries=pgoutput,spock_output and host replication scram-sha-256 entries.
L7 — Offline Node WAL Slot Bloat & Delta Queue Retention¶
- Stopping one peer left surviving nodes writable across
APstacks (pg-birepheld54,432 B,pgedge309,560 B,bucardo8rows inbucardo.delta_public_accounts), converging5/5rows on restart. Unbounded outages risk exhausting primary disk unlessmax_slot_wal_keep_sizecaps retention! - On
citus, stoppingworker2kept reference-table reads andworker1shards online while failing queries hittingworker2shards until recovery. Onpg17-sync-streaming, stopping the synchronous standby blocked primary commits (RPO=0guarantee).
L8 — Majority Quorum Loss (2/3 Down) & WAN RTT Collapse¶
- 1-of-3 Down: Both
yugabyte(RF=3) andcockroach(RF=3) survivednode2termination cleanly withRPO = 0(balance = 500readable across survivors). - 2-of-3 Down: Terminating
node3stripped Raft majority (1/3 < 2/3). Both clusters halted completely (yugabyteconnection timeout,cockroachSQLSTATE 57014timeout) until quorum returned, proving strictPC/ECbehavior. - WAN RTT Amplification (Suite F): Adding
25 msegress delay (~50 msRTT) droppedpg17-sync-streamingto57.00 TPS(-86.1%). It also cutcitus(21.67,-93.0%),cockroach(10.06,-76.1%), andyugabyte(5.78 TPS,-96.7%).
3. Extended Empirical Matrix (T11–T18) Across All 10 Topologies¶
Eight edge-case probes (results/extended_functional_matrix.csv, functional_limits_matrix.csv) add pg17-async-streaming and pg17-logical across all 10 topologies:
T11Bulk 10k & Catch-Up: Throughput spanned22,079(cockroach) to67,406 rows/s(pgedge). Catch-up took105–115 ms(streaming),139 ms(bucardo),265 ms(cockroach),333–350 ms(logical/Spock), and417 ms(yugabyte).T12UPDATEvsDELETETombstone:pg17-logicalDIVERGED (pub=upd_n1,sub=DELETED). Async meshes droppedUPDATE(DELETED), streaming rejected standbyDELETE(25006), and Citus/YB/CRDB converged.T13Cross-Node FK Race: Streaming blocked standby writes (25006x10), andbucardofailed0/10(23503x10). Raft/Citus and LAN logical/Spock passed10/10.T14Rich Fidelity (64 KiBBYTEA,JSONB, UTF-8):9/10matched bit-identical (md5=00493e3a). Thepgedgeimage usesSQL_ASCII(chr(20013)hit54000, escaped UTF-8 matched3/3md5=f798eb5a).T15RAW Lag (n=30,p50/p95ms):standalonehit1.15/1.55,pgedge1.16/1.63,pg-birep1.47/2.28,pg17-logical1.68/2.14, andpg17-sync1.88/2.74.yugabyteran2.01/2.83,citus1.71/13.89,cockroach4.09/4.98,pg17-async9.65/25.13, andbucardo548.74/1,275.25.T16SIGKILL& RPO: Eight stacks passed20/20(RPO=0LAN) and21/21recovery.citusworker2raised08006then recovered21/21, whilebucardonode1metadata crash ended20/21.T173s Open TX: All10/10showedNO_DIRTY_READ.cockroachblocked the reader with intent wait (serializable_intent_wait=2.1s).T18Sequence Sync (50 inserts): Streaming (66|true,next=67),yugabyte(101), andcockroach/citus(51) stayed safe. All 4 logical/trigger stacks stayed at1|false->23505(pg17-logicalretained27,320 BWAL vs3,088 Bstreaming).
4. PostgreSQL 18.6 Limits Verification & Ecosystem Sustainability¶
Live PG 18.6 re-verification (results/functional_limits_pg18.csv, results/benchmark_pg18.csv, details in Ch. 12) refines these limits:
- Resolved in PG 18.6: Native uuidv7() converged 50/50 active-active inserts (0 23505, 0 B-tree inversions). data_checksums=on prevents silent corruption, and pg_stat_subscription_stats exposes 7 confl_* counters including confl_multiple_unique_conflicts=1.
- Still Open in PG 18.6: FOR ALL SEQUENCES and REFRESH SEQUENCES raise SQLSTATE 42601 (PG 19 target, leaving peers at 1|false -> 23505). io_method=io_uring fails (EPERM) under Docker seccomp. pg18-birep still shows T13 FK races (2/10 ok, 23503x8), Lost Updates (-83,252 in Suite D), and no Auto-DDL.
- Vitality & Charts: Cross-check long-term maintenance risk (pgEdge/spock 621/12m vs dormant bucardo/slony/rubyrep 0/12m) in Ch. 11 and chart_08 / chart_09 / chart_10.