
On Wed, Mar 22, 2017 at 5:13 AM, Gavin Lambert via Boost
On 22/03/2017 16:08, Vinnie Falco via Boost wrote:
I think this can be unit tested, and I believe that NuDB's unit test covers the case of power loss. I think we can agree that power loss on a read is uninteresting (since it can't corrupt data). The unit test models a power loss as a fatal error during a write. The test exercises all possible fatal errors using an incremental approach (I alluded to this in my previous message).
A power loss is more like a fatal error that fails to execute any subsequent clean-up code, so it might not be quite the same.
Recovery obviously runs on the next power on. ;)
There are also more pathological cases such as where a write has been partially successful and done some subset of increasing the file size, zeroing the extra file space, and writing some subset of the intended data. So it's not necessarily that data is missing; there might be invalid data in its place.
Do modern FS still allow that to happen? I guess some do.. Don't (log) records contain a checksum to guard against this? -- Olaf