summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-07-11 19:05:47 +1200
committerLars Wirzenius <liw@liw.fi>2010-07-11 19:05:47 +1200
commitc4a7f17faa512e580124506071c9be46b3962c84 (patch)
tree269683b2e2c4830021e0f32a7eb95af2722fe367
parent5a0f3a2502e2b9ff927afe68b4bb2b216678b75f (diff)
downloadobnam-c4a7f17faa512e580124506071c9be46b3962c84.tar.gz
Fix backup plugin to not reset bytes_written at each checkpoint.
-rw-r--r--obnamlib/plugins/backup_plugin.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index a67ac1a5..eb485325 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -43,7 +43,8 @@ class BackupPlugin(obnamlib.ObnamPlugin):
return p.parse(value)
def backup(self, args):
- logging.debug('backup starts')
+ logging.info('Backup starts')
+
logging.debug('checkpoints every %s' % self.app.config['checkpoint'])
self.app.config.require('store')
@@ -73,6 +74,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.exclude_pats = [re.compile(x) for x in self.app.config['exclude']]
+ last_checkpoint = 0
for root in roots:
if not self.fs:
self.fs = self.app.fsf.new(root)
@@ -94,13 +96,14 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.app.hooks.call('error-message',
'Could not back up %s: %s' %
(pathname, e.strerror))
- if storefs.bytes_written >= self.app.config['checkpoint']:
+ if (last_checkpoint + storefs.bytes_written >=
+ self.app.config['checkpoint']):
logging.debug('Making checkpoint')
self.backup_parents('.')
self.store.commit_host(checkpoint=True)
self.store.lock_host(hostname)
self.store.start_generation()
- storefs.bytes_written = 0
+ last_checkpoint = storefs.bytes_written
self.backup_parents('.')
@@ -109,7 +112,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.store.commit_host()
storefs.close()
- logging.debug('backup finished')
+ logging.info('Backup finished.')
def find_files(self, root):
'''Find all files and directories that need to be backed up.