mirror of https://github.com/borgbackup/borg.git
check: do not consider orphan chunks a problem
if we use AdHocCache or NewCache, we do not have precise refcounting. thus, we do not delete repo objects as their refcount does not go to zero. check --repair will just remove the orphans.
This commit is contained in:
parent
e2a1999c59
commit
4cd9bc8a6b
|
@ -2331,10 +2331,10 @@ class ArchiveChecker:
|
|||
unused = {id_ for id_, entry in self.chunks.iteritems() if entry.refcount == 0}
|
||||
orphaned = unused - self.possibly_superseded
|
||||
if orphaned:
|
||||
logger.error(f"{len(orphaned)} orphaned objects found!")
|
||||
logger.info(f"{len(orphaned)} orphaned (unused) objects found.")
|
||||
for chunk_id in orphaned:
|
||||
logger.debug(f"chunk {bin_to_hex(chunk_id)} is orphaned.")
|
||||
self.error_found = True
|
||||
# To support working with AdHocCache or NewCache, we do not set self.error_found = True.
|
||||
if self.repair and unused:
|
||||
logger.info(
|
||||
"Deleting %d orphaned and %d superseded objects..." % (len(orphaned), len(self.possibly_superseded))
|
||||
|
|
|
@ -338,10 +338,11 @@ def test_extra_chunks(archivers, request):
|
|||
with Repository(archiver.repository_location, exclusive=True) as repository:
|
||||
repository.put(b"01234567890123456789012345678901", b"xxxx")
|
||||
repository.commit(compact=False)
|
||||
cmd(archiver, "check", exit_code=1)
|
||||
cmd(archiver, "check", exit_code=1)
|
||||
output = cmd(archiver, "check", "-v", exit_code=0) # orphans are not considered warnings anymore
|
||||
assert "1 orphaned (unused) objects found." in output
|
||||
cmd(archiver, "check", "--repair", exit_code=0)
|
||||
cmd(archiver, "check", exit_code=0)
|
||||
output = cmd(archiver, "check", "-v", exit_code=0)
|
||||
assert "orphaned (unused) objects found." not in output
|
||||
cmd(archiver, "extract", "archive1", "--dry-run", exit_code=0)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue