[ZODB-Dev] Use of fsync in FileStorage

Dieter Maurer dieter at handshake.de
Wed Jul 28 15:04:59 EDT 2004


Tim Peters wrote at 2004-7-27 18:57 -0400:
>[Dieter Maurer]
>> If "fsync" does what people think it should do, then a single "fsync" is
>> enough -- after the transaction has been written and before the "status"
>> byte is written.
> ...
>I'll guess the objection to that will be that *then* when the power
>goes out, it's possible to lose a perfectly good transaction, one that
>completed long before the power outage (for some unhelpfully OS- and
>load-dependent meaning of "long before"), and that the window of
>vulnerability for this is much longer.

Yes, that objection may be valid.

However, under Unix there is a daemon ("bdflush") that synchronizes
the in-buffer changes with the disk periodically.

>Toby's suggestion is to add an additional fsync as step 2.5.

In a former employees life, we used fflush in all places
where is seemed necessary (after writing the serial log,
after updating the main data file, after completing the
serial log). The result was: we got 10 to 15
transactions per second. Almost the entire time was spent in
"fflush". This was on Sparc/Solaris 2.6.


-- 
Dieter


More information about the ZODB-Dev mailing list