From 3fbb297fd746ffbce66e5d256ef828fe12f1f9a7 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 26 Jun 2022 00:07:07 +0200 Subject: [PATCH] compact: remove --cleanup-commits this was a one-time fix only needed for borg 1.2. users are expected to use borg 1.2 to cleanup the commits. --- src/borg/archiver.py | 9 +-------- src/borg/remote.py | 5 ++--- src/borg/repository.py | 9 +-------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/src/borg/archiver.py b/src/borg/archiver.py index d647e544..c37b1ee2 100644 --- a/src/borg/archiver.py +++ b/src/borg/archiver.py @@ -2093,7 +2093,7 @@ class Archiver: data = repository.get(Manifest.MANIFEST_ID) repository.put(Manifest.MANIFEST_ID, data) threshold = args.threshold / 100 - repository.commit(compact=True, threshold=threshold, cleanup_commits=args.cleanup_commits) + repository.commit(compact=True, threshold=threshold) return EXIT_SUCCESS @with_repository(exclusive=True, manifest=False) @@ -3536,11 +3536,6 @@ class Archiver: given by the ``--threshold`` option. If omitted, a threshold of 10% is used. When using ``--verbose``, borg will output an estimate of the freed space. - After upgrading borg (server) to 1.2+, you can use ``borg compact --cleanup-commits`` - to clean up the numerous 17byte commit-only segments that borg 1.1 did not clean up - due to a bug. It is enough to do that once per repository. After cleaning up the - commits, borg will also do a normal compaction. - See :ref:`separate_compaction` in Additional Notes for more details. """) subparser = subparsers.add_parser('compact', parents=[common_parser], add_help=False, @@ -3549,8 +3544,6 @@ class Archiver: formatter_class=argparse.RawDescriptionHelpFormatter, help='compact segment files / free space in repo') subparser.set_defaults(func=self.do_compact) - subparser.add_argument('--cleanup-commits', dest='cleanup_commits', action='store_true', - help='cleanup commit-only 17-byte segment files') subparser.add_argument('--threshold', metavar='PERCENT', dest='threshold', type=int, default=10, help='set minimum threshold for saved space in PERCENT (Default: 10)') diff --git a/src/borg/remote.py b/src/borg/remote.py index 6ea51d3c..ac7255aa 100644 --- a/src/borg/remote.py +++ b/src/borg/remote.py @@ -905,9 +905,8 @@ This problem will go away as soon as the server has been upgraded to 1.0.7+. @api(since=parse_version('1.0.0'), compact={'since': parse_version('1.2.0a0'), 'previously': True, 'dontcare': True}, - threshold={'since': parse_version('1.2.0a8'), 'previously': 0.1, 'dontcare': True}, - cleanup_commits={'since': parse_version('1.2.0a0'), 'previously': False, 'dontcare': True}) - def commit(self, save_space=False, compact=True, threshold=0.1, cleanup_commits=False): + threshold={'since': parse_version('1.2.0a8'), 'previously': 0.1, 'dontcare': True}) + def commit(self, save_space=False, 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 b2458dbf..13f469fc 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -495,7 +495,7 @@ class Repository: self.lock.release() self.lock = None - def commit(self, save_space=False, compact=True, threshold=0.1, cleanup_commits=False): + def commit(self, save_space=False, compact=True, threshold=0.1): """Commit transaction """ # save_space is not used anymore, but stays for RPC/API compatibility. @@ -509,13 +509,6 @@ class Repository: self.segments.setdefault(segment, 0) self.compact[segment] += LoggedIO.header_fmt.size if compact and not self.append_only: - if cleanup_commits: - # due to bug #2850, there might be a lot of commit-only segment files. - # this is for a one-time cleanup of these 17byte files. - for segment, filename in self.io.segment_iterator(): - if os.path.getsize(filename) == 17: - self.segments[segment] = 0 - self.compact[segment] = LoggedIO.header_fmt.size self.compact_segments(threshold) self.write_index() self.rollback()