mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-22 07:43:06 +00:00
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.
This commit is contained in:
parent
162035da91
commit
3fbb297fd7
3 changed files with 4 additions and 19 deletions
|
@ -2093,7 +2093,7 @@ def do_compact(self, args, repository):
|
|||
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 @@ def define_borg_mount(parser):
|
|||
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 @@ def define_borg_mount(parser):
|
|||
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)')
|
||||
|
|
|
@ -905,9 +905,8 @@ def check(self, repair=False, save_space=False, max_duration=0):
|
|||
|
||||
@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'))
|
||||
|
|
|
@ -495,7 +495,7 @@ def close(self):
|
|||
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 @@ def commit(self, save_space=False, compact=True, threshold=0.1, cleanup_commits=
|
|||
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()
|
||||
|
|
Loading…
Reference in a new issue