[ZODB-Dev] ZEO client cache tempfile oddness

Paul Winkler pw_lists at slinkp.com
Thu Apr 5 15:49:28 EDT 2007


Can somebody explain to me the intent of this dance?
(from ZEO/cache.py):


            # Make sure the OS really saves enough bytes for the file.
            self.f.seek(self.maxsize - 1)
            self.f.write('x')
            self.f.truncate()

The comment seems self-explanatory, except that I'm not sure what
"saves" means. Does the behavior vary on different filesystems?  On
ext3 at least, a colleague just confirmed that this call "succeeds"
with self.maxsize ten times larger than the size of the filesystem.
It doesn't actually use many blocks though:

$ stat foo.txt
  File: `foo.txt'
  Size: 1000000000002   Blocks: 88         IO Block: 4096   regular file


Does this make future calls to self.f.write() faster somehow?

--

Paul Winkler
http://www.slinkp.com


More information about the ZODB-Dev mailing list