repozo generates different dates for filenames
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ZODB |
Fix Committed
|
Undecided
|
Tres Seaver |
Bug Description
Sometimes repozo generates different dates in filenames for Data.fs and .index. For example:
2012-05-
2012-05-
When doing a restore the index-File is not recognized and not restored.
A possible solution would be to generate the date-part of the filename just once on full backup or incremental backup to ensure that the second did not change.
Possible Patch:
Index: repozo.py
=======
--- repozo.py (revision 3017)
+++ repozo.py (revision 3018)
@@ -305,7 +305,10 @@
return bytesread, sum.hexdigest()
-def gen_filename(
+def gen_filedate(
+ return getattr(options, 'test_now', time.gmtime()[:6])
+
+def gen_filename(
if ext is None:
if options.full:
ext = '.fs'
@@ -314,7 +317,8 @@
if options.gzip:
ext += 'z'
# Hook for testing
- now = getattr(options, 'test_now', time.gmtime()[:6])
+ if now == None:
+ now = gen_filedate(
t = now + (ext,)
return '%04d-%
@@ -330,7 +334,7 @@
def find_files(
when = options.date
if not when:
- when = gen_filename(
+ when = gen_filename(
log('looking for files between last full backup and %s...', when)
all = filter(
all.sort()
@@ -429,7 +433,8 @@
def do_full_
options.full = True
- dest = os.path.
+ tnow = gen_filedate(
+ dest = os.path.
if os.path.
raise WouldOverwriteF
# Find the file position of the last completed transaction.
@@ -442,7 +447,7 @@
pos = fs.getSize()
# Save the storage index into the repository
index_file = os.path.
- gen_filename(
+ gen_filename(
log('writing index')
fs.
fs.close()
@@ -461,7 +466,8 @@
def do_incremental_
options.full = False
- dest = os.path.
+ tnow = gen_filedate(
+ dest = os.path.
if os.path.
raise WouldOverwriteF
# Find the file position of the last completed transaction.
@@ -474,7 +480,7 @@
pos = fs.getSize()
log('writing index')
index_file = os.path.
- gen_filename(
+ gen_filename(
fs.
fs.close()
log('writing incremental: %s bytes to %s', pos-reposz, dest)
Changed in zodb: | |
assignee: | nobody → Tres Seaver (tseaver) |
status: | New → Confirmed |
Thanks for the patch! Committed on the 3.10 branch and the trunk.