[Mailman-Developers] Problem with MM after power outage

Simone Piunno pioppo at ferrara.linux.it
Mon Aug 25 23:21:42 EDT 2003


On Monday 25 August 2003 22:11, Simone Piunno wrote:

> > 	Do you fsync() the directory after the close and before the rename?

Ah, I've found what you were meaning...
this is from PosixFilesystem.py (ZODB implementation):

import os
from posix import fsync
....
    def sync_directory(self,dir):
        if self.use_sync:
            p = os.path.join(self.dirname,dir)
            # Use os.open here because, mysteriously, it performs better
            # than fopen on linux 2.4.18, reiserfs, glibc 2.2.4
            f = os.open(p,os.O_RDONLY)
            # Should we worry about EINTR ?
            try:
                fsync(f)
            finally:
                os.close(f)

    def write_file(self,filename,content):
        fullname = os.path.join(self.dirname,filename)
        f = os.open(fullname,os.O_CREAT|os.O_RDWR|os.O_TRUNC,0640)
        # Should we worry about EINTR ?
        try:
            os.write(f,content)
            if self.use_sync:
                fsync(f)
        finally:
            os.close(f)
-- 
Adde parvum parvo magnus acervus erit -- Ovidio





More information about the Mailman-Developers mailing list