[MERGE] Reduce the number of round trips required to create a repository over the network.
John Arbash Meinel
john at arbash-meinel.com
Thu Feb 19 14:45:00 GMT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> This includes a couple of separate branches so I couldn't get a good
> bundle out of it :)
>
> However they are small, so it shouldn't be an issue.
>
> Anyhow, with this, initial push of a trivial branch to a bzr+ssh server
> is now 75-100 round trips. Andrew and I should get the stream code
> integrated into our branch tomorrow, where we can see how much that
> reduces it (and it will certainly reduce the number of RPC calls for
> non-trivial branches, which is a *much* more interesting use case).
>
> -Rob
>
As mentioned earlier, I'm not fully sold on "network_name()", though I
certainly wouldn't block this sort of improvement on that.
I will say that:
=== modified file 'bzrlib/remote.py'
- --- bzrlib/remote.py 2009-02-13 00:52:18 +0000
...
def initialize(self, a_bzrdir, shared=False):
+ # Being asked to create on a non RemoteBzrDir:
Has become a very complex and somewhat convoluted function. With *lots*
of if/else etc.
I don't quite understand "self._custom_format" though I realize it has
existed from before. But that seems to add a lot to the complexity.
Would it be possible to just factor the "initialize" function into
several helpers? Like "_initialize_via_rpc", etc?
It seems like there should be some overlap between what you do if:
+ if not isinstance(a_bzrdir, RemoteBzrDir):
and
+ except errors.UnknownSmartMethod:
+ # Fallback - vfs methods
(In the former, you don't use an RPC because you don't have a smart
bzrdir, in the latter you don't use the RPC because it isn't available.
Both ways you are using VFS to initialize, which seems like it should be
the same code path.)
So in the end, I think this is a good improvement, and not necessarily
worth spending vast amounts of time cleaning up. However, I know that I
would find it difficult to maintain the "initialize()" logic, so it
would be nice if we could at least clean that up first.
I also had a question. Once you initialize() the remote repository, do
you get something back that you can work with? Or do you have to go
through the "Repository.open()" song and dance.
And one other way to decrease the number of round trips... initialize()
should return a write-locked repository. I don't think we want to invent
yet-another RPC for it. So for compatibility, perhaps the RPC could
return a write-locked one, which is then unlocked in the calling code.
And then once we get the rest of the code updated, we remove that.
Alternatively, add a flag to the RPC, so that when the clients are
smarter about handling new objects, we don't have to change the RPCs.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmdcGwACgkQJdeBCYSNAAN4LACg02C1XAKa+0l9mVi2dwYDPak3
R14AnijZmjgJnxkqQwfTE+xRqLIlr7oM
=5gA5
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list