Jeff King <peff@xxxxxxxx> writes: > On Wed, Apr 22, 2020 at 06:30:11AM -0400, Jeff King wrote: > >> So it really just seems like v2 does not try hard enough. I think the >> culprit is the MAX_IN_VAIN setting. If I do this: >> >> diff --git a/fetch-pack.c b/fetch-pack.c >> index 1734a573b0..016a413d49 100644 >> --- a/fetch-pack.c >> +++ b/fetch-pack.c >> @@ -46,7 +46,7 @@ static struct strbuf fsck_msg_types = STRBUF_INIT; >> * After sending this many "have"s if we do not get any new ACK , we >> * give up traversing our history. >> */ >> -#define MAX_IN_VAIN 256 >> +#define MAX_IN_VAIN 20000 >> >> static int multi_ack, use_sideband; >> /* Allow specifying sha1 if it is a ref tip. */ >> >> then I get that same 48k objects, 23MB fetch that v0 does. > > I don't quite think that's the solution, though. Both old and new are > supposed to be respecting MAX_IN_VAIN. So it's not at all clear to me > why it restricts the number of haves we'll send in v2, but not in v0. Thanks for digging. I tend to agree with your assessment that the setting should not make a difference, if v0 find the common out of the exchange within the same number of "have"s. I am guilty of introducing the hardcoded "give up after this many naks", which I admit I was never fond of, back in the days there was only one original protocol. In retrospect, I probably should have done "after this many naks, stop sending each and every commit but start skipping exponentially (or fibonacci)" instead. After all, this was meant to prevent walking all the way down to a different root commit when you have more of them than the repository you are fetching from---but (1) skipping exponentially down to root is way less expensive, even if it is a bit more expensive than not walking at all, and (2) if we find a common tree, even if it is distant, it is way better than not having any common tree at all. If we had such a code, however, it would probably have swept the real cause of the issue people are reporting under the rug, though.