From 42b6a838da46c87d85b5b32d45635ac25aec01fd Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sun, 14 Aug 2016 15:07:18 +0200 Subject: [PATCH] fix cyclic import issue, fix tests needed to increase ChunkBuffer size due to increased items stream chunk size to get the test working. --- src/borg/archive.py | 2 +- src/borg/helpers.py | 2 +- src/borg/testsuite/archive.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 52a03af85..35ccff0a1 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -169,7 +169,7 @@ class DownloadPipeline: class ChunkBuffer: - BUFFER_SIZE = 1 * 1024 * 1024 + BUFFER_SIZE = 8 * 1024 * 1024 def __init__(self, key, chunker_params=ITEMS_CHUNKER_PARAMS): self.buffer = BytesIO() diff --git a/src/borg/helpers.py b/src/borg/helpers.py index 728bc6eff..2324d32a9 100644 --- a/src/borg/helpers.py +++ b/src/borg/helpers.py @@ -39,7 +39,6 @@ from . import crypto from . import hashindex from . import shellpattern from .constants import * # NOQA -from .compress import get_compressor # meta dict, data bytes _Chunk = namedtuple('_Chunk', 'meta data') @@ -1584,6 +1583,7 @@ class CompressionDecider2: return compr_spec, chunk def heuristic_lz4(self, compr_args, chunk): + from .compress import get_compressor meta, data = chunk lz4 = get_compressor('lz4') cdata = lz4.compress(data) diff --git a/src/borg/testsuite/archive.py b/src/borg/testsuite/archive.py index 30f619747..19db1a44c 100644 --- a/src/borg/testsuite/archive.py +++ b/src/borg/testsuite/archive.py @@ -109,7 +109,7 @@ class ChunkBufferTestCase(BaseTestCase): self.assert_equal(data, [Item(internal_dict=d) for d in unpacker]) def test_partial(self): - big = "0123456789" * 10000 + big = "0123456789abcdefghijklmnopqrstuvwxyz" * 25000 data = [Item(path='full', source=big), Item(path='partial', source=big)] cache = MockCache() key = PlaintextKey(None)