Commit 88e002fa authored by Tres Seaver's avatar Tres Seaver

repozo: Remove '.index' + files corresponding to backups being removed.

parent ecb2ad27
......@@ -8,6 +8,9 @@
Bugs fixed
----------
- Updated the 'repozo --kill-old-on-full' option to remove any '.index'
files corresponding to backups being removed.
- When objects were added in savepoints and either the savepoint was
rolled back (https://bugs.launchpad.net/zodb/+bug/143560) or the
transaction was aborted
......@@ -204,7 +207,7 @@ New Features
iterator implementations should just raise StopIteration, which
means they can now be implemented as generators.
- The file-storage backup script, repoze, will now create a backup
- The file-storage backup script, repozo, will now create a backup
index file if an output file name is given via the --output/-o
option.
......@@ -225,9 +228,10 @@ Bugs Fixed
New Features
------------
- Added a '--kill-old-on-full' argument to the backup options: if passed,
remove any older full or incremental backup files from the repository after
doing a full backup. (https://bugs.launchpad.net/zope2/+bug/143158)
- Added a '--kill-old-on-full' argument to the repozo backup options:
if passed, remove any older full or incremental backup files from the
repository after doing a full backup.
(https://bugs.launchpad.net/zope2/+bug/143158)
- When transactions are aborted, new object ids allocated during the
transaction are saved and used in subsequent transactions. This can
......
......@@ -410,14 +410,21 @@ def delete_old_backups(options):
dat = root + '.dat'
if dat in deletable:
deletable.remove(dat)
index = root + '.index'
if index in deletable:
deletable.remove(index)
for fname in deletable:
log('removing old backup file %s (and .dat)', fname)
log('removing old backup file %s (and .dat / .index)', fname)
root, ext = os.path.splitext(fname)
try:
os.unlink(os.path.join(options.repository, root + '.dat'))
except OSError:
pass
try:
os.unlink(os.path.join(options.repository, root + '.index'))
except OSError:
pass
os.unlink(os.path.join(options.repository, fname))
def do_full_backup(options):
......
......@@ -457,7 +457,10 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self.failUnless(os.path.isfile(fqn))
def test_doesnt_remove_current_repozo_files(self):
FILENAMES = ['2009-12-20-10-08-03.fs', '2009-12-20-10-08-03.dat']
FILENAMES = ['2009-12-20-10-08-03.fs',
'2009-12-20-10-08-03.dat',
'2009-12-20-10-08-03.index',
]
self._callFUT(filenames=FILENAMES)
remaining = os.listdir(self._repository_directory)
self.assertEqual(len(remaining), len(FILENAMES))
......@@ -466,9 +469,19 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self.failUnless(os.path.isfile(fqn))
def test_removes_older_repozo_files(self):
OLDER_FULL = ['2009-12-20-00-01-03.fs', '2009-12-20-00-01-03.dat']
DELTAS = ['2009-12-21-00-00-01.deltafs', '2009-12-22-00-00-01.deltafs']
CURRENT_FULL = ['2009-12-23-00-00-01.fs', '2009-12-23-00-00-01.dat']
OLDER_FULL = ['2009-12-20-00-01-03.fs',
'2009-12-20-00-01-03.dat',
'2009-12-20-00-01-03.index',
]
DELTAS = ['2009-12-21-00-00-01.deltafs',
'2009-12-21-00-00-01.index',
'2009-12-22-00-00-01.deltafs',
'2009-12-22-00-00-01.index',
]
CURRENT_FULL = ['2009-12-23-00-00-01.fs',
'2009-12-23-00-00-01.dat',
'2009-12-23-00-00-01.index',
]
FILENAMES = OLDER_FULL + DELTAS + CURRENT_FULL
self._callFUT(filenames=FILENAMES)
remaining = os.listdir(self._repository_directory)
......@@ -484,10 +497,19 @@ class Test_delete_old_backups(OptionsTestBase, unittest.TestCase):
self.failUnless(os.path.isfile(fqn))
def test_removes_older_repozo_files_zipped(self):
OLDER_FULL = ['2009-12-20-00-01-03.fsz', '2009-12-20-00-01-03.dat']
OLDER_FULL = ['2009-12-20-00-01-03.fsz',
'2009-12-20-00-01-03.dat',
'2009-12-20-00-01-03.index',
]
DELTAS = ['2009-12-21-00-00-01.deltafsz',
'2009-12-22-00-00-01.deltafsz']
CURRENT_FULL = ['2009-12-23-00-00-01.fsz', '2009-12-23-00-00-01.dat']
'2009-12-21-00-00-01.index',
'2009-12-22-00-00-01.deltafsz',
'2009-12-22-00-00-01.index',
]
CURRENT_FULL = ['2009-12-23-00-00-01.fsz',
'2009-12-23-00-00-01.dat',
'2009-12-23-00-00-01.index',
]
FILENAMES = OLDER_FULL + DELTAS + CURRENT_FULL
self._callFUT(filenames=FILENAMES)
remaining = os.listdir(self._repository_directory)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment