summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-11-17 16:38:52 +0000
committerLars Wirzenius <liw@liw.fi>2012-11-17 16:38:52 +0000
commitdbcf4c021f22b1b3f0604225ce6bf2ccb693d7c9 (patch)
treebff0ffa63fb4ce395795e39277d782ff6d43249e
parenta0f77497e5049504932d8c988606998471a5d751 (diff)
downloadobnam-dbcf4c021f22b1b3f0604225ce6bf2ccb693d7c9.tar.gz
Ignore shared B-tree lookup errors during backup
Because of inherent race conditions in Obnam's chosen locking model, the lookup may fail due to another Obnam instance updating the B-trees while we are looking up (or after we last opened the B-tree). This should not be a fatal error, so we ignore such errors.
-rw-r--r--obnamlib/plugins/backup_plugin.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/obnamlib/plugins/backup_plugin.py b/obnamlib/plugins/backup_plugin.py
index 74aa74b5..81fb2237 100644
--- a/obnamlib/plugins/backup_plugin.py
+++ b/obnamlib/plugins/backup_plugin.py
@@ -603,8 +603,16 @@ class BackupPlugin(obnamlib.ObnamPlugin):
'''Back up a chunk of data by putting it into the repository.'''
def find():
- return (self.repo.find_chunks(checksum) +
- self.chunkid_pool.get(checksum))
+ # We ignore lookup errors here intentionally. We're reading
+ # the checksum trees without a lock, so another Obnam may be
+ # modifying them, which can lead to spurious NodeMissing
+ # exceptions, and other errors. We don't care: we'll just
+ # pretend no chunk with the checksum exists yet.
+ try:
+ in_tree = self.repo.find_chunks(checksum)
+ except larch.Error:
+ in_tree = []
+ return in_tree + self.chunkid_pool.get(checksum)
def get(chunkid):
return self.repo.get_chunk(chunkid)