[MERGE] Reading pack-names triggers 3 reads
John Arbash Meinel
john at arbash-meinel.com
Tue Nov 11 01:18:45 GMT 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
...
> Yah, I can see the bug; interestingly it only matters because we assert
> that the offset is no larger than the size of the file (code isn't
> quoted here) - but the index header has enough data to tell use the
> total pages in the file. I think I'd be inclined to include the index
> size in future revisions, so that that can be done more cleanly. Perhaps
> a stat() rather than a get(), to determine the size.
>
> -Rob
Well, we don't have stat() over HTTP as I understand, which will cause
problems for accessing http pack repositories' pack-names file.
We could have it read just the first XX bytes, but we don't have a good
way to do that. Namely
1) get() reads the whole thing over http
2) get_bytes() reads the whole thing always
3) readv() fails if you ask for a range and it can't actually read that
many bytes.
4) HTTPTransport.stat() says not-allowed
So my feeling was that the fix is to minimize the number of times that
self._size is None, rather than hacking around it here. I don't know
your use case, but is there a reason you have enormous index files,
whose size you don't know and which you never will want to access over
an HTTP connection?
(One possibility is to add a Transport verb that allows a partial read
which is an upper-size rather than a required size, but that isn't
particularly nice.)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkkY3XUACgkQJdeBCYSNAANVrACfQfv+y8ZY0zdgXQ05NNRcKIN5
NXsAoL6xyDJC2cp4ALrBdakqPyjCJhnB
=zOH7
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list