git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
* A couple issues with check-connectivity on fetch
@ 2021-05-02 21:53 Mike Hommey
  0 siblings, 0 replies; only message in thread
From: Mike Hommey @ 2021-05-02 21:53 UTC (permalink / raw)
  To: git

Hi,

In the context of a remote helper using the `import` capability, or one
using the `fetch` capability but the without `check-connectivity`
capability, a large amount of time may be spent in check_connected() on
fetch, on large repos with a large number of fetched refs that also
happen not to actually add commits.

[A little bit of background: in git-cinnabar, which allows to talk to
Mercurial repositories, tags are fetched from a different remote, so
when one wants to fetch tags, the transport system never calls `import`
because the `list` ended up giving a large list of refs with resolved
sha1s, all of which are already locally available]

The first thing I noticed is that check_connected() is called twice
during the fetch: once from check_exist_and_connected(), and once from
store_updated_refs(). When each call is slow, it makes things doubly so.
I'm not sure why check_connected() is called twice like this.  It seems
it could be an oversight, but I could be missing something.

The second thing is that git-cinnabar uses the `import` capability,
and in that case, the transport layer never tried to use the
`check-connectivity` capability. I'm not sure whether the capability
should be exposed there, or if the checks should be skipped altogether
assuming `import` helpers use `fast-import` (although, technically,
git-cinnabar doesn't use the one provided by git).

But in any case, the `check-connectivity` capability doesn't actually
matter because no `fetch` or `import` even happens: fetch only does a
`list` and uses that result. In this case, it would seem
`check_connected` should be skipped entirely.

Here is a testcase that takes >20s to fetch on my machine (see
instructions at the beginning of the file)
http://glandium.org/files/git-check-connectivity-testcase
(the equivalent takes > 1 minute with git-cinnabar because of the
extra refs for git-cinnabar's metadata ; note the testcase is using
the `fetch` capability)

A workaround is to create temporary refs for those tags. That makes
check_connected()'s git-rev-list work quickly, and the fetch takes < 1s.

I'm ready to send patches to improve the situation, but I wanted some
feedback first about the right things that would need to change.

Thoughts?

Mike

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-02 22:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-02 21:53 A couple issues with check-connectivity on fetch Mike Hommey

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/inbox.comp.version-control.git
	nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.version-control.git
	nntp://4uok3hntl7oi7b4uf4rtfwefqeexfzil2w6kgk2jn5z2f764irre7byd.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git