[Zope-CVS] CVS: Packages/PartitionedFileStorage - PartitionedFileStorage_2_6.patch:1.2 PartitionedFileStorage_HEAD.patch:1.2

Shane Hathaway shane@zope.com
Tue, 27 May 2003 14:19:29 -0400


Update of /cvs-repository/Packages/PartitionedFileStorage
In directory cvs.zope.org:/tmp/cvs-serv22335

Modified Files:
	PartitionedFileStorage_2_6.patch 
	PartitionedFileStorage_HEAD.patch 
Log Message:
Updated patches

=== Packages/PartitionedFileStorage/PartitionedFileStorage_2_6.patch 1.1 => 1.2 ===
--- Packages/PartitionedFileStorage/PartitionedFileStorage_2_6.patch:1.1	Thu May 15 15:45:04 2003
+++ Packages/PartitionedFileStorage/PartitionedFileStorage_2_6.patch	Tue May 27 14:19:28 2003
@@ -1,10 +1,10 @@
 Index: FileStorage.py
 ===================================================================
 RCS file: /cvs-repository/Zope/lib/python/ZODB/FileStorage.py,v
-retrieving revision 1.98.2.9
-diff -u -u -r1.98.2.9 FileStorage.py
---- FileStorage.py	13 May 2003 18:04:21 -0000	1.98.2.9
-+++ FileStorage.py	15 May 2003 19:40:39 -0000
+retrieving revision 1.98.2.10
+diff -u -u -r1.98.2.10 FileStorage.py
+--- FileStorage.py	20 May 2003 12:58:21 -0000	1.98.2.10
++++ FileStorage.py	27 May 2003 18:15:11 -0000
 @@ -196,6 +196,43 @@
  
  packed_version='FS21'
@@ -110,30 +110,30 @@
          try:
              opos = p.pack()
              if opos is None:
-@@ -1506,16 +1548,16 @@
-             oldpath = self._file_name + ".old"
-             self._file.close()
+@@ -1508,16 +1550,16 @@
              try:
--                if os.path.exists(oldpath):
--                    os.remove(oldpath)
--                os.rename(self._file_name, oldpath)
-+                if self.fops.exists(oldpath):
-+                    self.fops.remove(oldpath)
-+                self.fops.rename(self._file_name, oldpath)
-             except Exception, msg:
+                 self._file.close()
+                 try:
+-                    if os.path.exists(oldpath):
+-                        os.remove(oldpath)
+-                    os.rename(self._file_name, oldpath)
++                    if self.fops.exists(oldpath):
++                        self.fops.remove(oldpath)
++                    self.fops.rename(self._file_name, oldpath)
+                 except Exception, msg:
+-                    self._file = open(self._file_name, 'r+b')
++                    self._file = self.fops.open(self._file_name, 'r+b')
+                     raise
+ 
+                 # OK, we're beyond the point of no return
+-                os.rename(self._file_name + '.pack', self._file_name)
 -                self._file = open(self._file_name, 'r+b')
++                self.fops.rename(self._file_name + '.pack', self._file_name)
 +                self._file = self.fops.open(self._file_name, 'r+b')
-                 raise
- 
-             # OK, we're beyond the point of no return
--            os.rename(self._file_name + '.pack', self._file_name)
--            self._file = open(self._file_name, 'r+b')
-+            self.fops.rename(self._file_name + '.pack', self._file_name)
-+            self._file = self.fops.open(self._file_name, 'r+b')
-             self._initIndex(p.index, p.vindex, p.tindex, p.tvindex)
-             self._pos = opos
-             self._save_index()
-@@ -1688,8 +1730,10 @@
+                 self._initIndex(p.index, p.vindex, p.tindex, p.tvindex)
+                 self._pos = opos
+                 self._save_index()
+@@ -1691,8 +1733,10 @@
  
      return p, s
  
@@ -146,7 +146,7 @@
      index={}
      vindex={}
      tindex={}
-@@ -1939,7 +1983,9 @@
+@@ -1942,7 +1986,9 @@
      # seek to transaction header, where tid is first 8 bytes
      return file.read(8)
  
@@ -157,7 +157,7 @@
      seek=file.seek
      seek(0,2)
      file_size=file.tell()
