Research notes / Replication contracts
Replication acknowledgements: received, durable, applied
Published 12 October 2026 / Updated 30 November 2026 / Primary-source review
A replica can receive a change before it becomes durable, and persist it before queries can observe it. A successful acknowledgement protects only the boundary and replica set required by the actual configuration.
On this page32 sections
Start with the completion contract
SNIA Swordfish distinguishes the maintained-copy relationship, called a mirror, from its update mode. The existence of another copy does not specify how writes complete or promise instantaneous failover. [8] Ask which event releases the caller, which replicas participate and which failures the storage stack can survive.
PostgreSQL 18 is a concrete example, not a universal replication vocabulary. The following table assumes normal durable local WAL handling and configured synchronous standbys. It concerns the transaction commit record, not a requirement to flush every modified data page.
| Setting | Local WAL durable? | Required remote progress |
|---|---|---|
off | Not required before success | None |
local | Yes | None |
remote_write | Yes | Commit record written to standby filesystem |
on | Yes | Commit record flushed to durable standby storage |
remote_apply | Yes | Commit record durable and transaction replayed |
A standby filesystem write can survive a database-process crash without surviving an operating-system crash. Durable WAL does not yet imply that a standby query sees the transaction; remote_apply adds replay. These guarantees depend on the underlying durability configuration and storage behaving as promised. [1]
TAPIR: fewer ordering rounds, a larger fast quorum
TAPIR moves transaction ordering above inconsistent replication (IR). Prepare validates conflicts; Commit and Abort use cheaper inconsistent operations. A client still coordinates the participating shards. The absence of a replication leader is not the absence of coordination. [TAPIR, sections 3-5]
The pinned implementation groups replies by view and replica identity. Its fast path needs matching results, not just enough replies. With failure budget f and n = 2f + 1, the ordinary quorum is f + 1, but the fast quorum is f + ceil(f/2) + 1. [configuration code] [IR client code]
| Crash budget f | Replicas n | Ordinary quorum | Matching fast replies | Maximum unavailable for fast quorum |
|---|---|---|---|---|
| 1 | 3 | 2 | 3 | 0 |
| 2 | 5 | 3 | 4 | 1 |
| 3 | 7 | 4 | 6 | 1 |
| 4 | 9 | 5 | 7 | 2 |
Three replicas therefore need three matching replies for this fast path. One unavailable replica leaves an ordinary quorum but prevents that fast quorum. A mismatched result can also defeat the fast path even when every replica replies. This is not itself an abort verdict: the client can take the slow path, choose a result through the application callback and wait for finalization acknowledgements. [fast and slow handlers]
As a set calculation, any fast quorum overlaps any ordinary recovery quorum in at least ceil(f/2) + 1 replicas. Our reproducible arithmetic supplies the table. Exhaustive subset checks for the displayed group sizes verify this bound; they do not verify TAPIR's recovery protocol or predict timeout probability.
"Fast" counts protocol rounds, not geographic distance. In the paper's wide-area setup, two round trips to the nearer replicas could take less time than one round trip to the farthest replica. The authors did not implement racing both paths in that evaluation. [section 6.3] Compare measured endpoint delays and the required responder set before treating fewer rounds as a lower-latency guarantee.
A one-round-trip commit fast path excludes earlier transaction reads and later asynchronous work. The paper assumes crash failures within each group's budget, not Byzantine faults or simultaneous loss of every replica. Its coordinator recovery uses a Paxos election, so "leaderless" is not a claim that recovery never needs agreement. [sections 3.1.2 and 5.2.3] No native prototype or hardware experiment was run for this note.
Which promise does an RPC reply carry?
A remote procedure call connects a caller to a remote handler. In ONC RPC, an XID associates a reply with a call or detects retransmission; it is not an execution-order sequence number. Reply correlation alone does not specify a storage commit boundary. [ONC RPC, sections 5 and 9]
eRPC illustrates the distinction: protocol retransmissions do not execute the same request handler twice, while suspected node failure returns errors for pending client calls. A new call after that error is outside retransmission suppression for the earlier call. Retrying the same logical mutation safely may require retained request identity and deduplication. Its replication experiment used logs and data in DRAM; those results do not measure power-loss durability. [sections 3.1, 5.3, 7.1 and Appendix B]
An idempotent operation is not automatically safe to retry amid concurrent updates. A delayed retry of a fixed-value write can overwrite an intervening write from another client. In RIFL's example, another client observes the first write, writes a new value, then sees the original value reappear after the retry. The logical write cannot be placed at one point in that history. [RIFL, section 2, Figure 2]
gRPC documents that client and server completion judgments can differ, and that cancellation does not roll back earlier changes. [RPC lifecycle] For durable retry handling, RIFL couples the saved result with the mutation across server recovery and data migration. The client must retain and reuse the original request identity; arbitrary client crashes are not transparently repaired. [RIFL, sections 3-4 and 9]
For a recovery review: record the logical request identity, what reply or error was observed, where duplicate-suppression state survives, and which persistence boundary the handler promised before replying. This is a comparison of documented contracts, not a new crash-recovery experiment. See also the timeout and retry analysis.
Canceling the wait does not undo the commit
PostgreSQL 18.0 can end a synchronous-replication wait after a transaction has already committed locally, while standby replication may still be incomplete. Its QueryCancelPending path emits a warning and leaves the wait queue. This is a specific late-commit path, not a rule that all canceled statements commit. [31, SyncRepWaitForLSN]
For this WAL-writing synchronous commit, local WAL is flushed and commit status recorded before the replication wait. The transaction retains locks during that wait and remains listed as running. Recorded local commitment therefore does not mean immediate visibility to other sessions while waiting. [32, RecordTransactionCommit]
The client observes a separate boundary: in libpq, PQcancelBlocking returning 1 confirms dispatch of a cancellation request, not rollback or completed remote replication. The frontend must still process the original connection's response. [33, section 32.7.1] [34, section 54.2.8] Server warnings go to a notice handler, separately from the query result. [35, section 32.13]
Operational inference: in the late synchronous-wait path above, absence of a query error alone does not establish that the requested remote boundary was reached. Capturing only the query result can omit the warning that the replication wait was canceled. This is a source-derived client-observation limitation, not a tested driver recipe. [31] [35]
Operational inference: preserve the warning and establish the transaction outcome before repeating a non-idempotent write. Canceled waiting alone proves neither rollback nor failover readiness. The synchronous replication record separates this exception from the normal acknowledgement contract.
A policy change can also release waiting commits
PostgreSQL 18.0 releases queued replication waiters after the primary processes a configuration change that empties synchronous_standby_names. The queue wake-up does not require those replicas to acknowledge the pending commits. [31, SyncRepUpdateSyncStandbysDefined]
Operational inference: record policy changes alongside commit outcomes; success after disabling synchronous waiting does not certify acknowledgement under the previous standby requirement. Editing a configuration file and the primary processing that change are separate events. This is a source-code boundary, not a replication experiment. [31] [2]
Replay does not refresh an older read snapshot
Operational inference: after a remote_apply acknowledgement, route the read to a standby whose replay was actually required and use a sufficiently new read snapshot. PostgreSQL Repeatable Read retains the snapshot established by the first non-transaction-control statement. An already-running transaction can therefore keep seeing an earlier version even after the standby has applied the update. Replay progress and snapshot isolation answer different questions. [1] [10]
The replica set matters as much as the setting
An empty synchronous_standby_names means no remote wait, even with synchronous_commit=on. FIRST n (...) selects by priority; ANY n (...) accepts the required count of acknowledgements among the named candidates. Neither means every replica, and the names are standby application names, not necessarily hostnames. [2]
Streaming replication defaults to asynchronous operation. A promoted standby can lack acknowledged transactions; required synchronous standbys can instead delay completion when unavailable. PostgreSQL 18 cascading replication remains asynchronous. Protection of a directly connected standby therefore does not automatically extend to its downstream replicas. [3]
Operational inference: a claim of zero recovery-point loss needs an explicit failure scenario, surviving acknowledged replica and promotion rule. Replica count alone is insufficient. Preventing an old primary from continuing to write is a separate fencing problem.
Standby reads can delay primary commit acknowledgement
A standby read conflict can delay the conflicting and following WAL records. [36, section 26.4.2] Operational inference: because remote_apply waits for replay, this can extend the primary's commit wait when that standby's acknowledgement is needed; another sufficient quorum may avoid that dependency. This is not a measured latency result. [1] [2]
max_standby_streaming_delay is a replay-delay budget after receipt, not a per-query runtime allowance. A later conflicting query can have less grace because of earlier replay delays. For conflicts governed by this delay setting, -1 allows waiting without that time limit; a finite value is not an end-to-end commit deadline. [37]
Hot standby feedback can prevent early row-cleanup conflicts by retaining needed versions upstream, potentially increasing primary-side bloat. It does not cover every conflict: Access Exclusive locks and database or tablespace removal still need separate handling. Feedback interruptions also limit cleanup protection. [38] [36]
The same label can hide a different boundary
DRBD replicates block-device writes. Its protocol A completes after local disk completion and placement in the local TCP send buffer; B also waits for peer receipt; C waits for confirmed local and remote disk writes. LINBIT calls B memory-synchronous or semi-synchronous. [6, section 2.3]
Do not equate DRBD B with PostgreSQL remote_write: peer receipt and a filesystem write are distinct events. Nor does DRBD C establish SQL query visibility. This is a comparison of documented boundaries, not a performance ranking.
Asynchronous does not mean unable to block: DRBD protocol A can stall the writer when its send buffer fills. Removing a remote acknowledgement from completion does not remove finite buffering or bandwidth limits. [6, section 2.18]
Remote-memory recovery is not a durable commit
Two research designs expose a useful difference: asynchronous backup can create backpressure, or it can leave a best-effort recovery gap. Neither label alone specifies what survives. This compares documented mechanisms, not measured performance or equivalent failure guarantees.
| Operation | Normal completion boundary | When backup buffering fills |
|---|---|---|
| Infiniswap mapped page write | RDMA WRITE completes; disk copy may still be pending | No free dispatch entry: block until one is released |
| LegoOS dirty ExCache-line flush | Primary and secondary memory components both reply | Full secondary log: memory replication can be skipped |
Infiniswap: the disk copy shares the RDMA dispatch buffer, which stays allocated until the disk write completes. After remote-memory loss, reads go to disk; the same slab's disk dispatch queue orders a pending write before the subsequent read. Unmapped writes wait for disk completion. Thus an asynchronous backup remains on the resource-reclamation path. [43, sections 4.3-4.5, p. 654]
Scope inference: that recovery path requires the requesting host and its queued disk work to remain available. A remote page-out acknowledgement is not evidence of a host-crash-safe database commit.
LegoOS: the secondary's bounded log drains to a storage component in the background. If the primary fails while replication is skipped, the system reports an application error; otherwise recovery replays the storage and secondary-memory logs. The paper leaves storage reliability to applications and processor-failure handling to future work. [44, section 4.7, pp. 77-78]
Engineering inference: include saturation in the failure contract. Test what happens when backup cannot keep up, not only what happens after an isolated replica failure. A block, an error and continued operation with reduced protection are different outcomes.
Evidence limit: this is a primary-source synthesis. Hesela has not executed either prototype or reproduced their performance or recovery results. Their memory operations are not PostgreSQL commit modes.
Chain replication puts the reply boundary at the tail
Van Renesse and Schneider's OSDI 2004 protocol sends updates to a head, forwards changes through an ordered chain, and serves queries and replies at its tail. This is not majority voting for each data update; a separate master reconfigures membership. The model assumes fail-stop servers and reliable FIFO links. Its prototype uses Paxos for the master. [11, sections 3 and 3.1]
Do not read that proof as a PostgreSQL cascade guarantee: the protocols differ. The paper's simulated throughput is not a modern hardware benchmark, and it does not promise service across arbitrary network partitions. [11, sections 5 and 6] See the chain replication record.
Read the experiment's workload: section 5.1 uses 25 clients, each waiting for a reply before sending another request. The network model has unlimited bandwidth and a fixed 1 ms message delay. Query, initial update and forwarded-difference processing costs are modeled separately. Those assumptions help explain the curves; they are not measurements of today's storage or an open-loop overload test. [11, section 5.1, p. 97]
Chained declustering: which two failures matter?
Chained declustering is a placement design, not the update protocol above. Hsiao and DeWitt place matching partitions on successive nodes of a logical cycle; read responsibility can be redistributed after failure. Adjacency describes placement, not rack distance. Their equal-load example assumes uniform access. [Hsiao and DeWitt, sections 3-4] By contrast, parity declustering distributes parity groups. [Holland and Gibson, section 2]
A six-node example
Assume two initially complete, readable copies of each partition, fixed placement, and failures that make a node inaccessible. Partition 1 lives on nodes 1 and 2, partition 2 on 2 and 3, and so on; partition 6 wraps around to nodes 6 and 1. The following rows are generated from Hesela's exhaustive enumeration of all 64 node subsets, with no repair or write activity.
| Failed nodes | Partitions with no accessible copy |
|---|---|
| 1 | None |
| 1, 2 | 1 |
| 1, 6 | 6 |
| 1, 3 | None |
| 1, 3, 5 | None |
| 1, 2, 4 | 1 |
Exactly two failures have 15 possible unordered pairs. Six remove both copies of a partition; nine leave every partition represented. The wraparound pair 1 and 6 matters just as much as 1 and 2. Three alternating failures, 1, 3 and 5, still leave one copy of each partition, illustrating why a failure count alone is insufficient.
| Nodes | All pairs | Some partition unavailable | All partitions represented |
|---|---|---|---|
| 2 | 1 | 1 | 0 |
| 3 | 3 | 3 | 0 |
| 4 | 6 | 4 | 2 |
| 6 | 15 | 6 | 9 |
| 8 | 28 | 8 | 20 |
For n nodes, the denominator is n(n - 1)/2. At n >= 3, exactly n neighboring pairs remove both copies of some partition. With only two nodes, both partitions share the same pair: count one event, not two. These are combinatorial results, not confidence intervals or observed failure rates. The fraction 6/15 becomes a conditional probability only if all 15 pairs are explicitly assumed equally likely.
Operational boundary: a remaining copy does not prove that it contains the latest acknowledged write, that a service quorum exists, or that recovery meets a deadline. Inaccessibility also does not prove permanent destruction. Placement, acknowledgement and recovery policy need separate checks.
Definition and source provenance;method and reproduction instructions;all 64 cases as JSON. The published model and an independent survivor-coverage oracle agree on all 8188 subsets for sizes 2 through 12.
CRAQ: choose the version before serving local bytes
CRAQ's read routing extends the original chain protocol: a dirty replica asks the tail which version to serve, not for the object's payload. A clean latest version needs no such query. "Dirty" denotes local knowledge, not corruption: the tail may already have committed a version whose acknowledgement has not reached this replica. [26, section 2.3]
The 2009 prototype was memory-only. Its evaluation used Emulab, normally a three-node chain and a single object over 100 Mbit/s links. Those results do not establish disk durability or modern production throughput. [26, sections 5.2 and 6]
CRAQ also offers optional weaker reads. Its eventual mode returns the newest local version, potentially before commitment, and changing replicas can reverse observed versions. The shortcuts below are invalid replacements for the strong contract, not a claim that the paper forbids its explicit weaker mode. [26, section 2.4]
Two tempting local shortcuts return versions in reverse order
The following constructed histories start with version 0. Each row freezes writes and acknowledgements while two reads run sequentially in the stated order; the first read finishes before the second starts. Nodes are numbered from head 0 to tail 2. There is no later write restoring version 0.
| Snapshot | Read nodes | Newest local | Last clean | Version-checked |
|---|---|---|---|---|
| New version has reached only the head | 0 then 2 | 1 then 0 | 0 then 0 | 0 then 0 |
| Tail committed; backward acknowledgement is delayed | 2 then 0 | 1 then 1 | 1 then 0 | 1 then 1 |
| Commit acknowledgement reached every node | 0 then 2 | 1 then 1 | 1 then 1 | 1 then 1 |
Before the write reaches the tail, newest-local exposes version 1 followed by 0. After tail commitment but before the backward acknowledgement arrives, last-clean can do the same. In either case, the two completed reads cannot be placed into a legal single-object sequence containing only the initial version 0 and the write of version 1. A write still in progress does not justify reversing these completed reads. This is Hesela's counterexample, not an observed CRAQ defect.
The model enumerates 21 reachable snapshots for three nodes and two ordered writes, then checks all 63 node reads. The version-checked policy selects the tail's version in every frozen snapshot. Tests compare the transition explorer with a separate ordered-tuple enumeration. State counts are coverage, not probabilities, and the model is not a proof for asynchronous reads or changing membership. It excludes failures, version-reclamation races, clocks and persistent storage.
Download the complete states and code hashes, model, generator and tests. The reproduction instructions require only Node.js. Corpus: CRAQ.
An old value at response time is not automatically stale
Linearizability preserves the order of non-overlapping operations, not response order alone. A read overlapping a write may legally precede it even if the write responds first. [27, section 2.2]
These four original histories use one register initially equal to 0. Event numbers are logical positions, not elapsed time. All operations complete successfully; the checker searches legal sequential orders for at most six operations.
- An overlapping write finishes first. Read starts at event 0 and returns 0 at event 3; write(1) starts at 1 and completes at 2. Read before write is legal. Witness: read-old, write-one.
- A later read misses a completed write. Write(1) completes at event 1 before read starts at 2 and returns 0 at 3. No legal order exists. No legal order.
- Sequential reads return 1 then 0. Write(1) spans events 0 to 5. Read(1) spans 1 to 2; read(0) spans 3 to 4. Their non-overlap forces an impossible reversal. No legal order.
- Overlapping reads finish in reverse value order. Read(0) spans events 0 to 5, write(1) spans 1 to 2 and read(1) spans 3 to 4. The old read can be ordered before the write despite responding last. Witness: read-old, write-one, read-new.
Download the histories and code hashes, bounded checker, tests, independent ordering checks and generator. This checks constructed register histories, not CRAQ message handling, garbage collection, pending operations, failure recovery or liveness.
A delayed version reply can outlive its local bytes
An acknowledgement permits old-version deletion. Selection and byte retrieval therefore need a coordinated lifetime rule. [26, section 2.3] In the pinned archived code, both read handlers recheck clean state after the query. On a still-dirty missing-version path, the basic handler returns no value; the extended handler tries the newest pending payload while retaining the queried version label. [30, read handlers and acknowledgement handler]
Constructed witness: version 1 is acknowledged locally and version 2 is already pending. The tail answers a version query with 1; it then commits 2, whose acknowledgement removes local version 1; version 3 arrives but never commits. Delayed read resolution now sees versions 2 and 3. Substitution returns payload 3 labelled 1. Checking the acknowledged version instead returns payload 2 labelled 2 in this model.
| Selection path | Payload version | Advertised version |
|---|---|---|
| Basic handler branch | No value | Not returned |
| Extended fallback branch | 3 | 1 |
| Checked acknowledged-value alternative | 2 | 2 |
All 30 orders permitted by this five-event model are enumerated; 4 reach the mismatch. These are coverage counts, not failure probabilities. This independently written source-path illustration does not execute the original server or validate transport, storage callbacks or recovery. The checked alternative is not a production patch or a full protocol proof.
Download the traces and code hashes, selection model, positional-oracle tests and generator.
Convergence does not promise a freshness deadline
Eventual consistency concerns convergence after updates stop, under the system's delivery and conflict-resolution assumptions. It does not by itself promise a fixed stale-read window or session guarantees. [28]
Dynamo's original design illustrates a separate problem: concurrent branches can need application-level reconciliation. Eventual does not mean that the storage layer always picks a single newest timestamp. This is the 2007 Dynamo design, not a statement about current DynamoDB APIs. [29, section 4.4]
Availability remains conditional: CRAQ's joining nodes withhold reads until synchronized. Chain membership and recovery require coordination; these examples do not promise uninterrupted strong reads across arbitrary partitions. [26, section 5.3] [11]
Local reads need authority, not just a local copy
Engineering synthesis: separate two questions: does this replica hold a usable version, and is it still allowed to answer? The published protocols below move coordination to different places; they are not interchangeable settings.
| Protocol | When local bytes can answer | Where coordination remains |
|---|---|---|
| CRAQ | Latest local version is clean in the current chain | A dirty replica asks the tail which committed version to return |
| Quorum leases | Active object lease; pending updates resolved before reading | Writes notify affected lease holders as well as obtaining a Paxos majority |
| Hermes | Valid key on an operational replica with a membership lease | Writes wait for every other current live member, not just a majority |
CRAQ: dirty means that the newest local version is not yet known to be committed, not that the local payload is unreadable. The tail supplies a version number; the replica supplies its corresponding bytes. A joining node must reconcile with its successor before serving that object's reads. [26, sections 2.3 and 5.3]
Quorum leases: grantors and holders are different sets. Majority promises activate a lease, but its holder set can have any size. Clocks need not be synchronized; clock-rate drift must still fit the timing guard. A holder's read window must end before grantors can disregard their promises. An unreachable holder can therefore delay affected writes until those promises expire. [46, sections 3.1-3.6]
Multi-object consequence: writes must cover the union of affected holder sets. With both leases active on replicas 0-4, holders {0,1,2} for one object and {0,3,4} for another require all five for a combined write, even though each set is a majority. This is set arithmetic, not a workload probability. [46, section 3.6]
Hermes: an invalid key stalls reads even though invalidation already carried the new value. Recovery can replay that value with its original timestamp. A missing acknowledgement does not authorize unilateral removal of a member: the lease-based design reconfigures membership after lease expiry. [47, sections 2.4 and 3.1-3.4]
Clock-free variant: Hermes can execute a read speculatively, but withholds its response until subsequent majority-backed membership confirmation. This trades the lease assumption for a wait, not an unconditional local reply. Its single-key in-memory protocol does not establish multi-key transactions or disk durability. [47, sections 2.1, 3 and 8]
Operational inference: a failover check should capture key/version state, read authority, membership epoch and outstanding acknowledgements. A reachable replica with plausible bytes is insufficient evidence of a safe read. This comparison reviews published designs; no prototype or failure experiment was run for this section.
A clean routing decision can expire in transit
Harmonia moves conflict detection into a programmable switch. Its receiver checks remain protocol-specific: a read-ahead replica rejects an object version beyond the request's commit stamp; a read-behind replica rejects a stamp beyond its committed-and-executed progress. The design also needs ordered writes and a single active scheduler. [39, sections 6.2 and 8]
Hesela's constructed examples assume those surrounding protocol obligations. Stamp 7 is a sequence marker, not milliseconds or bytes. In the read-ahead rows, local progress means the latest write applied to the requested object. In the read-behind rows, it means the replica's committed and executed sequence point. These are different quantities.
| Family | Read stamp | Local progress | Guard decision |
|---|---|---|---|
| read-ahead | 7 | 6 | Local candidate |
| read-ahead | 7 | 7 | Local candidate |
| read-ahead | 7 | 8 | Normal protocol |
| read-behind | 7 | 6 | Normal protocol |
| read-behind | 7 | 7 | Local candidate |
| read-behind | 7 | 8 | Local candidate |
Constructed overtaking case: a read leaves the scheduler with stamp 7. A later write numbered 8 reaches this replica first. The read-ahead check sends the delayed read through the normal protocol instead of exposing version 8. In the opposite case, a read-behind replica at progress 6 cannot satisfy stamp 7. Reusing the same inequality for both families reverses one of these decisions.
Local candidate is not a correctness certificate. An older object version can be legitimate when intervening sequence numbers concern other objects; a newer executed point can be legitimate in the other family. This small program checks only the two predicates, not message histories, scheduler leases, failure recovery, persistence or throughput. Equality is included explicitly to catch off-by-one changes.
Reproduce with the model, tests, generator and exact inputs, outputs and code hash. Run node --test model.test.mjs and node generate.mjs --check in the same directory. The examples illustrate a source-described obligation; they do not identify a new flaw in Harmonia or reproduce its performance results.
CURP: a primary reply is only part of completion
CURP separates execution from backup synchronization. Clients send an update to the primary and witnesses concurrently. Witnesses retain unordered requests until the primary makes their outcomes durable in backups. [CURP, sections 2-3.4]
| Observed state | Required action |
|---|---|
| Primary result and all witnesses accept | Fast-path completion |
| A witness rejects or cannot be reached | Wait for backup synchronization |
| Read conflicts with an unsynced update | Synchronize before answering the read |
The primary cannot infer witness acceptance from its own execution. Exposing an unsynced value to another reader could reveal a write that recovery loses. [CURP slides 8-13] A response marked synchronized avoids an additional client sync request. [CURP, section 3.2.3]
Replay also needs request deduplication: a durable result and mutation must survive together. Commutativity permits reordering; it does not make duplicate execution harmless. [RIFL, sections 3-4] These are protocol requirements, not a measured performance gain for a deployment.
vCorfu: a position is not a committed update
The NSDI 2017 vCorfu design groups object updates into materialized streams while retaining global order. Stream replicas support direct reads; issuing a token alone does not publish the update. [45, sections 3.1-3.3, p. 38]
| Stage | What happens | What it establishes |
|---|---|---|
| Token issued | Global and stream positions assigned | Not write completion |
| Replica writes | Log replica first, then stream replicas | Not yet readable merely because one copy exists |
| Commit handling | Final replica commits with its write; earlier replicas receive commit messages | Replicas serve only committed data |
Layout epochs reject stale requests. The server-driven alternative is future work in this paper, not its evaluated write path. [45, sections 3.1-3.2]
Evidence limit: every benchmark disables persistence. The Cassandra 2.1.9 comparison uses replication factor 2, ALL consistency and durable_writes=false. These are not durable-throughput measurements or a current product ranking. Hesela has not reproduced the prototype. [45, sections 6-6.2, pp. 42-44]
Engineering inference: reading a committed version, preserving it through a specified failure and measuring its throughput remain separate questions.
Lag needs a stage, unit and observation context
PostgreSQL's pg_stat_replication reports directly connected standbys. Its sent, written, flushed and replayed LSN positions distinguish progress stages. The lag intervals include recent processing and notification delay; they are not a catch-up-time estimate. [4]
A caught-up idle standby can retain its last measured delay briefly, then report NULL. Missing logical-replication tracking can also produce NULL. Converting every missing value to zero discards important uncertainty. [4]
An LSN difference measures bytes in PostgreSQL's WAL address space, not transactions or seconds. The hexadecimal representation does not change that unit. Compare compatible log histories and label the two endpoints. [5] [9]
| Observation | Meaning | Avoid inferring |
|---|---|---|
| Current WAL write position minus replay position | Byte distance between those stages | Number of lost transactions or seconds to recover |
replay_lag | Recent replay and notification delay | A forecast of catch-up time |
| Time since last replayed transaction | Age of the latest replayed commit/abort timestamp | Proof of backlog during an idle period |
Function names also need care: pg_current_wal_lsn() identifies the write position, whereas the insert and flush functions identify other stages. pg_last_wal_receive_lsn() already describes data received and synced to disk. The last replayed transaction timestamp can remain unchanged while the system is idle, so its age alone is not evidence of queued work. [7]
Check the history branch before comparing LSNs
A PostgreSQL timeline identifies a WAL-history branch. Completing archive recovery starts a new one. Its timeline history file preserves the ancestry needed to choose WAL across branches. [9]
Monitoring inference: equal numeric LSNs after a fork do not prove equal WAL contents. An LSN supplies a byte address, not cluster identity or ancestry. A larger timeline ID alone does not prove that it contains another branch's commits. Read the history before treating a byte difference as catch-up backlog. [5] [23]
The replication protocol's IDENTIFY_SYSTEM reports systemid, timeline and a current WAL flush position as xlogpos. TIMELINE_HISTORY returns the requested history file. These are replication commands, not ordinary SQL statements. Record the identity, history, progress stage and observation time together; the response alone does not establish promotion safety or complete WAL availability. [21]
Recovery branch selection is separate from its stopping point. In PostgreSQL 18, setting recovery_target_timeline to current selects the base backup's timeline; latest is the default, or an explicit ID can be selected. The hexadecimal filename prefix 00000011 means timeline 17: spell the setting as 0x11 or decimal 17, not decimal 11. [22] A backup cannot recover into a branch that diverged before that backup. [9]
A standby backup can cross a timeline switch
A PostgreSQL 18 backup manifest can contain several WAL ranges if a standby follows an upstream promotion during the backup. Each range carries its own Timeline, Start-LSN and End-LSN; one manifest has no repeated range for the same timeline. [24]
Inventory implication: retain the timeline with each range, not just the smallest and largest numeric LSN. Its end is a minimum replay boundary for using the backup, not evidence that a later recovery target is reachable. [24] pg_verifybackup parses the required WAL, not every extra archived segment, and does not execute a restore.[25] See the backup verification checklist.
Slots preserve catch-up history, not commit acknowledgements
A replication slot keeps track of a consumer's retention needs. A disconnected consumer can leave WAL pinned on the sending server until pg_wal fills. [12] This is separate from the commit policy above: creating a slot does not make an asynchronous replica synchronous.
PostgreSQL 18 checks max_slot_wal_keep_size at checkpoints. Its default, -1, leaves slot retention unlimited; a finite setting can permit removal of WAL still needed by a lagging consumer. [13] Operational inference: this trades catch-up history against storage pressure. It is not an immediate hard ceiling on the whole WAL directory.
wal_keep_size is a minimum retention setting, not that maximum. PostgreSQL may keep more WAL for other reasons. The separate idle_replication_slot_timeout also invalidates at checkpoint time, not precisely when its timer expires; it excludes slots without WAL reservations and synchronized standby slots. [13]
Read slot state before interpreting a byte counter
In pg_replication_slots, restart_lsn is the oldest potentially required WAL position. confirmed_flush_lsn is a logical consumer's receipt acknowledgement, not an application-read boundary; it is NULL for physical slots. [14]
| wal_status | What it establishes |
|---|---|
reserved | Required files remain within max_wal_size. |
extended | Files remain available beyond that threshold, retained by a slot or wal_keep_size. |
unreserved | Slot protection has lapsed; some required files await removal at the next checkpoint. The state can recover. |
lost | The slot is unusable. |
safe_wal_size reports remaining WAL-write headroom, in bytes. NULL can mean a lost slot or an unlimited slot-retention setting. Inspect wal_status, invalidation_reason and configuration together. [14]
Hesela's evidence checklist: record the slot's consumer, both LSNs, state, limits and timestamp alongside actual disk free space. An LSN distance is not a directory-size measurement, and overlapping retention ranges must not be added as independent storage consumption. An alarm alone is not justification to delete or advance a slot: first establish the consumer's recovery requirements.
WAL headroom does not measure retained row versions
Slots can also hold back row-version cleanup. xmin records a transaction retention horizon; catalog_xmin does the same for system catalogs. VACUUM cannot discard row versions still protected by these horizons. [14] A disconnected logical consumer can therefore retain catalog history as well as WAL. [15]
This is not only a disk-capacity concern. PostgreSQL 18's vacuum guidance describes transaction-ID exhaustion protection: the server refuses work requiring new transaction IDs, while read-only transactions and VACUUM can continue. It recommends examining age(xmin) and age(catalog_xmin)for old slots. These ages count transactions, not seconds. [16, section 24.1.5]
Monitoring inference: a WAL-only dashboard can miss this risk. Track retention ages and vacuum progress alongside WAL availability and disk space. Before removing a slot, establish ownership and recovery needs: a returning replica may require rebuilding. [16]
Crash-safe slot state does not promise exactly-once effects
Logical decoding turns PostgreSQL WAL into a consumer-facing change stream. Slot positions are persisted at checkpoints; after a crash, a logical slot can resend recent changes. Consumers must handle repetition safely. [15] Connect recovery progress to the consumer's applied effects, not merely its last network read; idempotency is a separate application property.
A failover-enabled slot is not yet a failover-ready slot
PostgreSQL 18 can copy a logical failover slot to a physical standby. The copy is asynchronous: enabling failover is not evidence that a usable slot exists on the promotion target. Inventory every required subscription slot, including completed-copy table synchronization slots (srsubstate = 'f') across the relevant subscriber databases. Non-PostgreSQL consumers need their own inventory. [17]
Assuming logical replication is already configured, additional standby synchronization requirements are sync_replication_slots, hot standby feedback, an upstream physical slot selected by primary_slot_name, and a valid dbname in primary_conninfo. Slot persistence also requires the needed WAL and catalog history to remain available there. [15, section 47.2.3]
On the primary, synchronized_standby_slots names physical slots. It holds back logical failover-slot consumption until the named standbys receive and flush the WAL. It does not require replay. A missing or invalidated listed slot blocks logical replication. Do not confuse this setting with synchronous_standby_names, which uses application names for commit acknowledgements. [18]
Missing rows must remain visible in the readiness check
Every expected slot must exist on the target standby and satisfy synced AND NOT temporary AND invalidation_reason IS NULL. [17] Hesela's query adaptation: start from the expected inventory, then left-join observed slots. Filtering only existing rows can hide a missing consumer. The example also checks server role and slot type; replace both illustrative names with the complete inventory.
-- Read-only PostgreSQL 18 example. Run on the intended standby before promotion.
-- Replace this illustrative inventory with ALL required logical slot names.
WITH expected(slot_name) AS (
VALUES ('orders'), ('inventory')
)
SELECT e.slot_name,
s.slot_name IS NOT NULL AS present,
pg_is_in_recovery() AS on_standby,
COALESCE(
pg_is_in_recovery()
AND s.slot_type = 'logical'
AND s.synced
AND NOT s.temporary
AND s.invalidation_reason IS NULL,
false
) AS slot_ready
FROM expected AS e
LEFT JOIN pg_replication_slots AS s USING (slot_name)
ORDER BY e.slot_name;
Download the read-only SQL example. No rows, an incomplete inventory, or any false result is insufficient evidence. synced can remain true after promotion, so its value on a primary is not a standby-readiness signal. [14]
For planned promotion, PostgreSQL recommends disabling subscriptions, switching their connection to the promoted server, then re-enabling them. Otherwise a returning old primary can continue feeding a divergent stream. [15] Fencing and consumer duplicate handling remain separate requirements. This is a point-in-time diagnostic, not a promotion command or a guarantee of zero data loss. The query checks slot state, not WAL-delivery ordering or whole-cluster promotion safety.
Validation boundary: automated tests exercise this query's missing-row and boolean logic using synthetic SQLite fixtures. They do not test PostgreSQL replication, catalog permissions, concurrent changes or an actual failover.
An older requested LSN does not rewind a logical slot
PostgreSQL 18 START_REPLICATION ... LOGICAL starts at the greater of the requested LSN and the slot's confirmed_flush_lsn. A successful reconnect can therefore begin later than the consumer requested; the protocol documentation recommends checking the confirmed position against expectations. [19]
Operational inference: recreating a missing slot under its old name is not evidence that the original stream can resume. Slot identity and a consumer bookmark do not reconstruct retained history. Treat a position mismatch as a recovery decision requiring reconciliation or a coordinated new snapshot, not permission to advance the consumer's checkpoint blindly.
An unanswered write can survive recovery
In VMstore's recovery example, one replica retains W2 and the other W1 after independent local high-availability failovers; neither write was acknowledged. Recovery merges PAW/SAW tracking and rewrites the affected secondary ranges from the primary, retaining W2 and rolling back W1. This is a protocol-specific recovery choice, not a rule that every unacknowledged write is discarded. [20, section 4.2, p. 301 and footnote 5]
Operational inference: client uncertainty and physical absence are different. A missing reply alone cannot establish rollback. This filesystem example does not define PostgreSQL recovery behavior.
Replication progress is not content verification
Glass and colleagues' FAST 2018 VMstore paper describes a separate integrity check: pause operations with file-level locks, drain in-flight work, then compare incrementally maintained per-file checksums between replicas. Batching limits the scope of the pause. The authors explicitly describe these checksums as non-cryptographic and probabilistic. [20, section 7]
Interpretation: acknowledgement, recovery readiness and content agreement are different evidence. This is a vendor-authored filesystem case study, not a PostgreSQL feature, an independent replication of its results or proof that matching checksums exclude every corruption.
Record evidence before declaring a failover safe
Hesela's diagnostic checklist is an editorial synthesis, not an automated failover procedure:
- Record the commit policy and required replica membership for the affected transactions.
- Capture the candidate's write, flush and replay positions with timestamps and log-history context.
- Separate acknowledged transactions from requests whose outcome the client never learned.
- Check promotion eligibility and fencing independently of replica freshness.
A client can miss the success response for a transaction that the primary later recovers as committed. A missing acknowledgement is not proof of rollback. Treat that as an uncertain completion problem, not permission to retry blindly. [3]
Method and limits
This is a documentation and paper review, not a replication experiment. We compared PostgreSQL 18, the DRBD 9 guide, Swordfish 1.2.8 and the original OSDI 2004 chain-replication paper, plus the FAST 2018 VMstore paper. No failover was executed, and no latency, loss probability or recovery time was measured. These reference versions are not a claim about the newest available release. Verify actual settings, storage flush behavior and failure domains before applying the conclusions.
Machine-readable definitions: synchronous replication, asynchronous replication, replication lag, log sequence number and storage mirroring.
Primary sources
- PostgreSQL 18: WAL settings, synchronous_commit
- PostgreSQL 18: synchronous_standby_names
- PostgreSQL 18: warm standby and synchronous replication
- PostgreSQL 18: pg_stat_replication and lag semantics
- PostgreSQL 18: pg_lsn type
- LINBIT DRBD 9 guide: section 2.3, replication modes
- PostgreSQL 18: WAL and recovery information functions
- SNIA Swordfish 1.2.8: ReplicaType Mirror
- PostgreSQL 18: timeline history and recovery branches
- PostgreSQL 18: Repeatable Read snapshot semantics
- Robbert van Renesse and Fred B. Schneider: Chain Replication for Supporting High Throughput and Availability, OSDI 2004, pp. 91-104
- PostgreSQL 18: replication slots and WAL retention
- PostgreSQL 18: WAL retention limits and idle slot timeout
- PostgreSQL 18: pg_replication_slots state and progress fields
- PostgreSQL 18: logical decoding concepts and crash replay
- PostgreSQL 18: routine vacuuming and transaction-ID wraparound prevention
- PostgreSQL 18: logical replication failover and required slot inventory
- PostgreSQL 18: synchronized_standby_slots WAL-delivery gate
- PostgreSQL 18: START_REPLICATION SLOT LOGICAL and confirmed_flush_lsn
- Gideon Glass, Arjun Gopalan, Dattatraya Koujalagi, Abhinand Palicherla and Sumedh Sakdeo: Logical Synchronous Replication in the Tintri VMstore File System, FAST 2018, pp. 295-308
- PostgreSQL 18: IDENTIFY_SYSTEM and TIMELINE_HISTORY
- PostgreSQL 18: recovery_target_timeline
- PostgreSQL 18.0: timeline history reader and writer
- PostgreSQL 18: Backup Manifest WAL Range Object
- PostgreSQL 18: pg_verifybackup scope and WAL verification
- Jeff Terrace and Michael J. Freedman: Object Storage on CRAQ, USENIX ATC 2009
- Maurice P. Herlihy and Jeannette M. Wing: Linearizability: A Correctness Condition for Concurrent Objects, ACM TOPLAS 12(3), 1990, section 2.2
- Werner Vogels: Eventually Consistent - Revisited, 23 December 2008
- Giuseppe DeCandia et al.: Dynamo: Amazon's Highly Available Key-value Store, SOSP 2007, section 4.4
- CRAQ archived implementation: chain_node.Tc, commit c394900b4da3 (2012)
- PostgreSQL 18.0: synchronous replication waiting, cancellation and policy changes
- PostgreSQL 18.0: local commit ordering before synchronous replication wait
- PostgreSQL 18: libpq cancellation dispatch, section 32.7.1
- PostgreSQL 18: cancellation request and original query response, section 54.2.8
- PostgreSQL 18: libpq notice and warning processing, section 32.13
- PostgreSQL 18: standby query conflicts and replay, section 26.4.2
- PostgreSQL 18: max_standby_streaming_delay
- PostgreSQL 18: hot_standby_feedback
- Hang Zhu et al.: Harmonia, PVLDB 13(3), 375-388 (2019), sections 6-8; DOI 10.14778/3368289.3368301
- Seo Jin Park and John Ousterhout: Exploiting Commutativity For Practical Fast Replication, NSDI 2019, pp. 47-64, sections 3.1-3.6
- Park and Ousterhout: CURP presentation, NSDI 2019, slides 8-14
- Lee et al.: Implementing Linearizability at Large Scale and Low Latency, SOSP 2015, sections 3-4; DOI 10.1145/2815400.2815416
- Juncheng Gu et al.: Efficient Memory Disaggregation with Infiniswap, NSDI 2017, pp. 649-667, sections 4.3-4.5
- Yizhou Shan et al.: LegoOS: A Disseminated, Distributed OS for Hardware Resource Disaggregation, OSDI 2018, pp. 69-87, section 4.7
- Michael Wei et al.: vCorfu: A Cloud-Scale Object Store on a Shared Log, NSDI 2017, pp. 35-49, sections 3.1-3.3 and 6-6.2
- Moraru, Andersen and Kaminsky: Paxos Quorum Leases, SoCC 2014, sections 3.1-3.6; DOI 10.1145/2670979.2671001
- Katsarakis et al.: Hermes, ASPLOS 2020, sections 2.4, 3 and 8; DOI 10.1145/3373376.3378496
- RFC 5531: ONC RPC Version 2, sections 4, 5, 8.1 and 9
- gRPC: Core concepts, RPC termination and cancellation
- Kalia, Kaminsky and Andersen: Datacenter RPCs can be General and Fast, NSDI 2019, sections 3.1, 5.3, 7.1 and Appendix B
- Zhang, Sharma, Szekeres, Krishnamurthy and Ports. Building Consistent Transactions with Inconsistent Replication. SOSP 2015, pp. 263-278. DOI 10.1145/2815400.2815404; sections 3-6.
- UWSysLab TAPIR configuration.cc: QuorumSize and FastQuorumSize, commit c50d906
- UWSysLab TAPIR IR client.cc: matching results, slow path and finalization, commit c50d906
- Hsiao and DeWitt: Chained Declustering, author-hosted 30-page manuscript, sections 3-5; exact manuscript edition unverified
- Holland and Gibson: Parity Declustering for Continuous Operation in Redundant Disk Arrays, ASPLOS 1992, section 2
Timeline identity, recovery selection and backup WAL ranges reviewed 21 October 2026; slot documentation reviewed 16 October 2026; VMstore recovery example and PostgreSQL cancellation sources reviewed 2 November 2026; earlier sources reviewed 12 October 2026. Conclusions are version-scoped.