mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-04 22:27:13 -04:00
Merge pull request #7066 from ThomasWaldmann/fix-recreate-fixed-chunker-master
get_chunker: fix missing sparse=False argument, fixes #7056
This commit is contained in:
commit
5edc53d4d4
2 changed files with 19 additions and 2 deletions
|
|
@ -322,7 +322,7 @@ class ChunkBuffer:
|
|||
self.packer = msgpack.Packer()
|
||||
self.chunks = []
|
||||
self.key = key
|
||||
self.chunker = get_chunker(*chunker_params, seed=self.key.chunk_seed)
|
||||
self.chunker = get_chunker(*chunker_params, seed=self.key.chunk_seed, sparse=False)
|
||||
|
||||
def add(self, item):
|
||||
self.buffer.write(self.packer.pack(item.as_dict()))
|
||||
|
|
@ -2380,7 +2380,7 @@ class ArchiveRecreater:
|
|||
checkpoint_interval=self.checkpoint_interval,
|
||||
rechunkify=target.recreate_rechunkify,
|
||||
).process_file_chunks
|
||||
target.chunker = get_chunker(*target.chunker_params, seed=self.key.chunk_seed)
|
||||
target.chunker = get_chunker(*target.chunker_params, seed=self.key.chunk_seed, sparse=False)
|
||||
return target
|
||||
|
||||
def create_target_archive(self, name):
|
||||
|
|
|
|||
|
|
@ -154,6 +154,23 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
|||
)
|
||||
)
|
||||
|
||||
def test_recreate_fixed_rechunkify(self):
|
||||
with open(os.path.join(self.input_path, "file"), "wb") as fd:
|
||||
fd.write(b"a" * 8192)
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
self.cmd(f"--repo={self.repository_location}", "create", "test", "input", "--chunker-params", "7,9,8,128")
|
||||
output = self.cmd(
|
||||
f"--repo={self.repository_location}", "list", "test", "input/file", "--format", "{num_chunks}"
|
||||
)
|
||||
num_chunks = int(output)
|
||||
assert num_chunks > 2
|
||||
self.cmd(f"--repo={self.repository_location}", "recreate", "--chunker-params", "fixed,4096")
|
||||
output = self.cmd(
|
||||
f"--repo={self.repository_location}", "list", "test", "input/file", "--format", "{num_chunks}"
|
||||
)
|
||||
num_chunks = int(output)
|
||||
assert num_chunks == 2
|
||||
|
||||
def test_recreate_recompress(self):
|
||||
self.create_regular_file("compressible", size=10000)
|
||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||
|
|
|
|||
Loading…
Reference in a new issue