Up: Transactions   [Contents][Index]


1.6.1 More Resilient Transactions

nonblonde writes its data store first and then the page map. The two are each its own file. nonblonde requires that if the page map changes are visible, the data store changes are visible too. Put it differently, in order for the database to be in an intended state, nonblonde asks that writes appear on file in the order in which they were issued, at least with respect to the order between the group of writes to the data store and the single write to the page map issued during one transaction.

See Disk Storage.

Under ordinary circumstances, there should be no problem with the writes ordering. However, power loses and OS crashes or disordered shut downs may see the page map writen while the data store not written, no matter that the writes for the latter were issued first.

Doing a disk sync after both the two files had been written may be insufficient, as if the power is lost during syncing the writes order may still be not observed on disk.

A more resilient disk syncing would entail completing transactions in four steps: writing the data store, syncing disk so that the writes go to disk, writing the page map and finally, syncing disk once more. Database operation methods allowing this resilient transaction mode are available.

This staged transaction closing would be of course very slow. Though probably not lot slower then the two steps synced one (writing the database files and then syncing disk), at it involves no extra writing at any level.