-@@ -1947,11 +1993,11 @@
+@@ -1950,11 +1996,11 @@
          i=0
          while 1:
              oname='%s.tr%s' % (name, i)
@@ -171,7 +171,7 @@
                  seek(pos)
                  cp(file, o, file_size-pos)
                  o.close()
-@@ -1986,9 +2032,11 @@
+@@ -1989,9 +2035,11 @@
      _ltid = z64
      _file = None
  
@@ -188,11 +188,11 @@
 Index: fspack.py
 ===================================================================
 RCS file: /cvs-repository/Zope/lib/python/ZODB/fspack.py,v
-retrieving revision 1.5.4.1
-diff -u -u -r1.5.4.1 fspack.py
---- fspack.py	13 May 2003 18:04:21 -0000	1.5.4.1
-+++ fspack.py	15 May 2003 19:40:40 -0000
-@@ -606,9 +606,10 @@
+retrieving revision 1.5.4.2
+diff -u -u -r1.5.4.2 fspack.py
+--- fspack.py	20 May 2003 12:58:21 -0000	1.5.4.2
++++ fspack.py	27 May 2003 18:15:12 -0000
+@@ -623,9 +623,10 @@
  
  class FileStoragePacker(FileStorageFormatter):
  
@@ -205,7 +205,7 @@
          self._stop = stop
          self._packt = None
          self.locked = 0
-@@ -659,7 +660,7 @@
+@@ -676,7 +677,7 @@
  
          # Setup the destination file and copy the metadata.
          # XXX rename from _tfile to something clearer
@@ -214,12 +214,12 @@
          self._file.seek(0)
          self._tfile.write(self._file.read(self._metadata_size))
  
-@@ -671,7 +672,7 @@
+@@ -688,7 +689,7 @@
          if ipos == opos:
              # pack didn't free any data.  there's no point in continuing.
              self._tfile.close()
 -            os.remove(self._name + ".pack")
 +            self.fops.remove(self._name + ".pack")
              return None
-         if ipos < self.file_end:
-             self.copyRest(ipos)
+         self._commit_lock_acquire()
+         self.locked = 1


=== Packages/PartitionedFileStorage/PartitionedFileStorage_HEAD.patch 1.1 => 1.2 ===
--- Packages/PartitionedFileStorage/PartitionedFileStorage_HEAD.patch:1.1	Thu May 15 15:45:04 2003
+++ Packages/PartitionedFileStorage/PartitionedFileStorage_HEAD.patch	Tue May 27 14:19:28 2003
@@ -1,10 +1,10 @@
 Index: FileStorage.py
 ===================================================================
 RCS file: /cvs-repository/Zope/lib/python/ZODB/FileStorage.py,v
-retrieving revision 1.131
-diff -u -u -r1.131 FileStorage.py
---- FileStorage.py	1 May 2003 17:10:19 -0000	1.131
-+++ FileStorage.py	15 May 2003 19:36:48 -0000
+retrieving revision 1.133
+diff -u -u -r1.133 FileStorage.py
+--- FileStorage.py	22 May 2003 18:33:32 -0000	1.133
++++ FileStorage.py	27 May 2003 18:14:32 -0000
 @@ -202,6 +202,43 @@
  
  packed_version='FS21'
@@ -91,7 +91,7 @@
              self._file.write(packed_version)
  
          r = self._restore_index()
-@@ -1009,7 +1050,7 @@
+@@ -1017,7 +1058,7 @@
              file.write(self._tstatus)
              file.flush()
  
@@ -100,7 +100,7 @@
  
              self._pos = nextpos
              
