Rev 57: Fix suggestions for indices that trigger full buffering in bzrlib. in http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

Robert Collins robertc at robertcollins.net
Fri Nov 7 00:14:13 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/plugins/search/trunk

------------------------------------------------------------
revno: 57
revision-id: robertc at robertcollins.net-20081107001411-7d10mputo0on9qk7
parent: robertc at robertcollins.net-20081106230612-i46wehvrp2hzpwos
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Fri 2008-11-07 11:14:11 +1100
message:
  Fix suggestions for indices that trigger full buffering in bzrlib.
modified:
  NEWS                           news-20080608052041-z5bahsl8kwl0uf4x-2
  index.py                       index.py-20080608055509-hnimeek7q8tctkqf-2
=== modified file 'NEWS'
--- a/NEWS	2008-11-06 23:06:12 +0000
+++ b/NEWS	2008-11-07 00:14:11 +0000
@@ -29,6 +29,9 @@
 
   BUGFIXES:
 
+    * Bug 293906 caused by changes in bzrlib has been fixed. This bug caused
+      suggestions to fail in some circumstances. (Robert Collins)
+
   API BREAKS:
 
   TESTING:

=== modified file 'index.py'
--- a/index.py	2008-11-06 23:06:12 +0000
+++ b/index.py	2008-11-07 00:14:11 +0000
@@ -1227,8 +1227,9 @@
         # threshold of total-index processing/get calling layers that expect to
         # read the entire index to use the iter_all_entries  method instead.
         half_page = self._transport.recommended_page_size() // 2
-        # For when we don't know the length to permit bisection.
-        if self._size is None:
+        # For when we don't know the length to permit bisection, or when the
+        # index is fully buffered in ram.
+        if self._size is None or self._nodes is not None:
             if len(key) > 1:
                 candidates = self.iter_entries_prefix([key[:-1] + (None,)])
             else:
@@ -1253,6 +1254,11 @@
                 search = [(found[0][0][0] + step * found[0][1], key)]
                 found = self._lookup_keys_via_location(search)
             while True:
+                if self._nodes:
+                    # we triggered a full read - everything is in _nodes now.
+                    for result in self.iter_entries_starts_with(key):
+                        yield result
+                    return
                 lower_index = self._parsed_key_index(key)
                 parsed_range = self._parsed_key_map[lower_index]
                 last_key = parsed_range[1]




More information about the bazaar-commits mailing list