summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Poláček <lukas@ksp.sk>2015-09-07 07:59:12 +0200
committerLukáš Poláček <lukas@ksp.sk>2015-09-07 08:12:03 +0200
commit5683e5a14eef0f3c72e7947aa063450ee0698105 (patch)
tree50f7fcc169b74fc8d66a3bc7e45ee9cff20c55d1
parentfb9ca97ab192a5869990f7e811e649968eb58d0f (diff)
downloadobnam-5683e5a14eef0f3c72e7947aa063450ee0698105.tar.gz
fsck: add an option to not check checksums
This speeds up fsck more than 5 times, depending on the backup structure and history.
-rw-r--r--obnamlib/plugins/fsck_plugin.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/obnamlib/plugins/fsck_plugin.py b/obnamlib/plugins/fsck_plugin.py
index b541ae5c..96226237 100644
--- a/obnamlib/plugins/fsck_plugin.py
+++ b/obnamlib/plugins/fsck_plugin.py
@@ -34,7 +34,7 @@ class CheckChunk(WorkItem):
logging.debug('Checking chunk %s', self.chunkid)
if not self.repo.has_chunk(self.chunkid):
self.error('chunk %s does not exist' % self.chunkid)
- else:
+ elif not self.settings['fsck-skip-checksums']:
data = self.repo.get_chunk_content(self.chunkid)
self.checksummer.update(data)
@@ -79,10 +79,11 @@ class CheckFile(WorkItem):
checksummer = hashlib.md5()
for chunkid in chunkids:
yield CheckChunk(chunkid, checksummer)
- md5 = self.repo.get_file_key(
- self.genid, self.filename, obnamlib.REPO_FILE_MD5)
- yield CheckFileChecksum(
- self.name, md5, chunkids, checksummer)
+ if not self.settings['fsck-skip-checksums']:
+ md5 = self.repo.get_file_key(
+ self.genid, self.filename, obnamlib.REPO_FILE_MD5)
+ yield CheckFileChecksum(
+ self.name, md5, chunkids, checksummer)
class CheckDirectory(WorkItem):
@@ -291,6 +292,11 @@ class FsckPlugin(obnamlib.ObnamPlugin):
'do not check shared B-trees',
group=group)
+ self.app.settings.boolean(
+ ['fsck-skip-checksums'],
+ 'do not check checksums of files',
+ group=group)
+
def configure_ttystatus(self):
self.app.ts.clear()
self.app.ts['this_item'] = 0