Rev 3673: Change how max_repack is evaluated, to allow for 0 to be a in http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree

John Arbash Meinel john at arbash-meinel.com
Fri Aug 22 03:39:23 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.7-dev/btree

------------------------------------------------------------
revno: 3673
revision-id: john at arbash-meinel.com-20080822023921-qtgco23nzulaf7xl
parent: john at arbash-meinel.com-20080822022908-420tr0519tdz6pxy
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: btree
timestamp: Thu 2008-08-21 21:39:21 -0500
message:
  Change how max_repack is evaluated, to allow for 0 to be a
  meaningful value.
modified:
  bzrlib/chunk_writer.py         chunk_writer.py-20080630234519-6ggn4id17nipovny-1
-------------- next part --------------
=== modified file 'bzrlib/chunk_writer.py'
--- a/bzrlib/chunk_writer.py	2008-08-22 02:09:36 +0000
+++ b/bzrlib/chunk_writer.py	2008-08-22 02:39:21 +0000
@@ -162,9 +162,6 @@
             self.bytes_in.append(bytes)
             self.seen_bytes = next_seen_size
         else:
-            if self.num_repack >= self._max_repack and not reserved:
-                # We already know we don't want to try to fit more
-                return True
             # This may or may not fit, try to add it with Z_SYNC_FLUSH
             out = comp.compress(bytes)
             out += comp.flush(Z_SYNC_FLUSH)
@@ -175,8 +172,12 @@
                 # We are over budget, try to squeeze this in without any
                 # Z_SYNC_FLUSH calls
                 self.num_repack += 1
-                bytes_out, this_len, compressor = self._recompress_all_bytes_in(bytes)
-                if this_len + 10 > capacity:
+                if self.num_repack >= self._max_repack:
+                    this_len = None
+                else:
+                    (bytes_out, this_len,
+                     compressor) = self._recompress_all_bytes_in(bytes)
+                if this_len is None or this_len + 10 > capacity:
                     # No way we can add anymore, we need to re-pack because our
                     # compressor is now out of sync.
                     # This seems to be rarely triggered over



More information about the bazaar-commits mailing list