torn-write · shipping · also partial page write

Torn write

A torn write is an interrupted write that persists only part of its intended update, potentially leaving a database page with mixed old and new contents.

Related Observatory article: Read on hesela.com

A database page may span several storage write units, so a page write cannot automatically be treated as atomic. PostgreSQL documents full-page images as protection for recovery from this failure. Transaction atomicity and page-write atomicity describe different boundaries.

Torn-write protection permits the complete old value instead of a mixture; it does not by itself make the replacement durable. Linux RWF_ATOMIC requests this protection for one supported direct-I/O range.

In FAST 2013, shorn writes described partial updates below the expected atomic unit; the tested SSDs included mixed old/new 4 KiB records. This historical observation does not estimate current-device risk. Powersafe overwrite is independent: it concerns unchanged bytes outside the requested range, so it can coexist with a torn target range. [8]

Constant padding can hide an interrupted update outside the identifying header. Repeated self-describing headers help identify surviving fragments when a complete header remains. Interpreting mixed bytes as an atomicity failure requires comparison with the promised atomic unit and completion semantics; a clean endpoint does not prove an uninterrupted write. [6] Coverage of sector-aligned cuts does not establish coverage of every byte cut. [9]

Relations

related
Full-page write, Write-ahead log, Crash consistency, Power loss protection, RWF_ATOMIC, STATX_WRITE_ATOMIC, RAID write hole, Lost write, Physical sector, Powersafe overwrite, Doublewrite buffer, NVMe Atomic Write Unit Power Fail, Transactional Flash (TxFlash)

Limitations

  • A transaction log containing only change records may not reconstruct a partially written page. [2]

Citations

  1. PostgreSQL 18: WAL settings (accessed 2026-10-11)
  2. Zheng et al.: Understanding the Robustness of SSDs under Power Fault, FAST 2013, sections 3.1-3.1.1, 4.2 and 5.3. (accessed 2026-11-06)
  3. SQLite: Powersafe Overwrite, scope, assumptions and torn pages. (accessed 2026-10-14)
  4. Hesela: SSD power-loss protection, evidence and qualification boundaries (accessed 2026-11-06)

Further reading

  1. PostgreSQL 18: Reliability (accessed 2026-10-11)
  2. WAL, checkpoints and torn pages: three different recovery guarantees (accessed 2026-10-11)
  3. Linux man-pages 6.19, readv(2): RWF_ATOMIC (accessed 2026-10-12)
  4. Linux atomic writes: untorn does not mean durable (accessed 2026-10-12)
  5. 512e, 4Kn and alignment: geometry is not durability (accessed 2026-10-12)

JSON: /data/terms/torn-write.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Torn write. Hesela. 2026-11-13. https://hesela.dev/terms/torn-write/