Rev 3806: Use the page cache as part of _check_remap() in http://bzr.arbash-meinel.com/branches/bzr/brisbane/remap

John Arbash Meinel john at arbash-meinel.com
Wed Dec 24 16:52:15 GMT 2008


At http://bzr.arbash-meinel.com/branches/bzr/brisbane/remap

------------------------------------------------------------
revno: 3806
revision-id: john at arbash-meinel.com-20081209061005-gz20bp1fke585zll
parent: john at arbash-meinel.com-20081219230732-ri1i1tujtrh2d3sl
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: xml_cache
timestamp: Tue 2008-12-09 00:10:05 -0600
message:
  Use the page cache as part of _check_remap()
-------------- next part --------------
=== modified file 'bzrlib/chk_map.py'
--- a/bzrlib/chk_map.py	2008-12-12 21:50:41 +0000
+++ b/bzrlib/chk_map.py	2008-12-09 06:10:05 +0000
@@ -976,6 +976,25 @@
                         # Adding this key would cause a split, so we know we
                         # don't need to collapse
                         return self
+        if keys:
+            # Look in the page cache for some more bytes
+            found_keys = set()
+            for chk, prefix in keys.iteritems():
+                try:
+                    bytes = _page_cache[chk]
+                except KeyError:
+                    continue
+                else:
+                    node = _deserialise(bytes, chk)
+                    self._items[prefix] = node
+                    if isinstance(node, InternalNode):
+                        # We have done enough to know that we can stop
+                        return self
+                    for key, value in node._items.iteritems():
+                        if new_leaf._map_no_split(key, value):
+                            return self
+            for chk in found_keys:
+                del keys[chk]
         # So far, everything fits. Page in the rest of the nodes, and see if it
         # holds true.
         if keys:



More information about the bazaar-commits mailing list