[Mailman-Developers] Problem with MM after power outage

Simone Piunno pioppo at ferrara.linux.it
Mon Aug 25 23:11:52 EDT 2003


On Monday 25 August 2003 10:15, Brad Knowles wrote:

> >>  ok, but how do you make sure the file is really on disk instead of,
> >  We close the file before we rename it.
> 	Do you fsync() the directory after the close and before the rename?

According to python documentation (os module), this should do:

  fsync(fd)
  Force write of file with filedescriptor fd to disk. On Unix, this calls the
  native fsync() function; on Windows, the MS _commit() function. 
  If you're starting with a Python file object f, first do f.flush(), and then
  do os.fsync(f.fileno()), to ensure that all internal buffers associated with
  f are written to disk. Availability: Unix, and Windows starting in 2.2.3. 

There's also:

  fdatasync(fd)
  Force write of file with filedescriptor fd to disk. Does not force update of
  metadata. Availability: Unix. 

I don't know the difference.

Because the python documentation says nothing about close() calling fsync() 
automatically, I assume it does not.

-- 
Adde parvum parvo magnus acervus erit -- Ovidio





More information about the Mailman-Developers mailing list