Rev 3203: Go back to sending the edges of the entire cache rather than the current search. in http://people.ubuntu.com/~robertc/baz2.0/search-results

Robert Collins robertc at robertcollins.net
Sun Feb 3 22:26:25 GMT 2008


At http://people.ubuntu.com/~robertc/baz2.0/search-results

------------------------------------------------------------
revno: 3203
revision-id:robertc at robertcollins.net-20080203222616-uu4l68ac2j57c427
parent: robertc at robertcollins.net-20080203155204-lw3zej7zdfzwdgcs
committer: Robert Collins <robertc at robertcollins.net>
branch nick: Remote_missing_uses_search
timestamp: Mon 2008-02-04 09:26:16 +1100
message:
  Go back to sending the edges of the entire cache rather than the current search.
modified:
  bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2008-02-03 15:52:04 +0000
+++ b/bzrlib/remote.py	2008-02-03 22:26:16 +0000
@@ -775,7 +775,7 @@
         ancestry = self._parents_map
         missing_revisions = set(key for key in keys if key not in ancestry)
         if missing_revisions:
-            parent_map = self._get_parent_map(missing_revisions, current_search)
+            parent_map = self._get_parent_map(missing_revisions)
             if 'hpss' in debug.debug_flags:
                 mutter('retransmitted revisions: %d of %d',
                         len(set(self._parents_map).intersection(parent_map)),
@@ -806,7 +806,7 @@
            return True
         return False
 
-    def _get_parent_map(self, keys, current_search):
+    def _get_parent_map(self, keys):
         """Helper for get_parent_map that performs the RPC."""
         keys = set(keys)
         if NULL_REVISION in keys:
@@ -816,10 +816,25 @@
                 return found_parents
         else:
             found_parents = {}
-        if current_search is not None:
-            recipe = current_search.get_result().get_recipe()
-        else:
-            recipe = (set(), set(), 0)
+        # TODO(Needs analysis): We could assume that the keys being requested
+        # from get_parent_map are in a breadth first search, so typically they
+        # will all be depth N from some common parent, and we don't have to
+        # have the server iterate from the root parent, but rather from the
+        # keys we're searching; and just tell the server the keyspace we
+        # already have; but this may be more traffic again.
+
+        # Transform self._parents_map into a search request recipe.
+        # TODO: Manage this incrementally to avoid covering the same path
+        # repeatedly. (The server will have to on each request, but the less
+        # work done the better).
+        start_set = set(self._parents_map)
+        result_parents = set()
+        for parents in self._parents_map.itervalues():
+            result_parents.update(parents)
+        stop_keys = result_parents.difference(start_set)
+        included_keys = start_set.intersection(result_parents)
+        start_set.difference_update(included_keys)
+        recipe = (start_set, stop_keys, len(self._parents_map))
         body = self._serialise_search_recipe(recipe)
         path = self.bzrdir._path_for_remote_call(self._client)
         for key in keys:



More information about the bazaar-commits mailing list