From 8747644540e4e3443f9e953e76e25710434a1b21 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 17 Dec 2022 16:48:54 +0100 Subject: [PATCH] remove --save-space this option did not change behaviour since longer, we only had kept it for API compatibility. as a borg2 repo server won't have old clients talking to it, we can safely remove this everywhere now. --- src/borg/archive.py | 11 ++++------- src/borg/archiver/check_cmd.py | 6 +----- src/borg/archiver/delete_cmd.py | 5 +---- src/borg/archiver/prune_cmd.py | 5 +---- src/borg/remote.py | 8 ++++---- src/borg/repository.py | 5 ++--- src/borg/testsuite/archiver/prune_cmd.py | 15 --------------- 7 files changed, 13 insertions(+), 42 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 503303382..c6f3861c3 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -1691,16 +1691,13 @@ class ArchiveChecker: self.error_found = False self.possibly_superseded = set() - def check( - self, repository, repair=False, first=0, last=0, sort_by="", match=None, verify_data=False, save_space=False - ): + def check(self, repository, repair=False, first=0, last=0, sort_by="", match=None, verify_data=False): """Perform a set of checks on 'repository' :param repair: enable repair mode, write updated or corrected data into repository :param first/last/sort_by: only check this number of first/last archives ordered by sort_by :param match: only check archives matching this pattern :param verify_data: integrity verification of data referenced by archives - :param save_space: Repository.commit(save_space) """ logger.info("Starting archive consistency check...") self.check_all = not any((first, last, match)) @@ -1728,7 +1725,7 @@ class ArchiveChecker: self.manifest = self.rebuild_manifest() self.rebuild_refcounts(match=match, first=first, last=last, sort_by=sort_by) self.orphan_chunks_check() - self.finish(save_space=save_space) + self.finish() if self.error_found: logger.error("Archive consistency check complete, problems found.") else: @@ -2192,12 +2189,12 @@ class ArchiveChecker: else: logger.info("Orphaned objects check skipped (needs all archives checked).") - def finish(self, save_space=False): + def finish(self): if self.repair: logger.info("Writing Manifest.") self.manifest.write() logger.info("Committing repo.") - self.repository.commit(compact=False, save_space=save_space) + self.repository.commit(compact=False) class ArchiveRecreater: diff --git a/src/borg/archiver/check_cmd.py b/src/borg/archiver/check_cmd.py index e79e4a0ce..a183eebbc 100644 --- a/src/borg/archiver/check_cmd.py +++ b/src/borg/archiver/check_cmd.py @@ -47,7 +47,7 @@ class CheckMixIn: self.print_error("--repository-only is required for --max-duration support.") return EXIT_ERROR if not args.archives_only: - if not repository.check(repair=args.repair, save_space=args.save_space, max_duration=args.max_duration): + if not repository.check(repair=args.repair, max_duration=args.max_duration): return EXIT_WARNING if not args.repo_only and not ArchiveChecker().check( repository, @@ -57,7 +57,6 @@ class CheckMixIn: sort_by=args.sort_by or "ts", match=args.match_archives, verify_data=args.verify_data, - save_space=args.save_space, ): return EXIT_WARNING return EXIT_SUCCESS @@ -168,9 +167,6 @@ class CheckMixIn: subparser.add_argument( "--repair", dest="repair", action="store_true", help="attempt to repair any inconsistencies found" ) - subparser.add_argument( - "--save-space", dest="save_space", action="store_true", help="work slower, but using less space" - ) subparser.add_argument( "--max-duration", metavar="SECONDS", diff --git a/src/borg/archiver/delete_cmd.py b/src/borg/archiver/delete_cmd.py index 5ece8a14a..40e2b48ff 100644 --- a/src/borg/archiver/delete_cmd.py +++ b/src/borg/archiver/delete_cmd.py @@ -60,7 +60,7 @@ class DeleteMixIn: def checkpoint_func(): manifest.write() - repository.commit(compact=False, save_space=args.save_space) + repository.commit(compact=False) cache.commit() msg_delete = "Would delete archive: {} ({}/{})" if dry_run else "Deleting archive: {} ({}/{})" @@ -157,9 +157,6 @@ class DeleteMixIn: default=0, help="force deletion of corrupted archives, " "use ``--force --force`` in case ``--force`` does not work.", ) - subparser.add_argument( - "--save-space", dest="save_space", action="store_true", help="work slower, but using less space" - ) subparser.add_argument( "-c", "--checkpoint-interval", diff --git a/src/borg/archiver/prune_cmd.py b/src/borg/archiver/prune_cmd.py index 29f90c761..4c4a964b3 100644 --- a/src/borg/archiver/prune_cmd.py +++ b/src/borg/archiver/prune_cmd.py @@ -123,7 +123,7 @@ class PruneMixIn: def checkpoint_func(): manifest.write() - repository.commit(compact=False, save_space=args.save_space) + repository.commit(compact=False) cache.commit() list_logger = logging.getLogger("borg.output.list") @@ -289,9 +289,6 @@ class PruneMixIn: "-y", "--keep-yearly", dest="yearly", type=int, default=0, help="number of yearly archives to keep" ) define_archive_filters_group(subparser, sort_by=False, first_last=False) - subparser.add_argument( - "--save-space", dest="save_space", action="store_true", help="work slower, but using less space" - ) subparser.add_argument( "-c", "--checkpoint-interval", diff --git a/src/borg/remote.py b/src/borg/remote.py index a0e7c75b0..a93777b79 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -119,8 +119,8 @@ class UnexpectedRPCDataFormatFromServer(Error): compatMap = { - "check": ("repair", "save_space"), - "commit": ("save_space",), + "check": ("repair",), + "commit": (), "rollback": (), "destroy": (), "__len__": (), @@ -958,7 +958,7 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+. """actual remoting is done via self.call in the @api decorator""" @api(since=parse_version("1.0.0"), max_duration={"since": parse_version("1.2.0a4"), "previously": 0}) - def check(self, repair=False, save_space=False, max_duration=0): + def check(self, repair=False, max_duration=0): """actual remoting is done via self.call in the @api decorator""" @api( @@ -966,7 +966,7 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+. compact={"since": parse_version("1.2.0a0"), "previously": True, "dontcare": True}, threshold={"since": parse_version("1.2.0a8"), "previously": 0.1, "dontcare": True}, ) - def commit(self, save_space=False, compact=True, threshold=0.1): + def commit(self, compact=True, threshold=0.1): """actual remoting is done via self.call in the @api decorator""" @api(since=parse_version("1.0.0")) diff --git a/src/borg/repository.py b/src/borg/repository.py index 247d9db1e..8c980834f 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -505,9 +505,8 @@ class Repository: self.lock.release() self.lock = None - def commit(self, save_space=False, compact=True, threshold=0.1): + def commit(self, compact=True, threshold=0.1): """Commit transaction""" - # save_space is not used anymore, but stays for RPC/API compatibility. if self.transaction_doomed: exception = self.transaction_doomed self.rollback() @@ -1022,7 +1021,7 @@ class Repository: # The outcome of the DELETE has been recorded in the PUT branch already. self.compact[segment] += header_size(tag) + size - def check(self, repair=False, save_space=False, max_duration=0): + def check(self, repair=False, max_duration=0): """Check repository consistency This method verifies all segment checksums and makes sure diff --git a/src/borg/testsuite/archiver/prune_cmd.py b/src/borg/testsuite/archiver/prune_cmd.py index c8f780f24..9f6881fa2 100644 --- a/src/borg/testsuite/archiver/prune_cmd.py +++ b/src/borg/testsuite/archiver/prune_cmd.py @@ -161,21 +161,6 @@ class ArchiverTestCase(ArchiverTestCaseBase): assert re.search(r"Keeping archive \(rule: monthly #1\):\s+september30", output) self.assert_not_in("original_archive", output) - def test_prune_repository_save_space(self): - self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION) - self.cmd(f"--repo={self.repository_location}", "create", "test1", src_dir) - self.cmd(f"--repo={self.repository_location}", "create", "test2", src_dir) - output = self.cmd(f"--repo={self.repository_location}", "prune", "--list", "--dry-run", "--keep-daily=1") - assert re.search(r"Keeping archive \(rule: daily #1\):\s+test2", output) - assert re.search(r"Would prune:\s+test1", output) - output = self.cmd(f"--repo={self.repository_location}", "rlist") - self.assert_in("test1", output) - self.assert_in("test2", output) - self.cmd(f"--repo={self.repository_location}", "prune", "--save-space", "--keep-daily=1") - output = self.cmd(f"--repo={self.repository_location}", "rlist") - self.assert_not_in("test1", output) - self.assert_in("test2", output) - def test_prune_repository_prefix(self): self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION) self.cmd(f"--repo={self.repository_location}", "create", "foo-2015-08-12-10:00", src_dir)