Parcourir la source

remove Repository3.commit

didn't do anything anyway in this implementation.
Thomas Waldmann il y a 9 mois
Parent
commit
e23231b2c4

+ 0 - 2
src/borg/archive.py

@@ -661,7 +661,6 @@ Duration: {0.duration}
             pass
         self.manifest.archives[name] = (self.id, metadata.time)
         self.manifest.write()
-        self.repository.commit(compact=False)
         self.cache.commit()
         return metadata
 
@@ -2155,7 +2154,6 @@ class ArchiveChecker:
             logger.info("Writing Manifest.")
             self.manifest.write()
             logger.info("Committing repo.")
-            self.repository.commit(compact=False)
 
 
 class ArchiveRecreater:

+ 0 - 5
src/borg/archiver/debug_cmd.py

@@ -293,12 +293,10 @@ class DebugMixIn:
 
         repository.put(id, data)
         print("object %s put." % hex_id)
-        repository.commit(compact=False)
 
     @with_repository(manifest=False, exclusive=True)
     def do_debug_delete_obj(self, args, repository):
         """delete the objects with the given IDs from the repo"""
-        modified = False
         for hex_id in args.ids:
             try:
                 id = hex_to_bin(hex_id, length=32)
@@ -307,12 +305,9 @@ class DebugMixIn:
             else:
                 try:
                     repository.delete(id)
-                    modified = True
                     print("object %s deleted." % hex_id)
                 except Repository3.ObjectNotFound:
                     print("object %s not found." % hex_id)
-        if modified:
-            repository.commit(compact=False)
         print("Done.")
 
     @with_repository(manifest=False, exclusive=True, cache=True, compatibility=Manifest.NO_OPERATION_CHECK)

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

@@ -45,7 +45,6 @@ class DeleteMixIn:
             logger.info("Finished dry-run.")
         elif deleted:
             manifest.write()
-            repository.commit(compact=False)
             self.print_warning('Done. Run "borg compact" to free space.', wc=None)
         else:
             self.print_warning("Aborted.", wc=None)

+ 0 - 1
src/borg/archiver/key_cmds.py

@@ -73,7 +73,6 @@ class KeysMixIn:
         manifest.key = key_new
         manifest.repo_objs.key = key_new
         manifest.write()
-        repository.commit(compact=False)
 
         # we need to rewrite cache config and security key-type info,
         # so that the cached key-type will match the repo key-type.

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

@@ -143,7 +143,6 @@ class PruneMixIn:
                 raise Error("Got Ctrl-C / SIGINT.")
             elif uncommitted_deletes > 0:
                 manifest.write()
-                repository.commit(compact=False)
                 cache.commit()
 
     def build_parser_prune(self, subparsers, common_parser, mid_common_parser):

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

@@ -137,7 +137,6 @@ class RCompressMixIn:
         else:
             while repository.async_response(wait=True) is not None:
                 pass
-            repository.commit(compact=True)
         if args.stats:
             print()
             print("Recompression stats:")

+ 0 - 1
src/borg/archiver/rcreate_cmd.py

@@ -32,7 +32,6 @@ class RCreateMixIn:
         manifest = Manifest(key, repository)
         manifest.key = key
         manifest.write()
-        repository.commit(compact=False)
         with Cache(repository, manifest, warn_if_unencrypted=False):
             pass
         if key.NAME != "plaintext":

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

@@ -49,7 +49,6 @@ class RecreateMixIn:
                 logger.info("Skipped archive %s: Nothing to do. Archive was not processed.", name)
         if not args.dry_run:
             manifest.write()
-            repository.commit(compact=False)
             cache.commit()
 
     def build_parser_recreate(self, subparsers, common_parser, mid_common_parser):

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

@@ -17,7 +17,6 @@ class RenameMixIn:
         """Rename an existing archive"""
         archive.rename(args.newname)
         manifest.write()
-        repository.commit(compact=False)
         cache.commit()
 
     def build_parser_rename(self, subparsers, common_parser, mid_common_parser):

+ 0 - 1
src/borg/remote3.py

@@ -160,7 +160,6 @@ class RepositoryServer:  # pragma: no cover
     _rpc_methods3 = (
         "__len__",
         "check",
-        "commit",
         "delete",
         "destroy",
         "get",

+ 0 - 3
src/borg/repository3.py

@@ -205,9 +205,6 @@ class Repository3:
         )
         return info
 
-    def commit(self, compact=True, threshold=0.1):
-        pass
-
     def check(self, repair=False, max_duration=0):
         """Check repository consistency"""
 

+ 0 - 13
src/borg/testsuite/archiver/check_cmd.py

@@ -105,7 +105,6 @@ def test_missing_file_chunk(archivers, request):
                 break
         else:
             pytest.fail("should not happen")  # convert 'fail'
-        repository.commit(compact=False)
 
     cmd(archiver, "check", exit_code=1)
     output = cmd(archiver, "check", "--repair", exit_code=0)
@@ -171,7 +170,6 @@ def test_missing_archive_item_chunk(archivers, request):
     archive, repository = open_archive(archiver.repository_path, "archive1")
     with repository:
         repository.delete(archive.metadata.items[0])
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     cmd(archiver, "check", "--repair", exit_code=0)
     cmd(archiver, "check", exit_code=0)
