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

John Arbash Meinel john at arbash-meinel.com
Tue Dec 9 06:10:24 GMT 2008


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

------------------------------------------------------------
revno: 3809
revision-id: john at arbash-meinel.com-20081209061005-fuyy6qnfnbyjniuo
parent: john at arbash-meinel.com-20081209045022-gknvw8l6yxiqwn5k
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-04 21:54:34 +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