[Zodb-checkins] CVS: ZODB3/Tools - repozo.py:1.1.2.12

Tim Peters tim.one at comcast.net
Sun Aug 17 01:25:44 EDT 2003


Update of /cvs-repository/ZODB3/Tools
In directory cvs.zope.org:/tmp/cvs-serv25132/Tools

Modified Files:
      Tag: ZODB3-3_1-branch
	repozo.py 
Log Message:
do_incremental_backup():  This told copyfile() to copy more bytes than
it actually wanted to copy.  If the Data.fs file grew another transaction
since the time do_incremental_backup() first figured out where to finish
copying, then, more data got written to the incremental file than the
.dat file recorded.  This caused the next attempt to do an incremental
backup to believe the checksums were out of whack, triggering a needless
full backup.

copyfile():  Assert that the number of bytes processed by dofile() is
equal to the number of bytes copyfile() was told to process.  This assert
would have caught the bug above.


=== ZODB3/Tools/repozo.py 1.1.2.11 => 1.1.2.12 ===
--- ZODB3/Tools/repozo.py:1.1.2.11	Sat Aug 16 23:57:46 2003
+++ ZODB3/Tools/repozo.py	Sun Aug 17 00:25:36 2003
@@ -232,9 +232,10 @@
     def func(data):
         sum.update(data)
         ofp.write(data)
-    dofile(func, ifp, n)
+    ndone = dofile(func, ifp, n)
     ofp.close()
     ifp.close()
+    assert ndone == n
     return sum.hexdigest()
 
 
@@ -377,7 +378,7 @@
         print >> sys.stderr, 'Cannot overwrite existing file:', dest
         sys.exit(2)
     log('writing incremental: %s bytes to %s',  pos-reposz, dest)
-    sum = copyfile(options, dest, reposz, pos)
+    sum = copyfile(options, dest, reposz, pos - reposz)
     # The first file in repofiles points to the last full backup.  Use this to
     # get the .dat file and append the information for this incrementatl to
     # that file.




More information about the Zodb-checkins mailing list