The attached patch seems to do what I want, and makes my incremental backup at least twice as fast. However, I haven't been able to test it in all scenarios, so I'd appreciate feedback. In particular, there are probably some error conditions I should catch, or other situations in which a rename won't work. It could also be done with hardlinks to avoid the change in backup.py, but that would only work for regular files.
(Patch applies to both CVS and 1.2.8.)
Index: rdiff_backup/backup.py =================================================================== RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/backup.py,v retrieving revision 1.50 diff -u -r1.50 backup.py --- rdiff_backup/backup.py 8 Mar 2009 17:08:14 -0000 1.50 +++ rdiff_backup/backup.py 29 Sep 2011 00:18:09 -0000 @@ -709,6 +709,8 @@ elif mirror_rp.lstat(): mirror_rp.delete() self.CCPP.flag_deleted(index) + elif inc.renamed: + self.CCPP.flag_deleted(index) return # normal return, otherwise error occurred tf.setdata() if tf.lstat(): tf.delete() Index: rdiff_backup/increment.py =================================================================== RCS file: /sources/rdiff-backup/rdiff-backup/rdiff_backup/increment.py,v retrieving revision 1.36 diff -u -r1.36 increment.py --- rdiff_backup/increment.py 14 Jun 2008 16:35:25 -0000 1.36 +++ rdiff_backup/increment.py 29 Sep 2011 00:18:09 -0000 @@ -41,7 +41,7 @@ elif mirror.isdir(): incrp = makedir(mirror, incpref) elif new.isreg() and mirror.isreg(): incrp = makediff(new, mirror, incpref) - else: incrp = makesnapshot(mirror, incpref) + else: incrp = makesnapshot(mirror, incpref, not new.lstat()) statistics.process_increment(incrp) return incrp @@ -56,14 +56,18 @@ return (Globals.compression and not Globals.no_compression_regexp.match(mirror.path)) -def makesnapshot(mirror, incpref): +def makesnapshot(mirror, incpref, renameok): """Copy mirror to incfile, since new is quite different""" compress = iscompressed(mirror) if compress and mirror.isreg(): + renameok = False; snapshotrp = get_inc(incpref, "snapshot.gz") else: snapshotrp = get_inc(incpref, "snapshot") - if mirror.isspecial(): # check for errors when creating special increments + if renameok: + rpath.rename(mirror, snapshotrp) + snapshotrp.renamed = True; + elif mirror.isspecial(): # check for errors when creating special increments eh = robust.get_error_handler("SpecialFileError") if robust.check_common_error(eh, rpath.copy_with_attribs, (mirror, snapshotrp, compress)) == 0:
_______________________________________________ rdiff-backup-users mailing list at rdiff-backup-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/rdiff-backup-users Wiki URL: http://rdiff-backup.solutionsfirst.com.au/index.php/RdiffBackupWiki