mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-01 12:45:34 +00:00
debug: remove refcount-obj command
borg doesn't do precise refcounting anymore, so this is pretty useless.
This commit is contained in:
parent
2be98c773b
commit
20c180c317
2 changed files with 0 additions and 50 deletions
|
@ -310,21 +310,6 @@ def do_debug_delete_obj(self, args, repository):
|
||||||
print("object %s not found." % hex_id)
|
print("object %s not found." % hex_id)
|
||||||
print("Done.")
|
print("Done.")
|
||||||
|
|
||||||
@with_repository(manifest=False, exclusive=True, cache=True, compatibility=Manifest.NO_OPERATION_CHECK)
|
|
||||||
def do_debug_refcount_obj(self, args, repository, manifest, cache):
|
|
||||||
"""display refcounts for the objects with the given IDs"""
|
|
||||||
for hex_id in args.ids:
|
|
||||||
try:
|
|
||||||
id = hex_to_bin(hex_id, length=32)
|
|
||||||
except ValueError:
|
|
||||||
print("object id %s is invalid." % hex_id)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
refcount = cache.chunks[id][0]
|
|
||||||
print("object %s has %d referrers [info from chunks cache]." % (hex_id, refcount))
|
|
||||||
except KeyError:
|
|
||||||
print("object %s not found [info from chunks cache]." % hex_id)
|
|
||||||
|
|
||||||
def do_debug_convert_profile(self, args):
|
def do_debug_convert_profile(self, args):
|
||||||
"""convert Borg profile to Python profile"""
|
"""convert Borg profile to Python profile"""
|
||||||
import marshal
|
import marshal
|
||||||
|
@ -605,23 +590,6 @@ def build_parser_debug(self, subparsers, common_parser, mid_common_parser):
|
||||||
"ids", metavar="IDs", nargs="+", type=str, help="hex object ID(s) to delete from the repo"
|
"ids", metavar="IDs", nargs="+", type=str, help="hex object ID(s) to delete from the repo"
|
||||||
)
|
)
|
||||||
|
|
||||||
debug_refcount_obj_epilog = process_epilog(
|
|
||||||
"""
|
|
||||||
This command displays the reference count for objects from the repository.
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
subparser = debug_parsers.add_parser(
|
|
||||||
"refcount-obj",
|
|
||||||
parents=[common_parser],
|
|
||||||
add_help=False,
|
|
||||||
description=self.do_debug_refcount_obj.__doc__,
|
|
||||||
epilog=debug_refcount_obj_epilog,
|
|
||||||
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
||||||
help="show refcount for object from repository (debug)",
|
|
||||||
)
|
|
||||||
subparser.set_defaults(func=self.do_debug_refcount_obj)
|
|
||||||
subparser.add_argument("ids", metavar="IDs", nargs="+", type=str, help="hex object ID(s) to show refcounts for")
|
|
||||||
|
|
||||||
debug_convert_profile_epilog = process_epilog(
|
debug_convert_profile_epilog = process_epilog(
|
||||||
"""
|
"""
|
||||||
Convert a Borg profile to a Python cProfile compatible profile.
|
Convert a Borg profile to a Python cProfile compatible profile.
|
||||||
|
|
|
@ -158,24 +158,6 @@ def test_debug_dump_archive(archivers, request):
|
||||||
assert "_items" in result
|
assert "_items" in result
|
||||||
|
|
||||||
|
|
||||||
def test_debug_refcount_obj(archivers, request):
|
|
||||||
archiver = request.getfixturevalue(archivers)
|
|
||||||
cmd(archiver, "rcreate", RK_ENCRYPTION)
|
|
||||||
output = cmd(archiver, "debug", "refcount-obj", "0" * 64).strip()
|
|
||||||
info = "object 0000000000000000000000000000000000000000000000000000000000000000 not found [info from chunks cache]."
|
|
||||||
assert output == info
|
|
||||||
|
|
||||||
create_json = json.loads(cmd(archiver, "create", "--json", "test", "input"))
|
|
||||||
archive_id = create_json["archive"]["id"]
|
|
||||||
output = cmd(archiver, "debug", "refcount-obj", archive_id).strip()
|
|
||||||
# AdHocCache or AdHocWithFilesCache don't do precise refcounting, we'll get ChunkIndex.MAX_VALUE as refcount.
|
|
||||||
assert output == f"object {archive_id} has 4294966271 referrers [info from chunks cache]."
|
|
||||||
|
|
||||||
# Invalid IDs do not abort or return an error
|
|
||||||
output = cmd(archiver, "debug", "refcount-obj", "124", "xyza").strip()
|
|
||||||
assert output == f"object id 124 is invalid.{os.linesep}object id xyza is invalid."
|
|
||||||
|
|
||||||
|
|
||||||
def test_debug_info(archivers, request):
|
def test_debug_info(archivers, request):
|
||||||
archiver = request.getfixturevalue(archivers)
|
archiver = request.getfixturevalue(archivers)
|
||||||
output = cmd(archiver, "debug", "info")
|
output = cmd(archiver, "debug", "info")
|
||||||
|
|
Loading…
Reference in a new issue