mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-20 21:27:32 +00:00
attic PR #228 - Merge branch 'fix_ro_target' of ../attic
This commit is contained in:
commit
ee42ba561f
2 changed files with 10 additions and 2 deletions
|
@ -186,7 +186,8 @@ def fetch_from_cache(args):
|
||||||
raise Repository.ObjectNotFound(res[0], self.location.orig)
|
raise Repository.ObjectNotFound(res[0], self.location.orig)
|
||||||
elif error == b'InvalidRPCMethod':
|
elif error == b'InvalidRPCMethod':
|
||||||
raise InvalidRPCMethod(*res)
|
raise InvalidRPCMethod(*res)
|
||||||
raise self.RPCError(res.decode('utf-8'))
|
else:
|
||||||
|
raise self.RPCError(res.decode('utf-8'))
|
||||||
else:
|
else:
|
||||||
yield res
|
yield res
|
||||||
if not waiting_for and not calls:
|
if not waiting_for and not calls:
|
||||||
|
|
|
@ -145,7 +145,14 @@ def open_index(self, transaction_id):
|
||||||
|
|
||||||
def prepare_txn(self, transaction_id, do_cleanup=True):
|
def prepare_txn(self, transaction_id, do_cleanup=True):
|
||||||
self._active_txn = True
|
self._active_txn = True
|
||||||
self.lock.upgrade()
|
try:
|
||||||
|
self.lock.upgrade()
|
||||||
|
except UpgradableLock.WriteLockFailed:
|
||||||
|
# if upgrading the lock to exclusive fails, we do not have an
|
||||||
|
# active transaction. this is important for "serve" mode, where
|
||||||
|
# the repository instance lives on - even if exceptions happened.
|
||||||
|
self._active_txn = False
|
||||||
|
raise
|
||||||
if not self.index:
|
if not self.index:
|
||||||
self.index = self.open_index(transaction_id)
|
self.index = self.open_index(transaction_id)
|
||||||
if transaction_id is None:
|
if transaction_id is None:
|
||||||
|
|
Loading…
Reference in a new issue