git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Wong <e@80x24.org>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>
Subject: [RFC] fetch: support hideRefs to speed up connectivity checks
Date: Thu, 9 Feb 2023 12:28:57 +0000	[thread overview]
Message-ID: <20230209122857.M669733@dcvr> (raw)

Not sure if this is the right way to go about this...
If it's close, maybe --exclude-hidden=fetch can be supported.
I'm using `receive' for now to minimize the change.

With roughly 800 remotes all fetching to their own refs/remotes/$REMOTE/*
island, the connectivity check[1] gets expensive for each fetch.

To do a no-op fetch on one $REMOTE out of hundreds, hideRefs now
allows the no-op fetch to take ~30 seconds instead of ~20 minutes
on a noisy, RAM-constrained machine (localhost, so no network latency):

   git -c transfer.hideRefs=refs \
	-c transfer.hideRefs='!refs/remotes/$REMOTE/' \
	fetch $REMOTE

I initially considered passing --negotiation-tip OIDs, but this seems
like an easier solution as I'm not yet familiar with this code
and prefer to avoid writing too much C.

[1] `git rev-list --objects --stdin --not --all --quiet --alternate-refs'
    gets painful w/o enough RAM to cache the repo, even on a SATA-2 SSD.
---
 builtin/fetch.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index 12978622d5..473d99fd26 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -1131,6 +1131,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 	if (!connectivity_checked) {
 		struct check_connected_options opt = CHECK_CONNECTED_INIT;
 
+		opt.exclude_hidden_refs_section = "receive";
 		rm = ref_map;
 		if (check_connected(iterate_ref_map, &rm, &opt)) {
 			rc = error(_("%s did not send all necessary objects\n"), url);
@@ -1324,6 +1325,7 @@ static int check_exist_and_connected(struct ref *ref_map)
 	}
 
 	opt.quiet = 1;
+	opt.exclude_hidden_refs_section = "receive";
 	return check_connected(iterate_ref_map, &rm, &opt);
 }
 

             reply	other threads:[~2023-02-09 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-09 12:28 Eric Wong [this message]
2023-02-10 21:49 ` [RFC] fetch: support hideRefs to speed up connectivity checks Jonathan Tan
2023-02-10 21:59   ` Eric Wong
2023-02-10 22:56 ` Junio C Hamano
2023-02-11  7:53   ` Eric Wong
2023-02-11 19:24     ` Junio C Hamano
2023-02-12  9:04 ` [PATCH v2] " Eric Wong
2023-02-13 20:53   ` Jeff King
2023-02-13 23:30     ` Philip Oakley
2023-02-14  1:40       ` Jeff King
2023-02-16  1:32         ` Eric Wong

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=20230209122857.M669733@dcvr \
    --to=e@80x24.org \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    /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).