From 95fc98726d64c71ed0b3a8c2270ee62c1c5d1bb5 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 28 Oct 2016 11:56:20 -0300 Subject: [PATCH 1/1] 10315: Update pending write size count just before packing small blocks to see if there really are enough to fill a full one. --- sdk/python/arvados/arvfile.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py index 2858a480ea..7ee028db2a 100644 --- a/sdk/python/arvados/arvfile.py +++ b/sdk/python/arvados/arvfile.py @@ -574,6 +574,13 @@ class _BlockManager(object): # Not enough small blocks for repacking return + # Update the pending write size count with its true value, just in case + # some small file was opened, written and closed several times. + if not force: + self._pending_write_size = sum([b.size() for b in small_blocks]) + if self._pending_write_size < config.KEEP_BLOCK_SIZE: + return + new_bb = self._alloc_bufferblock() while len(small_blocks) > 0 and (new_bb.write_pointer + small_blocks[0].size()) <= config.KEEP_BLOCK_SIZE: bb = small_blocks.pop(0) -- 2.30.2