From 7f11187b75621b02d614aa5bb3d1ec373eab4dd7 Mon Sep 17 00:00:00 2001 From: bescoto Date: Sat, 1 Nov 2003 17:48:53 +0000 Subject: Delete mirror_metadata and similar first to save disk space git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/branches/r0-12@482 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/CHANGELOG | 8 ++++++-- rdiff-backup/rdiff_backup/regress.py | 22 +++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/rdiff-backup/CHANGELOG b/rdiff-backup/CHANGELOG index 6889ca2..2900fd9 100644 --- a/rdiff-backup/CHANGELOG +++ b/rdiff-backup/CHANGELOG @@ -8,8 +8,12 @@ Added --list-increment-sizes option from the development branch. Previously this option was in the man page but was omitted in the code (thanks to Michael Schwendt for report). -Restoring/regressing should now take less memory, especially on large -directories. CPU usage may slightly increase, however. +Regressing and restoring should now take less memory when processing +large directories (noticed by Luke Mewburn and others). + +When regressing, remove mirror_metadata and similar increments first. +This will hopefully help regressing a backup that failed because disk +was full (reported by Erik Forsberg). New in v0.12.5 (2003/09/27) diff --git a/rdiff-backup/rdiff_backup/regress.py b/rdiff-backup/rdiff_backup/regress.py index bcd1cd0..ddab217 100644 --- a/rdiff-backup/rdiff_backup/regress.py +++ b/rdiff-backup/rdiff_backup/regress.py @@ -65,10 +65,13 @@ def Regress(mirror_rp): assert mirror_rp.conn is inc_rpath.conn is Globals.local_connection set_regress_time() set_restore_times() + former_current_mirror_rp = remove_rbdir_increments() ITR = rorpiter.IterTreeReducer(RegressITRB, []) for rf in iterate_meta_rfs(mirror_rp, inc_rpath): ITR(rf.index, rf) ITR.Finish() - remove_rbdir_increments() + if former_current_mirror_rp: + C.sync() # Sync first, since we are marking dest dir as good now + former_current_mirror_rp.delete() def set_regress_time(): """Set global regress_time to previous sucessful backup @@ -98,18 +101,23 @@ def set_restore_times(): restore._rest_time = regress_time def remove_rbdir_increments(): - """Delete the increments in the rdiff-backup-data directory""" - old_current_mirror = None + """Delete the increments in the rdiff-backup-data directory + + Returns the former current mirror rp so we can delete it later. + All of the other rp's should be deleted before the actual regress, + to clear up disk space the rest of the procedure may need. + + """ + former_current_mirror = None for filename in Globals.rbdir.listdir(): rp = Globals.rbdir.append(filename) if rp.isincfile() and rp.getinctime() == unsuccessful_backup_time: - if rp.getincbase_str() == "current_mirror": old_current_mirror = rp + if rp.getincbase_str() == "current_mirror": + former_current_mirror = rp else: log.Log("Removing rdiff-backup-data increment " + rp.path, 5) rp.delete() - if old_current_mirror: - C.sync() # Sync first, since we are marking dest dir as good now - old_current_mirror.delete() + return former_current_mirror def iterate_raw_rfs(mirror_rp, inc_rp): """Iterate all RegressFile objects in mirror/inc directory -- cgit v1.2.1