git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Len Brown <lenb@kernel.org>
Cc: Daniel Barkalow <barkalow@iabervon.org>,
	Nicolas Pitre <nico@cam.org>, Theodore Tso <tytso@mit.edu>,
	git@vger.kernel.org
Subject: Re: warning: no common commits - slow pull
Date: Tue, 26 Feb 2008 21:12:45 -0800	[thread overview]
Message-ID: <7vir0byoc2.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200802261438.17014.lenb@kernel.org> (Len Brown's message of "Tue, 26 Feb 2008 14:38:16 -0500")

Len Brown <lenb@kernel.org> writes:

>> From git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
>>  * [new tag]         v2.6.25-rc2 -> v2.6.25-rc2
>> Updating 4ee29f6..101142c
>> Fast forward
>>  Makefile                               |    4 +-
> ...
>> [lenb@d975xbx2 linus (master)]$            
>> [lenb@d975xbx2 linus (master)]$ git --version
>> git version 1.5.4.1.122.gaa8d
>
> It still happens with latest git. (linus has declared -rc3 this time)

That's because nobody has touched anything in this area since your
last report.

But I now have a theory.

Next time this happens, could you run ls-remote for all four git
servers and compare them?

    $ LINUS=kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
    $ for i in 1 2 3 4; do git ls-remote git://git$i.$LINUS >git$i.txt; done

If my theory is correct, a workaround would be not to fetch from
git://git.kernel.org/ but from git://git$i.kernel.org/ for some value
of $i.

Now to the theory part.

Suppose the ancestry is like this:

         o (rc2)             o (rc3)
        /                   /
    ---A---o---o---o---o---B---o---o---o---C

And the event sequence is:

 (0) You are in sync with rc2 (have commits up to "A" and tag
     rc2);

 (1) Linus builds up to "B", tags rc3, pushes out to the master;

 (2) git1 and git2 mirror that history;

 (3) Linus builds up to "C", pushes out to the master;

 (4) git1 gets "C" but git2 mirror lags behind;

 (5) You fetch, which happens to first go to git1; you get "C"
     and learn that rc3 points at "B" that is locally reachable,
     but you do not have rc3 tag itself yet.  So git-fetch
     auto-follows (i.e. asks for "rc3" tag);

 (6) However, that goes over a separate connection, and you
     happen to hit git2, which does have "B" and rc3, but it
     does not have "C" yet.

 (7) You tell the other end "Hey, I have C", which git2 does not
     understand, because it hasn't seen the commit through the
     mirroring system yet.

Now, even if we are in the above situation, things _ought_ to work
(and I strongly suspect that the scripted git-fetch did work
correctly).  git2 would say "You have "C"?  I dunno that one, but keep
talking", and you will keep sending "I have this, this, this,...",
walking the ancestry chain down from C.  When you say "I also have B",
it would say "Aha, Ok, I heard enough to tell that rc3 tag is the only
thing I need to send to you".

However, if the current version of git-fetch has a bug in the
negotiation code when it auto-follows tags, that could throw this
conversation to compute what's common way off, and that is what I
suspect is happening.

For example, I notice that the list of old refs is reused (kept in the
transport structure) when it reconnects to a different instance of
git-upload-pack to auto-follow the tags, and never refreshed from the
actual remote end you are talking with.

This stale list of refs is passed all the way down to fetch_pack(),
representing _your_ idea of what they said they have, which does not
match the reality if you are connecting to a different host (via DNS
round robin).  Even if there is no DNS round robin issue, if an update
happened on the host between the time you fetched the refs from there
and you started a different instance of git-upload-pack for auto
follow the tags, the issue is the same (if you re-read the list of
refs from the new instance of upload-pack, you should be Ok, as the
upload-pack on the other end should be internally consistent).

Another possibile problem area I did not check is if the current
git-fetch takes care of clearing various mark bits used and left by
find_common() and get_rev() in builtin-fetch-pack.c during the main
transfer, before it initiates another round to auto follow the tags.
When we wrote fetch-pack the first time, we did not design it (most
importantly, find_common()) to be callable more than once, as cleaning
them was unnecessary overhead for the call-once-and-exit program.

The attached stops the stale set of refs from being used for common
ancestry computation.  It may or may not fix your issue, but at least
it should be more correct than what we currently have, I think.

diff --git a/builtin-fetch.c b/builtin-fetch.c
index ac335f2..c7cdd42 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -544,9 +544,16 @@ static int do_fetch(struct transport *transport,
 
 	fetch_map = ref_map;
 
-	/* if neither --no-tags nor --tags was specified, do automated tag
-	 * following ... */
+	/*
+	 * If neither --no-tags nor --tags was specified, do automated tag
+	 * following.
+	 */
 	if (tags == TAGS_DEFAULT && autotags) {
+		if (transport->remote_refs) {
+			struct ref *stale = (struct ref *)transport->remote_refs;
+			free_refs(stale);
+			transport->remote_refs = NULL;
+		}
 		ref_map = find_non_local_tags(transport, fetch_map);
 		if (ref_map) {
 			transport_set_option(transport, TRANS_OPT_DEPTH, "0");

  parent reply	other threads:[~2008-02-27  5:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-11  1:07 warning: no common commits - slow pull Len Brown
2008-02-11  1:44 ` Junio C Hamano
2008-02-17  3:52   ` Daniel Barkalow
2008-02-17 14:57     ` Johannes Schindelin
2008-02-17 17:46       ` Daniel Barkalow
2008-02-17 17:54       ` Junio C Hamano
2008-02-17 19:27         ` Johannes Schindelin
2008-02-17 20:41           ` Daniel Barkalow
2008-02-11  1:53 ` Theodore Tso
2008-02-11  2:39   ` Len Brown
2008-02-11  2:49   ` Junio C Hamano
2008-02-11  3:55     ` Theodore Tso
2008-02-15 21:43       ` Len Brown
2008-02-16 21:22         ` Johannes Schindelin
2008-02-25 21:59         ` Florian Weimer
2008-02-25 23:32           ` Daniel Barkalow
2008-02-26 19:38         ` Len Brown
2008-02-26 20:47           ` Nicolas Pitre
2008-02-26 23:45           ` Daniel Barkalow
2008-02-27  5:12           ` Junio C Hamano [this message]
2008-02-27  6:29             ` Junio C Hamano
2008-02-27 19:28               ` Daniel Barkalow
2008-02-27 20:53                 ` Junio C Hamano
2008-02-27 21:26                   ` Daniel Barkalow
2008-02-28  0:43                     ` Shawn O. Pearce
2008-02-28  8:50                       ` Shawn O. Pearce
2008-02-29 14:44                         ` Jon Loeliger
2008-02-29 17:14                           ` Daniel Barkalow
2008-02-28  0:47                     ` Junio C Hamano
2008-02-28 15:53                       ` Daniel Barkalow
2008-02-28 16:10                         ` [PATCH] Always use the current connection's remote ref list in git protocol Daniel Barkalow
2008-02-28 17:52                         ` warning: no common commits - slow pull Junio C Hamano
2008-02-28 18:36                           ` Daniel Barkalow
2008-02-11 15:54 ` Florian Weimer
2008-02-11 21:13   ` Nix
  -- strict thread matches above, loose matches on Subject: below --
2008-03-07  1:35 David Brownell
2008-03-08  1:22 ` Daniel Barkalow
2008-03-08 22:48   ` David Brownell
2008-03-08 22:58     ` Daniel Barkalow
2008-03-08 23:25       ` David Brownell
2008-03-08 23:27         ` Daniel Barkalow
2008-03-09 18:47           ` Daniel Barkalow
2008-03-10 17:18             ` David Brownell
2008-03-10 17:40               ` Daniel Barkalow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vir0byoc2.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=lenb@kernel.org \
    --cc=nico@cam.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).