[issue8604] Adding an atomic FS write API

Antoine Pitrou report at bugs.python.org
Fri Dec 23 15:40:42 CET 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> There's no point in calling fsync() after each write, since data is
> written to a temporary file which won't be visible before rename():
> even if you call fsync() after each write, if the file is not properly
> closed, it won't be committed (i.e.renamed).

Ah, it's a temporary file indeed.
But does that mean you can't inspect your logs in real time? All log
files I have ever seen are available under their final name while they
are still being written to.

> In the meantime, you could do whatever you want with the stream (the
> hypothetical AtomicFile): seek(), read(), etc.

I see. Yes, then an AtomicFile class makes sense (not for logging
though, IMHO :-)).

And I understand your point about it being available in io or some io
submodule (not a 3-level deep one though :-)). Perhaps you want to ask
on python-dev?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8604>
_______________________________________


More information about the Python-bugs-list mailing list