소스 검색

shared locking for many borg commands

not for check and compact, these need an exclusive lock.

to try parallel repo access on same machine, same user,
one needs to use a non-locking cache implementation:

export BORG_CACHE_IMPL=adhoc

this is slow due the missing files cache in that implementation,
but unproblematic because no caches/indexes are persisted.
Thomas Waldmann 9 달 전
부모
커밋
0e183b225d

+ 1 - 1
src/borg/archiver/create_cmd.py

@@ -41,7 +41,7 @@ logger = create_logger()
 
 
 class CreateMixIn:
-    @with_repository(exclusive=True, compatibility=(Manifest.Operation.WRITE,))
+    @with_repository(compatibility=(Manifest.Operation.WRITE,))
     def do_create(self, args, repository, manifest):
         """Create new archive"""
         key = manifest.key

+ 1 - 1
src/borg/archiver/debug_cmd.py

@@ -281,7 +281,7 @@ class DebugMixIn:
         with open(args.object_path, "wb") as f:
             f.write(data_encrypted)
 
-    @with_repository(manifest=False, exclusive=True)
+    @with_repository(manifest=False)
     def do_debug_put_obj(self, args, repository):
         """put file contents into the repository"""
         with open(args.path, "rb") as f:

+ 1 - 1
src/borg/archiver/delete_cmd.py

@@ -12,7 +12,7 @@ logger = create_logger()
 
 
 class DeleteMixIn:
-    @with_repository(exclusive=True, manifest=False)
+    @with_repository(manifest=False)
     def do_delete(self, args, repository):
         """Delete archives"""
         self.output_list = args.output_list

+ 2 - 2
src/borg/archiver/key_cmds.py

@@ -83,7 +83,7 @@ class KeysMixIn:
             key.remove(key.target)  # remove key from current location
             logger.info(f"Key moved to {loc}")
 
-    @with_repository(lock=False, exclusive=False, manifest=False, cache=False)
+    @with_repository(lock=False, manifest=False, cache=False)
     def do_key_export(self, args, repository):
         """Export the repository key for backup"""
         manager = KeyManager(repository)
@@ -102,7 +102,7 @@ class KeysMixIn:
         except IsADirectoryError:
             raise CommandError(f"'{args.path}' must be a file, not a directory")
 
-    @with_repository(lock=False, exclusive=False, manifest=False, cache=False)
+    @with_repository(lock=False, manifest=False, cache=False)
     def do_key_import(self, args, repository):
         """Import the repository key from backup"""
         manager = KeyManager(repository)

+ 1 - 1
src/borg/archiver/prune_cmd.py

@@ -70,7 +70,7 @@ def prune_split(archives, rule, n, kept_because=None):
 
 
 class PruneMixIn:
-    @with_repository(exclusive=True, compatibility=(Manifest.Operation.DELETE,))
+    @with_repository(compatibility=(Manifest.Operation.DELETE,))
     def do_prune(self, args, repository, manifest):
         """Prune repository archives according to specified rules"""
         if not any(

+ 1 - 1
src/borg/archiver/rcompress_cmd.py

@@ -88,7 +88,7 @@ def format_compression_spec(ctype, clevel, olevel):
 
 
 class RCompressMixIn:
-    @with_repository(cache=False, manifest=True, exclusive=True, compatibility=(Manifest.Operation.CHECK,))
+    @with_repository(cache=False, manifest=True, compatibility=(Manifest.Operation.CHECK,))
     def do_rcompress(self, args, repository, manifest):
         """Repository (re-)compression"""
 

+ 1 - 1
src/borg/archiver/recreate_cmd.py

@@ -15,7 +15,7 @@ logger = create_logger()
 
 
 class RecreateMixIn:
-    @with_repository(cache=True, exclusive=True, compatibility=(Manifest.Operation.CHECK,))
+    @with_repository(cache=True, compatibility=(Manifest.Operation.CHECK,))
     def do_recreate(self, args, repository, manifest, cache):
         """Re-create archives"""
         matcher = build_matcher(args.patterns, args.paths)

+ 1 - 1
src/borg/archiver/rename_cmd.py

@@ -11,7 +11,7 @@ logger = create_logger()
 
 
 class RenameMixIn:
-    @with_repository(exclusive=True, cache=True, compatibility=(Manifest.Operation.CHECK,))
+    @with_repository(cache=True, compatibility=(Manifest.Operation.CHECK,))
     @with_archive
     def do_rename(self, args, repository, manifest, cache, archive):
         """Rename an existing archive"""

+ 1 - 1
src/borg/archiver/tar_cmds.py

@@ -240,7 +240,7 @@ class TarMixIn:
         for pattern in matcher.get_unmatched_include_patterns():
             self.print_warning_instance(IncludePatternNeverMatchedWarning(pattern))
 
-    @with_repository(cache=True, exclusive=True, compatibility=(Manifest.Operation.WRITE,))
+    @with_repository(cache=True, compatibility=(Manifest.Operation.WRITE,))
     def do_import_tar(self, args, repository, manifest, cache):
         """Create a backup archive from a tarball"""
         self.output_filter = args.output_filter

+ 1 - 1
src/borg/archiver/transfer_cmd.py

@@ -17,7 +17,7 @@ logger = create_logger()
 
 class TransferMixIn:
     @with_other_repository(manifest=True, compatibility=(Manifest.Operation.READ,))
-    @with_repository(exclusive=True, manifest=True, cache=True, compatibility=(Manifest.Operation.WRITE,))
+    @with_repository(manifest=True, cache=True, compatibility=(Manifest.Operation.WRITE,))
     def do_transfer(self, args, *, repository, manifest, cache, other_repository=None, other_manifest=None):
         """archives transfer from other repository, optionally upgrade data format"""
         key = manifest.key