On Thu, Oct 11, 2012 at 11:59 AM, Simon Slavin <slav...@bigfraud.org> wrote: > On 11 Oct 2012, at 5:38pm, Nico Williams <n...@cryptonector.com> wrote: >> There is something you can do: use a combination of COW on-disk >> formats in such a way that it's possible to detect partially-committed >> transactions and rollback to the last good known root > > This is actually the problem, not the solution. Traditional disk drivers for > spinning disks change the order in which they write things to disk. They > will buffer several write commands up and notice that on the way to moving > the write head to do write #1 the write head will pass over the correct spot > to do write #4, so they will do write #4 first. Many disks will do this even > with the disk jumpers set to enforce in-order writing: they lie.
You missed something: because fsync()s are done (in the background, you are guaranteed that transactions do eventually make it (in order, up to the point of the fsync()) onto disk. And this can be marked -- that is, each transaction's root block can name the last transaction that should be fully on-disk at that point. Then when you open the DB you validate all transactions from the latest to the last one known to have reached disk in toto. Nico -- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users