[Zope3-checkins] CVS: Zope3/src/zodb/storage/file - pack.py:1.8

Tim Peters tim.one@comcast.net
Tue, 24 Jun 2003 15:29:44 -0400


Update of /cvs-repository/Zope3/src/zodb/storage/file
In directory cvs.zope.org:/tmp/cvs-serv28135/src/zodb/storage/file

Modified Files:
	pack.py 
Log Message:
FileStoragePacker.__init__():  Grab the commit lock while finding the
file size, so we don't mistake a transitional file state for the truth.
This appears to repair intermittent failures in testPackWhileWriting
running against a FileStorage.


=== Zope3/src/zodb/storage/file/pack.py 1.7 => 1.8 ===
--- Zope3/src/zodb/storage/file/pack.py:1.7	Fri May 16 15:44:42 2003
+++ Zope3/src/zodb/storage/file/pack.py	Tue Jun 24 15:29:44 2003
@@ -241,9 +241,14 @@
         self._file = open(path, "rb")
         self._stop = stop
         self._packt = None
-        self.locked = False
+        # Get current file size.  Grab the commit lock around this, so that
+        # we don't see the file in a transitional state.
+        cla()
+        self.locked = True
         self._file.seek(0, 2)
         self.file_end = self._file.tell()
+        clr()
+        self.locked = False
         self._file.seek(0)
         
         self.gc = GC(self._file, self.file_end, self._stop)