From 5683e5a14eef0f3c72e7947aa063450ee0698105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Pol=C3=A1=C4=8Dek?= Date: Mon, 7 Sep 2015 07:59:12 +0200 Subject: fsck: add an option to not check checksums This speeds up fsck more than 5 times, depending on the backup structure and history. --- obnamlib/plugins/fsck_plugin.py | 16 +++++++++++----- 1 file 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 -- cgit v1.2.1