[MERGE][bug #303538] Limit readv hunks to 100MB

John Arbash Meinel john at arbash-meinel.com
Mon Dec 1 23:28:48 GMT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It turns out that our _coalesce_offsets code already had the ability to
limit one range, but no callers were using it. max_size=0 was used to
indicate "unlimited", but it seems that you can get a 20GB pack
repository, and then unlimited is ~20GB, which is a bit too unlimited :).

This changes it to be 100MB, still large, so it shouldn't effect any
normal operations, but it gives some sort of cap to prevent us from
reading 20GB all at once.

It also changes RemoteTransport to fix a possible loophole. At the
moment the Remote code was saying "pack no more than 50 requests
together, and then break up those chunks into 5MB RPC requests" but if
each request was 10MB, it would still create a 500MB RPC. Now this
should help capping a single RPC to the size of 1 hunk, or possibly
10MB. (If two request ranges are 4.9MB, I think the combining code will
combine them since the first was still under the 5MB limit.)

I didn't add tests, as I wanted to do a quick fix (it has already taken
30min or so). I suppose we could factor out the constant into a class
variable, and then have a test that sets the value significantly lower
and then asserts the result.

Actually, we can't do a 'self' variable because _coalesce is a static
function, but I suppose we could use Transport._max_XXX.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkk0czAACgkQJdeBCYSNAAOSSACffNqHJkKWriYCy1s/z8ZPZjy9
GpgAoLPa6lD1YsFft67ATcHFn9FVsByp
=BuBp
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 303538_max_readv.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20081201/08ce12aa/attachment-0001.diff 


More information about the bazaar mailing list