summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-07-04 11:25:49 +1200
committerLars Wirzenius <liw@liw.fi>2010-07-04 11:25:49 +1200
commit1c037f96474bfbfdb06f8df9621df0ccc642a393 (patch)
treea2f15e2c97dbb338801979d68b597e39d0a9a758
parent91f3cc5c6c5765cec49d9e5736beed628a2f4c59 (diff)
downloadobnam-1c037f96474bfbfdb06f8df9621df0ccc642a393.tar.gz
Make checkpoints at suitable intervals.
-rw-r--r--obnamlib/plugins/backup_plugin.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index e3a5a5b0..a7dd8ece 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -39,6 +39,7 @@ class BackupPlugin(obnamlib.ObnamPlugin):
def backup(self, args):
logging.debug('backup starts')
+ logging.debug('checkpoints every %s' % self.app.config['checkpoint'])
self.app.config.require('store')
self.app.config.require('hostname')
@@ -86,6 +87,14 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.app.hooks.call('error-message',
'Could not back up %s: %s' %
(pathname, e.strerror))
+ if storefs.written >= self.app.config['checkpoint']:
+ logging.debug('Making checkpoint')
+ self.backup_parents('.')
+ self.store.commit_host()
+ self.store.lock_host(hostname)
+ self.store.start_generation()
+ self.fs.written = 0
+
self.backup_parents('.')
if self.fs:
@@ -181,7 +190,6 @@ class BackupPlugin(obnamlib.ObnamPlugin):
self.store.set_file_chunk_groups(filename, cgids)
else:
self.store.set_file_chunks(filename, chunkids)
-
def backup_file_chunk(self, data):
'''Back up a chunk of data by putting it into the store.'''