Skip to content
Commit 2d758ba4 authored by Jeff Brown's avatar Jeff Brown
Browse files

Enable the powersafe overwrite assumption.

This change improves performance on certain kinds of transactions
such as UPDATEs by allowing SQLite to make stronger assumptions
about data integrity on the disk.

The powersafe overwrite assumption demands that when a byte is
written to a file and a power event occurs then the only bytes
that may have been modified are the ones that were being written.

In absense of the powersafe overwrite assumption, SQLite assumes
that a write of any range of bytes within a disk sector may
potentially cause the rest of the sector to be corrupted.  SQLite
needs to do extra work to compensate for this problem, which adds
overhead to certain transactions.

On flash devices, writing a byte causes the sector to be rewritten
somewhere else on the device.  Eventually the old sector may be
erased and reused.  The powersafe overwrite assumption therefore
holds as long as the flash device never leaves behind (observable)
half-written sectors in case of a power event.  This is a fairly
safe assumption to make.  Some flash devices apparently include
measures to ensure that the last write fully completes when
power is interrupted.  In any case, the window of opportunity
for corruption to occur is very small.

Bug: 6484633
Change-Id: I0b0ef664b3a2a0e85c6099f0130d0affc5562be5
parent c82acac4
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment