Research notes / Database recovery
WAL, checkpoints and torn pages: three different recovery guarantees
Published 12 October 2026 / Updated 17 November 2026 / Source review, process-exit observations and synthetic model
A transaction can be durable before its changed data pages reach their final locations. That does not make a checkpoint a backup, or make every page write atomic. These are separate recovery guarantees. SQLite adds another boundary: atomicity within one database does not always extend to a transaction spanning attached database files.
On this page22 sections
Commit the recovery information first
PostgreSQL's write-ahead rule requires the relevant log records to reach durable storage before the corresponding data-file changes. Recovery can replay the log, so a synchronous commit need not flush every modified data page. Group commit can share a log synchronization across transactions. [1]
The boundary is durable WAL, not merely a log buffer or a successful write into an operating system cache. PostgreSQL's reliability documentation follows the path through OS, controller and drive caches: recovery depends on those layers honoring persistence requests. [2]
Group commit shares persistence work, not transaction identity
Group commit lets several transactions share one WAL synchronization. With synchronous local commit, each acknowledgment still requires its commit record to be durable. It does not require a separate synchronization per transaction. [1] [5]
PostgreSQL 18 can group commits with commit_delay=0. A positive delay gives concurrent transactions more time to join a flush, potentially trading response latency for throughput; excessive waiting can reduce throughput. commit_siblings counts other active transactions before that deliberate wait, not guaranteed batch members or transactions already ready to commit. It does not set a minimum group size. [4] [3]
Asynchronous commit changes the acknowledgment boundary instead. With synchronous_commit=off, success can precede durable WAL. The commit_delay setting is ignored for asynchronous commits; delaying a synchronous flush and skipping its immediate wait are different mechanisms. [5]
PostgreSQL does not apply that choice indiscriminately: utility commands such as DROP TABLE and two-phase-commit commands such as PREPARE TRANSACTION are forced to commit synchronously. A session setting alone is therefore not a complete description of every operation's acknowledgment path. [5]
Application boundary: Hesela's inference from transaction semantics is that sharing a flush does not join separate transactions into one all-or-nothing operation. An application requiring two changes to succeed or fail together needs a suitable transaction boundary, not a hope that the requests land in the same batch. Nor does group commit alone require a standby to persist or replay anything. [19] [3]
For evaluation, keep acknowledgment settings, concurrency and workload fixed; report both completed transactions per second and client-visible commit latency. This is a measurement recommendation, not a benchmark result or a recommended delay value. Engine and storage guarantees still need separate verification.
Early lock release is not early acknowledgment
DeWitt and colleagues' 1984 report describes releasing a pre-committed transaction's locks before its log reaches disk, while withholding success from the client. Dependent transactions must not persist ahead of their predecessors. This is a particular concurrency protocol, not a requirement of all group commit implementations. Its throughput arithmetic uses assumed I/O costs, not a modern benchmark. The authors also acknowledge earlier System R implementation claims, so this report does not establish invention priority. [20]
Count the same work before comparing rates
In PostgreSQL 18, WAL I/O counts are in pg_stat_io rows with object='wal'; pg_stat_wal reports generated records and bytes. xact_commit is per database, while the I/O view spans the cluster. Hesela's measurement warning: dividing those totals is not a direct measurement of group size. Use aligned interval deltas, record resets and backend scope, and distinguish read-only transactions from writes. Counters do not identify which requests shared a flush. [21]
A recovery frontier belongs to a session
Concurrent prefix recovery (CPR) uses coordinated session-local boundaries instead of one global issue-time cutoff. The 2019 paper proves consistency for its protocol, not for arbitrary independently chosen offsets. Its implementation uses checkpoint-based group commit. [34]
Keep the API distinction: FasterKV documents a frontier UntilSerialNo plus possible excluded pending operations. A number below that frontier can therefore still need replay. Preserve the session identity and the exceptions belonging to the recovered checkpoint. [35] The pinned WaitForCommitAsync checks both frontier progress and an empty exclusion list; calling it does not itself start a checkpoint. [36]
Benchmark boundary: the paper's Faster evaluation keeps reads in memory and does not trigger expiration-based garbage collection. It does not measure cold-read or cleaning behavior. [34]
Eleven invented operations, four replay choices
This original accounting example starts with independent unit increments: session A issues 1 through 6, session B issues 1 through 5. One invented checkpoint reports A through 4 except 2, and B through 2 without exceptions. Its retained identities are A:1, A:3, A:4, B:1 and B:2. The correct remainder is A:2, A:5, A:6, B:3, B:4 and B:5.
| Replay selection | Replayed | Missing identities | Repeated identities | Total applications |
|---|---|---|---|---|
| Session receipt and exceptions | 6 | None | None | 11 |
| Session frontier only | 5 | A:2 | None | 10 |
| Global maximum frontier | 3 | A:2, B:3, B:4 | None | 8 |
| Replay every issued operation | 11 | None | A:1, A:3, A:4, B:1, B:2 | 16 |
Ignoring A's exception loses A:2. Using the largest frontier for both sessions also loses B:3 and B:4. Replaying everything repeats the five retained increments. These are deterministic consequences of the invented receipts, not failure probabilities. Operation identity matters even when a total happens to look plausible.
Scope: no FASTER execution, checkpoint algorithm, concurrency schedule or crash test. The model trusts one matching receipt per session and a complete issued history. Its independent increments commute. It does not establish which receipt sets a real engine can produce, prescribe replay order for dependent operations, or make external side effects exactly-once. Those require their own contracts.
Reproduce the finite example from the model, tests and generator. The generated JSON includes the model's SHA-256. The tests also enumerate sparse serial histories and reject mixed checkpoint identities, duplicate sessions and invalid exceptions.
A log position is not a persistence receipt
PostgreSQL distinguishes the insertion position, the write position and the durable flush position. pg_current_wal_lsn() reports the write position, not the flush position; pg_current_wal_flush_lsn() reports the latter. A WAL record can have an address while its bytes are still buffered. [8]
Keep the engine, timeline and progress stage with an LSN. Byte-distance between positions is not elapsed lag time, and the progress of one server does not establish that a standby has replayed the same record. [9] [8]
Three settings, three different questions
PostgreSQL 18 mechanisms, not recommended configuration changes.
| Mechanism | Question it addresses | Boundary |
|---|---|---|
fsync | Is durable synchronization requested? | Disabling it can permit corruption after a system failure. |
synchronous_commit | When may success be returned? | Asynchronous acknowledgment can precede durable WAL. |
full_page_writes | Can recovery reconstruct an incompletely written page? | Logs page images, with additional WAL cost. |
These controls are not interchangeable. Asynchronous commit can lose recently acknowledged transactions while preserving consistent recovery, assuming the other safety mechanisms and storage work correctly. This differs from disabling synchronization. [3] [5]
With synchronous replication configured, acknowledgment may also depend on a standby. PostgreSQL distinguishes remote write, durable flush and replay; this article's simple commit explanation concerns local durability. [3]
A transaction is not a physical page write
A database page can span multiple storage write units. If interruption persists only part of the update, the page may mix old and new contents: a torn write. Neither the transaction's logical atomicity nor a device's sector size alone establishes whole-page atomicity. [2]
PostgreSQL's full-page images give recovery a page reconstruction basis. Ordinary change records alone may be insufficient. With full_page_writes enabled, the first modification after a checkpoint normally records an image. Other engines can use different defenses; this is not a universal storage-device guarantee. [3]
Reading rows can still dirty pages
A PostgreSQL hint bit caches transaction-status information in a tuple header. A visibility check during a read can set it and dirty the containing page without changing application row values. The REL_18_0 implementation calls MarkBufferDirtyHint and guards committed hints against unsafe persistence ordering. This is code evidence, not an observed workload. [28]
When enabled, wal_log_hints protects hint-only changes with a page image on the first page modification after a checkpoint; it does not enable hint bits themselves. With data checksums enabled, hint updates require WAL protection regardless of that setting. Inspect SHOW data_checksums instead of inferring cluster configuration from the release number. [3] [30]
Compress the recovery image, not the guarantee
WAL compression in PostgreSQL 18 targets full-page images, not every WAL record or complete archive segment. Replay decompresses them; CPU work can increase on both paths. This differs from disabling full_page_writes. [3]
The tagged WAL builder can omit a standard page's unused hole even without compression. It keeps a compressed representation only when the encoded result, including required extra metadata, is smaller. Therefore an image need not occupy one page-size worth of WAL bytes. [29]
Count images and bytes separately
Image count is not a count of distinct pages, either. The tagged XLogSaveBufferForHint path permits concurrent backends to record the same block in separate WAL records. That is a correctness-safe race, not evidence of extra distinct pages being modified. [29]
pg_stat_wal.wal_fpi counts images; wal_bytes includes all generated WAL bytes. Both describe the cluster, not one query. Hesela's measurement recommendation: compare interval deltas with unchanged stats_reset, aligned workload and checkpoint conditions. Do not label wal_bytes / wal_fpi a compression ratio or infer physical drive writes from it. Report CPU and replay cost separately. These are interpretation rules, not a PostgreSQL benchmark. A zero image delta also leaves a per-image ratio undefined. [21]
Refresh the observation, not the counters
A second reading can reuse transaction-cached statistics. Take samples in separate transactions, or call pg_stat_clear_snapshot() before reading again. This clears the observer's cached values; it neither resets global counters nor forces other processes to report pending WAL statistics. Reporting lag remains. [21] [31]
Record the sample time, stats_reset and checkpoint context. Reject intervals spanning a reset. The tag's WAL statistics code accumulates process-local counter differences into shared totals; a recent query finish is not by itself proof that every contribution is visible. [31]
InnoDB doublewrite protects the page, not the transaction boundary
In MySQL 8.4, the doublewrite buffer stages flushed pages before their final data-file writes. A surviving page copy can repair an interrupted destination write. It is separate from the redo log, which records changes for replay. Neither is an independent backup. [22] [23]
| Mode | Stored material | Recovery boundary |
|---|---|---|
ON / DETECT_AND_RECOVER | Page content | A usable copy can repair an incomplete write. |
DETECT_ONLY | Metadata, not page content | Detects incomplete writes without supplying their replacement bytes. |
OFF | No doublewrite protection | Does not itself make data-file writes atomic. |
Two page destinations do not imply twice the I/O count or half the throughput. The staging write batches pages sequentially with a shared synchronization (the manual excludes O_DIRECT_NO_FSYNC from that synchronization statement). This is an implementation mechanism, not a measured speedup. [22]
The pinned mysql-8.4.0 implementation makes the detection boundary concrete: reduced entries identify a tablespace, page and LSN, not replacement page bytes. Its reduced_recover path can terminate startup when a corrupt page has not been recovered from a full copy. An all-zero page has a separate nonzero-LSN check. This is a source-code observation, not a fault-injection result or a claim about every later patch. [24]
A checksum supplies another check, not another recovery copy. innodb_checksum_algorithm selects page checksum behavior; detection alone does not provide the missing bytes. PostgreSQL's full-page images provide reconstruction material inside WAL instead. The two designs address a similar page-level risk through different storage paths. [25] [3]
Redo replay is also not the final transaction decision. InnoDB applies redo during initialization, then can accept connections while background rollback handles unfinished transactions. Prepared XA transactions are a distinct case. Therefore a usable page image, a replayed change and an acknowledged transaction are three different observations. [26]
A page defense does not validate the whole update protocol
Pillai and colleagues' OSDI 2014 study separates overwrite atomicity, append atomicity and persistence ordering. BOB explored block traces; ALICE reconstructed crash states from application system calls and checked application invariants. Its eleven applications did not include MySQL. The work supports a testing method, not a verdict on InnoDB doublewrite. [27, sections 2-4]
ALICE required workload-specific checkers and did not explore every possible execution. The authors explicitly warn against ranking database correctness by their vulnerability counts. Historical configurations are not current failure rates. [27, sections 3.6 and 4]
Hesela's evaluation recommendation: check transaction invariants after recovery, not only whether pages pass checksums or the server starts. Record engine version, page size, synchronization and doublewrite settings, and the injected failure boundary. Compare performance only under equivalent recovery requirements. Do not disable a page defense merely because a device advertises atomic writes: verify support for the actual write range and path. The Linux atomic-write analysis explains that separate contract. No MySQL execution experiment is claimed here.
A checkpoint advances recovery progress
PostgreSQL flushes relevant dirty pages and records a checkpoint; crash recovery uses its associated redo position. More frequent checkpoints can reduce replay work but increase flushing and subsequent full-page-image traffic. Completion does not authorize arbitrary WAL deletion: archiving and replication can retain older segments. [4]
SQLite illustrates why engine names matter. Its WAL checkpoint transfers committed page content into the main database file; active readers can prevent completion. Do not read "checkpoint" as "all log files immediately disappear." [7, sections 2.1 and 2.2]
Measured companion: SQLite WAL checkpoint starvation compares pinned readers with idle connections and shows why checkpoint success and file size are different signals.
SQLite rollback journals preserve the old pages
A rollback journal stores before-images for undo; SQLite WAL instead records changed pages for later checkpointing. In the properly synchronized rollback protocol, recovery material is synchronized before database pages are overwritten. These are alternative protocols, not two names for the same file. [12, section 3] [7]
An existing journal is not automatically a hot journal. SQLite checks its header, size, lock state and any super-journal reference before recovery. PERSIST mode can retain a journal with an invalidated header after success. Do not delete a journal merely because it remains on disk: removing recovery material can prevent rollback. Let SQLite perform recovery with the associated files intact. [16, sections 4 and 6] [14, section 2.1]
Observed: a leftover journal need not mean a failed commit
We ran 5 controlled cases on SQLite 3.45.1 with Python 3.12.3 on Linux. Each used a fresh database with 256 rows, 2048-byte payloads, 4096-byte pages, synchronous=FULL, an eight-page cache and spilling enabled. The writer replaced every A payload with B, then exited without closing SQLite, either after COMMIT or before it. No other connection remained open.
| Writer mode / outcome | Journal bytes | First 8 bytes | All rows after reopen |
|---|---|---|---|
| DELETE Committed | File absent | Not applicable | Committed B (256 / 256) |
| TRUNCATE Committed | 0 | Empty file | Committed B (256 / 256) |
| PERSIST Committed | 1,105,424 | All zero | Committed B (256 / 256) |
| DELETE Exited before COMMIT | 1,101,320 | Journal magic | Original A (256 / 256) |
| PERSIST Exited before COMMIT | 1,101,320 | Journal magic | Original A (256 / 256) |
In both unfinished cases, the database file already contained updated B payload bytes before reopening. The recovery read nevertheless returned every original row. The committed PERSIST case retained a nonempty file with a zeroed header. We compared every ID and complete payload with the expected state, in addition to integrity_check. The eight-byte prefix alone is not a hot-journal test. The fresh recovery connection used DELETE mode; its cleanup is not evidence that PERSIST always deletes journals.
Boundary: this is an application-process exit observation on synthetic data, not a power-loss test. The operating system and its caches stayed alive. We did not interrupt COMMIT, test attached databases, inject I/O errors or measure a failure probability. This installed library build is an observation target, not an endorsement of its current patch status; WAL was not exercised.
CrashMonkey's OSDI 2018 method constructs filesystem crash states by replaying recorded block I/O and compares recovered data with an explicit oracle. Our process-exit demonstration does not reproduce that methodology. [17, sections 4.4 and 5.1] See crash-test oracles and limits.
Full observations and environment (JSON) / Reproduction script (Python). Run only on disposable storage. The script creates fresh temporary databases and rejects an existing output filename.
python3 sqlite-journal-observation.py --work-root . --output result.jsonRecorded 2026-10-14T07:22:13.886933+00:00; no random seed is needed.
A valid WAL checksum does not certify the intended value
In two controlled SQLite 3.45.1 captures, Hesela changed three bytes inside a committed 128-byte BLOB without changing the original WAL checksum fields. Native cold reads returned the altered value and a later committed marker; integrity_check returned ok. These are deliberately constructed fixtures, not observed storage failures. [40]
The documented algorithm updates two 32-bit accumulators. Our derivation: at a word-pair boundary, changes of d, -d, -d, 0 across four words restore both accumulator differences to zero after two pairs. All unchanged later input therefore produces the original checksums. The altered bytes are inside the covered page payload: this is cancellation, not an unchecked region. [37, sections 4.1-4.2] [38, walChecksumBytes]
| Detached input | Valid frame prefix | Read BLOB | Later marker | Integrity check |
|---|---|---|---|---|
| Main file only | none | Older base value | 0 | ok |
| Intact WAL | 2 of 2 | Intended value | 2 | ok |
| Three-byte cancellation | 2 of 2 | Altered value | 2 | ok |
| One-byte rejection control | 0 of 2 | Older base value | 0 | ok |
The neutral change preserved the complete WAL header, both frame headers and the entire later frame. A one-byte rejection control instead invalidated the first frame and returned the older base payload and marker, also with integrity_check=ok. Recovery stops at an invalid frame; structural checks do not compare the recovered value with an external expectation. [38, walDecodeFrame and walIndexRecover] [39]
Method: a private three-page database used 4096-byte pages, WAL mode, FULL synchronization and disabled automatic checkpointing. After a base checkpoint, two separate commits changed the BLOB and then the marker. The unchanged main file and two-frame WAL were frozen before closing the writer. Each detached input was read in a fresh directory without a copied SHM file, using a read-only connection. Native SQLite supplied the full values and integrity result; a separate parser checked the checksum chain.
Limits: one Ubuntu SQLite 3.45.1 build, small schema and page size. No power loss, writable recovery, concurrency, hardware fault or error-rate estimate was tested. Native results use little-endian checksum words; both word orders are covered only by the separate algebra tests. This is not a new vulnerability or a reproduction of the WAL-reset race below.
Recovery acceptance: a later marker and a structural success response do not certify every intended value. Record the expected database identity, transaction generation and application contents separately, then compare against an appropriate trusted reference. A checksum stored beside equally mutable data is not authentication. The related identity and lost-write analysis explains why the object and version also matter.
Offline reproduction bundle / Generated results (JSON) / Method and source notes. The bundle includes exact inputs, runtime IDs, controls and tests. Its replay reports the active engine separately from the captured engine. Run only on disposable storage; no live database is needed.
A successful backup can preserve the discrepancy
The same four inputs from each of two captures were read through the C API on SQLite 3.45.1 and pinned upstream 3.51.0. All 16 backups completed: backup_step=SQLITE_DONE, backup_finish=SQLITE_OK and zero remaining pages. A fresh process then read only each destination main file, without a copied WAL or SHM. Every copy still returned integrity_check=ok. [42]
| Source input | Copy completed | Expected BLOB | Expected marker 2 | Cold integrity check |
|---|---|---|---|---|
| Main file only | Yes | Does not match | Does not match | ok |
| Intact WAL | Yes | Matches | Matches | ok |
| Three-byte cancellation | Yes | Does not match | Matches | ok |
| One-byte rejection control | Yes | Does not match | Does not match | ok |
The checksum-neutral copy kept the changed BLOB and marker 2; the rejection control kept the older BLOB and marker 0. Only the intact input matched both external expectations. These references came from fixture construction, not from the database being checked. The documented Backup API copies the source state; it does not compare that state with an application's intended values. Also, backup_finish=SQLITE_OK alone does not establish that copying reached completion. [41]
Practical consequence: test copying fidelity and source correctness separately. Keep a trustworthy content reference bound to the intended object and version, and compare it after a cold restore. A later marker alone missed the changed payload here. This supports the distinction in our backup verification analysis; it is not a general safety certification.
Supplement scope: direct C calls, two engine builds on one little-endian host, the original three-page fixtures and no concurrent writer. The builds share SQLite's implementation lineage. No power interruption, hardware fault, random-error probability or independent-person replication is claimed. Successful copying is consistent with SQLite's contract.
Backup reproduction bundle and 16 exact images / Grouped backup results (JSON) / Method and native reproduction. The original WAL bundle above remains unchanged.
ATTACH does not make every multi-file commit crash-atomic
For qualifying rollback-mode transactions, a super-journal links the participating rollback journals. It contains their paths, not page images; deleting it is the group commit point. Subsequent cleanup of individual journals is not a second transaction commit. This mechanism coordinates attached files on one connection, not independent database servers. [12, section 5]
The documented cross-database guarantee requires a main database that is not :memory: and suitable rollback journaling. Super-journal creation requires at least two modified databases with synchronization enabled and journal modes other than OFF, MEMORY or WAL. Check each participating database; the phrase "not WAL" alone is insufficient. [13] [14, section 2.4]
With WAL, each database can recover atomically while a host crash during a multi-file COMMIT leaves some databases updated and others unchanged. The same cross-file limitation applies with an in-memory main database. A later checkpoint does not supply the missing group guarantee. [13] [7]
Atomic recovery is not durable acknowledgment
SQLite's synchronous=FULL adds a WAL synchronization at each commit. WAL with NORMAL can lose acknowledged transactions after an OS crash or power failure while preserving consistency. Raising the setting does not add cross-database WAL atomicity. [15] [13]
In rollback mode, FULL does not guarantee that the latest acknowledged transaction survives power loss on every filesystem. EXTRA adds directory synchronization after journal unlink in DELETE mode. Record the engine build, per-database journal mode, synchronization settings and storage contract separately; these documented distinctions are not results of a hardware power-loss test. They assume functioning VFS/filesystem locks and synchronization, with recovery files available at the expected paths. A setting alone cannot establish those conditions. [15] [16]
A real failure boundary: SQLite's WAL-reset race
SQLite documents a rare corruption race involving concurrent writes or checkpoints through multiple connections to one WAL-mode database. Version 3.51.3 fixes it; the documentation also lists backports 3.44.6 and 3.50.7. Check the actual embedded library build and its patch status, not merely whether WAL is enabled. This is a documented software defect, not a measured failure rate or evidence that WAL is generally unsafe. [7, section 11] [11]
The ARIES exception: checkpoint without a page flush
Mohan and colleagues' 1992 ARIES paper describes a fuzzy checkpoint that records transaction and dirty-page information without requiring dirty pages to be forced to storage. Therefore, "checkpoint" does not universally mean "flush every dirty page." [10, section 5.4]
ARIES redo can restore missing updates from uncommitted transactions before undo removes their effects. Its compensation records make rollback progress recoverable. This is a comparison with the original algorithm, not a claim that PostgreSQL or SQLite implements the same recovery protocol. [10, sections 3 and 6]
Page-oriented redo is not the same as logical undo
Physiological logging identifies the affected page and describes an operation within it. Logical redo may instead locate a record through a key lookup; physiological redo can address the page directly. It is not simply a full-page image, nor a label for every write-ahead log. Lomet and colleagues distinguish these representations from the tests that decide whether replay is needed. [32, sections 1.2 and 2.2]
Index recovery comes first when replay needs the index. Logical redo that locates records through a B-tree requires a usable placement index before transaction-level replay. In Deuteronomy, data-component recovery therefore runs first. Physiological redo can identify its target page without that tree traversal. This is an architectural dependency, not a claim that one representation is always faster. [32, sections 1.2 and 2.1]
In ARIES/IM Figure 1, a transaction inserts a key on P1; another transaction splits the page and moves that key to P2. Undo must find the key on P2. A compensation record describes the deletion on that actual page, so later redo can replay the compensation there. [33, Figure 1] ARIES/IM first checks the original page; tree traversal is a fallback when page-oriented undo cannot be performed, not a cost incurred by every undo. [33, section 3, p. 378] This is a source example, not an experiment performed by Hesela.
Recovery boundary: page identity, redo eligibility, rollback progress and durable ordering are separate obligations. [18, sections 3.2.1-3.2.2] The single-page illustration below does not test page splits or logical undo across pages, and its assumptions must not be extended to those cases.
What if recovery itself crashes?
Undo changes data too. ARIES records that work in a compensation log record (CLR), which can be redone but is not itself undone. Its UndoNxtLSN identifies where rollback continues, bypassing already compensated work. Logging that progress avoids recursively undoing an undo. [10, sections 3 and 5.2]
The two links in a CLR answer different questions: PrevLSN identifies the preceding record of that transaction; UndoNxtLSN identifies the next rollback record to process. During redo, a page LSN helps determine whether an update is already present. Original ARIES first repeats missing history, including loser-transaction updates and CLRs, then finishes undo. Its undo decision is not the same page-LSN test as redo. [10, sections 6.2-6.3]
A durable CLR does not imply its changed page reached storage. Replaying the CLR restores the compensation if needed; following its undo-next link preserves rollback progress. Conversely, if a CLR was only volatile and is lost, its compensation may have to be performed again. WAL forbids persisting that page change ahead of its recovery record. [18, sections 3.2.1-3.2.2]
Synthetic trace: replay compensation, then continue undo
Our dimensionless counter begins at 100. One uncommitted transaction adds 5 at LSN 10 and 7 at LSN 20. Undoing the second increment creates CLR 30 (subtract 7, next undo 10); undoing the first creates CLR 40 (subtract 5, next undo 0). These LSNs are illustrative ordered labels, not database byte offsets. The expected recovered counter is 100.
| Durable log through | Persisted page LSN / value | Value after redo | New CLRs | Value after undo |
|---|---|---|---|---|
| LSN 20 | 20 / 112 | 112 | 2 | 100 |
| LSN 30 | 20 / 112 | 105 | 1 | 100 |
| LSN 30 | 30 / 105 | 105 | 1 | 100 |
| LSN 40 | 20 / 112 | 100 | 0 | 100 |
In the second row, the page still contains 112 but CLR 30 survives. Redo subtracts 7; undo then processes only LSN 10. In the third row, that subtraction already reached the page and is not repeated by redo. Both recover to 100. A deliberately broken control ignores the undo-next link and undoes both original increments after replaying CLR 30: it returns 93, not 100.
The model enumerates all 12 combinations of zero, one or two surviving CLRs and a compatible persisted page prefix. Every correct case returns 100 with two CLRs in the completed log. This is a finite model check, not a measured failure rate or a reproduction of a database implementation.
Scope: one transaction and one page, an intact durable-log prefix, atomic persistence of the page together with its LSN, and a final uninterrupted recovery. There are no torn pages, concurrent writers, checkpoints, dirty-page analysis, nested top actions or physical I/O. Prepared transactions are out of scope. Do not treat this model as PostgreSQL or SQLite recovery code, or as proof that a production engine survives power loss.
All states and assumptions (JSON) / Executable model (JavaScript). In an ES module, import examples and call it to reproduce the states. The JSON records the model's SHA-256; tests also reject page states ahead of the log.
LSM companion: RocksDB WAL buffers, atomic flush and MANIFEST separates log synchronization from memtable flushing and cross-column-family recovery.
Recovery progress is not a recovery copy
Hesela's inference from these mechanisms: a checkpoint changes the existing database's recovery state; it does not create an independent copy that survives loss of that storage. PostgreSQL point-in-time recovery needs a physical base backup plus the required continuous WAL sequence. A logical pg_dump is not that physical base. [6]
For a recovery review, record the engine and version, acknowledgment mode, storage synchronization contract, page protection and retained recovery material separately. Test the supported recovery procedure on disposable resources. A healthy process restart alone does not establish behavior under power loss.
Related reading: failed fsync and durability and atomic rename and persistence ordering. Definitions: write-ahead log, database checkpoint, torn write and full-page write.
Primary sources and limits
Primary-source synthesis of PostgreSQL 18, MySQL 8.4, SQLite and ARIES, plus a reproducible five-case SQLite journal-lifecycle observation using synthetic data and abrupt writer-process exit. A separate deterministic single-page ARIES illustration enumerates 12 durable states and a deliberately incorrect undo control. The InnoDB comparison reviews documentation and tagged recovery code; the OSDI 2014 ALICE study supplies crash-testing context. Physiological redo and cross-page logical undo are distinguished using Lomet et al. (2011) and ARIES/IM (1992); this source review does not extend the single-page model. CPR coverage reviews SIGMOD 2019, the documented FasterKV API and pinned source; original deterministic examples compare four replay selections. A separate native SQLite 3.45.1 study supplies two captures of four constructed WAL inputs, including checksum-neutral changes and a one-byte rejection control; results and exact inputs are reproducible offline. A direct-C backup supplement reuses all four cases from both captures on SQLite 3.45.1 and 3.51.0, recording 16 completed copies and fresh main-file-only destination reads against independently specified payload and marker expectations. Applies to the described logging protocols, not every database or storage device. Recovery depends on correct synchronization, retained recovery data and engine-specific configuration. The process-exit observations retain OS caches and do not test power loss, WAL, attached-database commits or current library patch safety. The ARIES model performs no physical I/O and excludes concurrency, torn pages and full recovery analysis. No MySQL crash experiment or performance comparison was run. PostgreSQL page-image behavior is a documentation and REL_18_0 source review, not an engine benchmark. The CPR example accounts for independent operation identities; it is not an implementation of FASTER or a concurrency/recovery proof. The separate WAL checksum study uses synthetic detached fixtures and one native build; its correlated changes do not estimate random-fault frequency or establish a new vulnerability. Only little-endian checksum words were tested natively. The backup supplement tests two engine builds sharing SQLite's implementation lineage on one little-endian host, with no concurrent writer; copy completion is not a test of source correctness or a field failure rate. No power-loss test, performance result or tuning recommendation is claimed.
- PostgreSQL 18: Write-Ahead Logging
- PostgreSQL 18: Reliability
- PostgreSQL 18: WAL settings
- PostgreSQL 18: WAL Configuration
- PostgreSQL 18: Asynchronous Commit
- PostgreSQL 18: Continuous Archiving and Point-in-Time Recovery
- SQLite: Write-Ahead Logging (unversioned documentation)
- PostgreSQL 18: Backup Control Functions, Table 9.97 and notes
- PostgreSQL 18: WAL Internals
- C. Mohan, Don Haderle, Bruce Lindsay, Hamid Pirahesh and Peter Schwarz. ARIES: A Transaction Recovery Method Supporting Fine-Granularity Locking and Partial Rollbacks Using Write-Ahead Logging. ACM TODS 17(1), 94-162 (1992), sections 3, 5.4 and 6.
- SQLite 3.51.3 release notes: WAL-reset corruption fix (13 March 2026)
- SQLite: Atomic Commit, rollback recovery and multi-file commit
- SQLite: ATTACH DATABASE, cross-file transaction limits
- SQLite: Temporary Files, rollback journals and super-journals
- SQLite: PRAGMA synchronous, atomicity and durability by journal mode
- SQLite: File Locking and Concurrency, hot journals and recovery
- Jayashree Mohan, Ashlie Martinez, Soujanya Ponnapalli, Pandian Raju and Vijay Chidambaram. Finding Crash-Consistency Bugs with Bounded Black-Box Crash Testing. OSDI 2018, pp. 33-50, sections 4.4 and 5.1.
- C. Mohan. Repeating History Beyond ARIES. VLDB 1999, pp. 1-17, sections 3.2.1-3.2.2.
- PostgreSQL 18: Transactions, application-level atomicity
- D. J. DeWitt et al. Implementation Techniques for Main Memory Database Systems. UCB/ERL M84/5 (1984), section 5.2, pp. 16-18.
- PostgreSQL 18: Cumulative Statistics, pg_stat_io, pg_stat_wal and pg_stat_database
- MySQL 8.4: Doublewrite Buffer, page-copy recovery and batched writes
- MySQL 8.4: Redo Log, recovery records and checkpoint progress
- MySQL mysql-8.4.0: buf0dblwr.cc, reduced_recover and page recovery
- MySQL 8.4: InnoDB variables, innodb_checksum_algorithm and innodb_doublewrite
- MySQL 8.4: InnoDB Recovery, redo application and background transaction rollback
- Pillai et al. All File Systems Are Not Created Equal: On the Complexity of Crafting Crash-Consistent Applications. OSDI 2014, pp. 433-448.
- PostgreSQL REL_18_0: heapam_visibility.c, SetHintBits and visibility checks
- PostgreSQL REL_18_0: xloginsert.c, page holes and XLogCompressBackupBlock
- PostgreSQL 18: Data Checksums, inspecting cluster state
- PostgreSQL REL_18_0: pgstat_wal.c, shared WAL counters and snapshot retrieval
- David Lomet, Kostas Tzoumas and Michael Zwilling. Implementing Performance Competitive Logical Recovery. PVLDB 4(7), 430-439 (2011), sections 1.2, 2.1 and 2.2.
- Mohan and Levine. ARIES/IM: An Efficient and High Concurrency Index Management Method Using Write-Ahead Logging. SIGMOD 1992, Figure 1 and section 3, p. 378.
- Prasaad, Chandramouli and Kossmann. Concurrent Prefix Recovery: Performing CPR on a Database. SIGMOD 2019, sections 2, 4.3 and 7; DOI 10.1145/3299869.3300090.
- FasterKV Checkpointing and Recovery: session commit points and pending-operation exceptions; documentation dated 6 May 2021.
- FASTER ClientSession.cs, commit 332ea7da532a688acf648ee60c4f63a1caeaf1f7, WaitForCommitAsync lines 955-984.
- SQLite file format, sections 4.1-4.2: WAL frame coverage and checksum recurrence.
- SQLite 3.45.1 wal.c, pinned commit 189e44d: checksum computation, frame validation and recovery frontier.
- SQLite PRAGMA integrity_check: structural and selected constraint checks.
- Hesela: exact synthetic SQLite WAL inputs, native observations, controls and offline replay.
- SQLite C Backup API: step, finish and completed-copy contract.
- Hesela: direct-C two-build backup follow-through, exact images, source pins and native reproduction.
InnoDB references cover MySQL 8.4 and the mysql-8.4.0 source tag, reviewed 16 October 2026. PostgreSQL page-image, hint-bit and statistics sources were reviewed 17 October 2026, with implementation details pinned to REL_18_0. PostgreSQL references are pinned to version 18; group-commit sources were reviewed 15 October 2026. SQLite commit-scope sources were reviewed 14 October 2026; individual access dates are retained in the analysis metadata. ARIES rollback sources were reviewed 15 October 2026.