Rev 4311: Enable caching of negative revision lookups in RemoteRepository write locks when no _real_repository has been constructed. in http://people.ubuntu.com/~robertc/baz2.0/pending/push.roundtrips

Robert Collins robertc at robertcollins.net
Tue Apr 28 07:53:32 BST 2009


At http://people.ubuntu.com/~robertc/baz2.0/pending/push.roundtrips

------------------------------------------------------------
revno: 4311
revision-id: robertc at robertcollins.net-20090428065329-vx84wza4w6l979ai
parent: robertc at robertcollins.net-20090428052904-sttkmasfldpxlq2m
committer: Robert Collins <robertc at robertcollins.net>
branch nick: push.roundtrips
timestamp: Tue 2009-04-28 16:53:29 +1000
message:
  Enable caching of negative revision lookups in RemoteRepository write locks when no _real_repository has been constructed.
=== modified file 'bzrlib/remote.py'
--- a/bzrlib/remote.py	2009-04-28 05:29:04 +0000
+++ b/bzrlib/remote.py	2009-04-28 06:53:29 +0000
@@ -605,6 +605,8 @@
         self._lock_token = None
         self._lock_count = 0
         self._leave_lock = False
+        # Cache of revision parents; misses are cached during read locks, and
+        # write locks when no _real_repository has been set.
         self._unstacked_provider = graph.CachingParentsProvider(
             get_parent_map=self._get_parent_map_rpc)
         self._unstacked_provider.disable_cache()
@@ -686,6 +688,7 @@
         invocation. If in doubt chat to the bzr network team.
         """
         if self._real_repository is None:
+            self._unstacked_provider.missing_keys.clear()
             self.bzrdir._ensure_real()
             self._set_real_repository(
                 self.bzrdir._real_bzrdir.open_repository())
@@ -892,7 +895,8 @@
                 self._leave_lock = False
             self._lock_mode = 'w'
             self._lock_count = 1
-            self._unstacked_provider.enable_cache(cache_misses=False)
+            cache_misses = self._real_repository is None
+            self._unstacked_provider.enable_cache(cache_misses=cache_misses)
         elif self._lock_mode == 'r':
             raise errors.ReadOnlyError(self)
         else:
@@ -1605,6 +1609,7 @@
 
     def insert_stream(self, stream, src_format, resume_tokens):
         target = self.target_repo
+        target._unstacked_provider.missing_keys.clear()
         if target._lock_token:
             verb = 'Repository.insert_stream_locked'
             extra_args = (target._lock_token or '',)

=== modified file 'bzrlib/tests/blackbox/test_push.py'
--- a/bzrlib/tests/blackbox/test_push.py	2009-04-28 03:55:56 +0000
+++ b/bzrlib/tests/blackbox/test_push.py	2009-04-28 06:53:29 +0000
@@ -217,7 +217,7 @@
         # being too low. If rpc_count increases, more network roundtrips have
         # become necessary for this use case. Please do not adjust this number
         # upwards without agreement from bzr's network support maintainers.
-        self.assertLength(16, self.hpss_calls)
+        self.assertLength(15, self.hpss_calls)
         remote = Branch.open('public')
         self.assertEndsWith(remote.get_stacked_on_url(), '/parent')
 




More information about the bazaar-commits mailing list