mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-11 06:33:39 +00:00
fix transfer/upgrade
This commit is contained in:
parent
fa70d2f9c7
commit
960b601c58
2 changed files with 3 additions and 14 deletions
|
@ -180,7 +180,7 @@ class TransferMixIn:
|
|||
chunks.append(chunk_entry)
|
||||
present_size += size
|
||||
if not dry_run:
|
||||
item.chunks = chunks # TODO: overwrite? IDs and sizes are same.
|
||||
item.chunks = chunks
|
||||
archive.stats.nfiles += 1
|
||||
if not dry_run:
|
||||
item = upgrader.upgrade_item(item=item)
|
||||
|
|
|
@ -55,6 +55,7 @@ class UpgraderFrom12To20:
|
|||
ITEM_KEY_WHITELIST = {
|
||||
"path",
|
||||
"rdev",
|
||||
"chunks",
|
||||
"hlid",
|
||||
"mode",
|
||||
"user",
|
||||
|
@ -76,13 +77,7 @@ class UpgraderFrom12To20:
|
|||
|
||||
if self.hlm.borg1_hardlink_master(item):
|
||||
item.hlid = hlid = self.hlm.hardlink_id_from_path(item.path)
|
||||
if "chunks_healthy" in item:
|
||||
chunks_correct = item.chunks_healthy
|
||||
elif "chunks" in item:
|
||||
chunks_correct = item.chunks
|
||||
else:
|
||||
chunks_correct = None
|
||||
self.hlm.remember(id=hlid, info=chunks_correct)
|
||||
self.hlm.remember(id=hlid, info=item.get("chunks"))
|
||||
elif self.hlm.borg1_hardlink_slave(item):
|
||||
item.hlid = hlid = self.hlm.hardlink_id_from_path(item.source)
|
||||
chunks = self.hlm.retrieve(id=hlid)
|
||||
|
@ -96,12 +91,6 @@ class UpgraderFrom12To20:
|
|||
# - 'hardlink_master' (superseded by hlid)
|
||||
item_dict = item.as_dict()
|
||||
new_item_dict = {key: value for key, value in item_dict.items() if key in ITEM_KEY_WHITELIST}
|
||||
if "chunks_healthy" in item_dict:
|
||||
# we want the chunks list with the CORRECT chunk ids, even if the chunk is missing.
|
||||
new_item_dict["chunks"] = item_dict["chunks_healthy"]
|
||||
elif "chunks" in item_dict:
|
||||
# if there is no .chunks_healthy, the correct chunk ids are in .chunks.
|
||||
new_item_dict["chunks"] = item_dict["chunks"]
|
||||
# symlink targets were .source for borg1, but borg2 uses .target:
|
||||
if "source" in item_dict:
|
||||
new_item_dict["target"] = item_dict["source"]
|
||||
|
|
Loading…
Add table
Reference in a new issue