[Python-Dev] Python-Dev] wait time [was: Ext4 data loss

R. David Murray rdmurray at bitdance.com
Fri Mar 13 13:17:02 CET 2009

On Fri, 13 Mar 2009 at 14:27, Steven D'Aprano wrote:
> On Fri, 13 Mar 2009 01:02:26 pm R. David Murray wrote:
>> On Fri, 13 Mar 2009 at 00:35, Antoine Pitrou wrote:
>>> R. David Murray <rdmurray <at> bitdance.com> writes:
>>>> Seriously, though, the point is that IMO an application should not
>>>> be calling fsync unless it provides a way for that behavior to be
>>>> controlled by the user.
>>> But whether an application does it or not is none of Python's
>>> business, is it? What is the disagreement exactly?
>> I'd like to see whatever feature gets added support the application
>> writer in making this user controllable, or at the very least
>> document that this to do so is best practice if you use the sync
>> feature.
> It's not best practice. It may be best practice for a certain class of
> users and applications, e.g. those who value the ability to control
> low-level behaviour of the app, but it is poor practice for other
> classes of users and applications. Do you really think that having
> Minefield make the file syncing behaviour of the high scores file
> user-configurable is best practice? People care about their high
> scores, but they don't care that much.

Why would Minefield bother to use sync/fsync?  You will note that what
I suggested was that applications that _use the sync feature_ make
it user controllable.  And yes, it is Best Practice, because we have
glaring counterexamples (sqlite3, the one mentioned by another poster)
that require people to jump through hoops to compensate for the fact
that it isn't user controllable.

I thought that a significant majority of applications wouldn't have
to care.

If most applications do really have to care (ie: there's no way for them
to recover gracefully from a crash that trashes the new data they were
trying to save unless they call fsync), then my argument is a lot weaker.
And from the post that talked about the problems with rename, I gather
I was misunderstanding the extent of the problem.

Perhaps I can restrict my request: that it be noted that if you use fsync
_aggressively_ (ie: not just on a final save that happens infrequently)
that you make it user controllable in some fashion.  Note that that
user control could be as simple as being able to set the autosave
interval on an autosaving editor if the autosave needs to do an fsync
for safety.

Thinking about it further, I think what I'm really looking for is a
warning to applications developers that using fsync can have significant
performance penalties (and therefore if they use it a lot they should
make it configurable), and can make laptop users hate you if it gets
used any time other than at a user requested save point :)

R. David Murray           http://www.bitdance.com

More information about the Python-Dev mailing list