Concepts and theorems · Intermediate

Durability: preserve acknowledged changes through specified failures

Distinguish commit acknowledgement, WAL, storage and backups while stating the failure scope of durability.

Ask Logeia about this articleTry the three questionsReview your answers

Updated

On this page
  1. Name the acknowledged result and failure model
  2. Follow acknowledgement and recovery records
  3. Asynchronous acknowledgement changes the promise
  4. Match recovery mechanisms to failures
  5. Move the crash across the acknowledgement boundary
  6. Verify recoverability, not only copy creation
  7. Ask Logeia about this articleCheck your understanding

Name the acknowledged result and failure model

Durability preserves a result acknowledged as complete through a specified class of failures. In a transactional database, successful commit acknowledgement is an important boundary. The property cannot sensibly mean survival of every imaginable event without assumptions. An operating system crash, power failure, failed storage device and destroyed site are different scenarios. State the storage and replication assumptions and which recovery outcome is promised under them. A value being visible in memory does not establish the promise. Likewise, a durable record on one surviving device does not by itself address the loss of that device.

Acceptance, execution, and receipt of a successful reply are different events. A reply lost in transit can leave a client uncertain even though the update is already durable. Conversely, a configuration that acknowledges before persistence can lose a recently acknowledged update. Define the acknowledgement boundary and failure assumptions for each operation. A timeout does not establish rollback, and a visible success message does not by itself reveal which persistence policy the server used. Those facts must come from the service contract and implementation.

Follow acknowledgement and recovery records

Consider an update whose required WAL records are flushed durably before a successful commit is acknowledged. The final data page need not already be written if recovery can reproduce the change from the surviving log. The ordering matters: a log held only in volatile memory cannot support recovery from loss of that memory. Writing ahead does not eliminate data-page writes; it establishes a safe basis for performing them later. The storage stack must also honour its persistence contract. A database cannot obtain durability from a device that falsely reports completion or loses supposedly protected writes outside the assumed failure model.

The relevant log contains information required to reconstruct the change. Passing log bytes to the operating system and retaining them across the assumed failure are separate steps. PostgreSQL settings such as fsync and synchronous_commit affect that boundary, and storage write caches are part of the assumptions. The presence of a file named WAL is not a sufficient durability argument. Check the complete persistence path. A checkpoint establishes a recovery starting point; it does not make every subsequent log record unnecessary or replace the need to retain required recovery information.

Asynchronous acknowledgement changes the promise

PostgreSQL asynchronous commit can acknowledge logical completion without waiting for the required WAL to become durable. A crash in the intervening window can lose recent acknowledged changes. That is different from asserting that recovery necessarily corrupts the database. Some replaceable observations or noncritical logs can tolerate such a loss window, while an irreversible external action may not. If a performance comparison uses weaker acknowledgement semantics, name the changed guarantee. It is not a like-for-like improvement simply because the response arrives sooner; the application must decide whether the newly permitted outcome is acceptable.

Asynchronous commit does not automatically change the transaction isolation level. Visibility to concurrent sessions, all-or-nothing recovery, and survival of the latest acknowledged transaction are different properties. Calling a setting a performance option hides the trade-off unless the weakened guarantee is described. Classify which operations may be lost and identify the point before an irreversible external action at which stronger persistence is required. A recoverable telemetry sample and a payment authorization can have very different acknowledgement requirements even when stored by the same database engine.

Match recovery mechanisms to failures

Recovering one crashed server is different from undoing an erroneous deletion or rebuilding after losing an entire device. Replication may quickly propagate the mistaken update too. Backups retain a restoration basis and, where applicable, the history needed to recover to a chosen point. Distinguish the allowed data-loss objective from the recovery-time objective instead of using one vague claim of safety. Test restoration in a separate environment. The practical question is which acknowledged results can be recovered, from which surviving materials, and within what time under the failures the system is meant to withstand.

An RPO of five minutes and an RTO of thirty minutes are targets, not facts established merely by scheduling backups every five minutes. Completed copies, required logs, decryption keys, restore capacity, and operational steps affect whether those targets can be met. A restore exercise should record both the recovered data point and elapsed recovery time. One successful exercise is evidence for its tested conditions, not an unconditional guarantee against every future storage failure, operator error, or regional outage. Repeat tests when material assumptions change.

Move the crash across the acknowledgement boundary

Use an illustrative timeline: execute the update, persist the required WAL, send success, and later flush the changed data page. Under the synchronous durability assumptions, a crash after log persistence but before the data-page flush can be recovered by replaying the retained log. A configuration that sends success before log persistence permits a different failure window: a crash after the client sees success can lose that update. If only the reply is lost after persistence, the update can survive while the client remains uncertain. Treating all three situations as one generic failure invites unsafe retries. Durability and request deduplication therefore require separate designs. This is a reasoning example with stated assumptions, not an executed crash-test transcript.

Verify recoverability, not only copy creation

A log saying that a backup job ran does not show that a usable restore set exists. Restore into a separate environment using the required base copy, continuous WAL, configuration, and keys. Recover to the selected point, then check important application state as well as whether the database starts. An erroneous deletion propagated to every live replica requires history from before that deletion. Replication can improve availability while faithfully copying the same mistake. Map redundancy, point-in-time history, and executable restoration procedures to the failures they address. Keeping more copies, keeping older states, and being operationally able to restore are related but separate requirements.

Reading and practice are recorded separately in this browser, for each language.

Learn this in order

Understand the systems behind the web · STEP 13

Choose a learning path