@@ -183,7 +181,6 @@ def test_missing_archive_metadata(archivers, request):
     archive, repository = open_archive(archiver.repository_path, "archive1")
     with repository:
         repository.delete(archive.id)
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     cmd(archiver, "check", "--repair", exit_code=0)
     cmd(archiver, "check", exit_code=0)
@@ -198,7 +195,6 @@ def test_missing_manifest(archivers, request):
             repository.store_delete("config/manifest")
         else:
             repository.delete(Manifest.MANIFEST_ID)
-            repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     output = cmd(archiver, "check", "-v", "--repair", exit_code=0)
     assert "archive1" in output
@@ -214,7 +210,6 @@ def test_corrupted_manifest(archivers, request):
         manifest = repository.get_manifest()
         corrupted_manifest = manifest[:123] + b"corrupted!" + manifest[123:]
         repository.put_manifest(corrupted_manifest)
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     output = cmd(archiver, "check", "-v", "--repair", exit_code=0)
     assert "archive1" in output
@@ -246,7 +241,6 @@ def test_spoofed_manifest(archivers, request):
         # maybe a repo-side attacker could manage to move the fake manifest file chunk over to the manifest ID.
         # we simulate this here by directly writing the fake manifest data to the manifest ID.
         repository.put_manifest(cdata)
-        repository.commit(compact=False)
     # borg should notice that the manifest has the wrong ro_type.
     cmd(archiver, "check", exit_code=1)
     # borg check --repair should remove the corrupted manifest and rebuild a new one.
@@ -267,7 +261,6 @@ def test_manifest_rebuild_corrupted_chunk(archivers, request):
         chunk = repository.get(archive.id)
         corrupted_chunk = chunk + b"corrupted!"
         repository.put(archive.id, corrupted_chunk)
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     output = cmd(archiver, "check", "-v", "--repair", exit_code=0)
     assert "archive2" in output
@@ -295,7 +288,6 @@ def test_manifest_rebuild_duplicate_archive(archivers, request):
         archive = repo_objs.key.pack_metadata(archive_dict)
         archive_id = repo_objs.id_hash(archive)
         repository.put(archive_id, repo_objs.format(archive_id, {}, archive, ro_type=ROBJ_ARCHIVE_META))
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     cmd(archiver, "check", "--repair", exit_code=0)
     output = cmd(archiver, "rlist")
@@ -336,7 +328,6 @@ def test_spoofed_archive(archivers, request):
                 ro_type=ROBJ_FILE_STREAM,  # a real archive is stored with ROBJ_ARCHIVE_META
             ),
         )
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)
     cmd(archiver, "check", "--repair", "--debug", exit_code=0)
     output = cmd(archiver, "rlist")
@@ -354,7 +345,6 @@ def test_extra_chunks(archivers, request):
     with Repository3(archiver.repository_location, exclusive=True) as repository:
         chunk = fchunk(b"xxxx")
         repository.put(b"01234567890123456789012345678901", chunk)
-        repository.commit(compact=False)
     cmd(archiver, "check", "-v", exit_code=0)  # check does not deal with orphans anymore
 
 
@@ -388,7 +378,6 @@ def test_verify_data(archivers, request, init_args):
                     data = data[0:123] + b"x" + data[123:]
                     repository.put(chunk.id, data)
                     break
-            repository.commit(compact=False)
 
         # the normal archives check does not read file content data.
         cmd(archiver, "check", "--archives-only", exit_code=0)
@@ -423,7 +412,6 @@ def test_corrupted_file_chunk(archivers, request, init_args):
                 data = data[0:123] + b"x" + data[123:]
                 repository.put(chunk.id, data)
                 break
-        repository.commit(compact=False)
 
     # the normal check checks all repository objects and the xxh64 checksum fails.
     output = cmd(archiver, "check", "--repository-only", exit_code=1)
@@ -446,5 +434,4 @@ def test_empty_repository(archivers, request):
     with Repository3(archiver.repository_location, exclusive=True) as repository:
         for id_ in repository.list():
             repository.delete(id_)
-        repository.commit(compact=False)
     cmd(archiver, "check", exit_code=1)

+ 0 - 1
src/borg/testsuite/archiver/checks.py

@@ -29,7 +29,6 @@ def add_unknown_feature(repo_path, operation):
         manifest = Manifest.load(repository, Manifest.NO_OPERATION_CHECK)
         manifest.config["feature_flags"] = {operation.value: {"mandatory": ["unknown-feature"]}}
         manifest.write()
-        repository.commit(compact=False)
 
 
 def cmd_raises_unknown_feature(archiver, args):

+ 0 - 1
src/borg/testsuite/archiver/mount_cmds.py

@@ -213,7 +213,6 @@ def test_fuse_allow_damaged_files(archivers, request):
                 break
         else:
             assert False  # missed the file
-        repository.commit(compact=False)
     cmd(archiver, "check", "--repair", exit_code=0)
 
     mountpoint = os.path.join(archiver.tmpdir, "mountpoint")