-@@ -1454,7 +1495,8 @@
+@@ -1472,7 +1513,8 @@
          p = FileStoragePacker(self._file_name, stop,
                                self._lock_acquire, self._lock_release,
                                self._commit_lock_acquire,
@@ -110,30 +110,30 @@
          try:
              opos = p.pack()
              if opos is None:
-@@ -1462,16 +1504,16 @@
-             oldpath = self._file_name + ".old"
-             self._file.close()
+@@ -1482,16 +1524,16 @@
              try:
--                if os.path.exists(oldpath):
--                    os.remove(oldpath)
--                os.rename(self._file_name, oldpath)
-+                if self.fops.exists(oldpath):
-+                    self.fops.remove(oldpath)
-+                self.fops.rename(self._file_name, oldpath)
-             except Exception, msg:
+                 self._file.close()
+                 try:
+-                    if os.path.exists(oldpath):
+-                        os.remove(oldpath)
+-                    os.rename(self._file_name, oldpath)
++                    if self.fops.exists(oldpath):
++                        self.fops.remove(oldpath)
++                    self.fops.rename(self._file_name, oldpath)
+                 except Exception, msg:
+-                    self._file = open(self._file_name, 'r+b')
++                    self._file = self.fops.open(self._file_name, 'r+b')
+                     raise
+ 
+                 # OK, we're beyond the point of no return
+-                os.rename(self._file_name + '.pack', self._file_name)
 -                self._file = open(self._file_name, 'r+b')
++                self.fops.rename(self._file_name + '.pack', self._file_name)
 +                self._file = self.fops.open(self._file_name, 'r+b')
-                 raise
- 
-             # OK, we're beyond the point of no return
--            os.rename(self._file_name + '.pack', self._file_name)
--            self._file = open(self._file_name, 'r+b')
-+            self.fops.rename(self._file_name + '.pack', self._file_name)
-+            self._file = self.fops.open(self._file_name, 'r+b')
-             self._initIndex(p.index, p.vindex, p.tindex, p.tvindex)
-             self._pos = opos
-             self._save_index()
-@@ -1649,8 +1691,10 @@
+                 self._initIndex(p.index, p.vindex, p.tindex, p.tvindex)
+                 self._pos = opos
+                 self._save_index()
+@@ -1672,8 +1714,10 @@
  
      return p, s
  
@@ -146,7 +146,7 @@
      index={}
      vindex={}
      tindex={}
-@@ -1898,7 +1942,9 @@
+@@ -1921,7 +1965,9 @@
      # seek to transaction header, where tid is first 8 bytes
      return file.read(8)
  
@@ -157,7 +157,7 @@
      seek=file.seek
      seek(0,2)
      file_size=file.tell()
-@@ -1906,11 +1952,11 @@
+@@ -1929,11 +1975,11 @@
          i=0
          while 1:
              oname='%s.tr%s' % (name, i)
@@ -171,7 +171,7 @@
                  seek(pos)
                  cp(file, o, file_size-pos)
                  o.close()
-@@ -1945,9 +1991,11 @@
+@@ -1968,9 +2014,11 @@
      _ltid = z64
      _file = None
  
@@ -188,11 +188,11 @@
 Index: fspack.py
 ===================================================================
 RCS file: /cvs-repository/Zope/lib/python/ZODB/fspack.py,v
-retrieving revision 1.5
-diff -u -u -r1.5 fspack.py
---- fspack.py	13 May 2003 16:29:21 -0000	1.5
-+++ fspack.py	15 May 2003 19:36:49 -0000
-@@ -605,9 +605,10 @@
+retrieving revision 1.8
+diff -u -u -r1.8 fspack.py
+--- fspack.py	22 May 2003 18:15:55 -0000	1.8
++++ fspack.py	27 May 2003 18:14:32 -0000
+@@ -622,9 +622,10 @@
  
  class FileStoragePacker(FileStorageFormatter):
  
@@ -205,7 +205,7 @@
          self._stop = stop
          self._packt = None
          self.locked = 0
-@@ -658,7 +659,7 @@
+@@ -675,7 +676,7 @@
  
          # Setup the destination file and copy the metadata.
          # XXX rename from _tfile to something clearer
@@ -214,12 +214,12 @@
          self._file.seek(0)
          self._tfile.write(self._file.read(self._metadata_size))
  
-@@ -670,7 +671,7 @@
+@@ -687,7 +688,7 @@
          if ipos == opos:
              # pack didn't free any data.  there's no point in continuing.
              self._tfile.close()
 -            os.remove(self._name + ".pack")
 +            self.fops.remove(self._name + ".pack")
              return None
-         if ipos < self.file_end:
-             self.copyRest(ipos)
+         self._commit_lock_acquire()
+         self.locked = 1