git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: Jeff King <peff@peff.net>, git@vger.kernel.org
Cc: Taylor Blau <me@ttaylorr.com>
Subject: Re: [PATCH] check_everything_connected: assume alternate ref tips are valid
Date: Fri, 28 Jun 2019 08:51:04 -0400	[thread overview]
Message-ID: <601d8561-6e24-559c-6fbb-fa25a7389fa0@gmail.com> (raw)
In-Reply-To: <20190628101131.GA22862@sigill.intra.peff.net>

On 6/28/2019 6:11 AM, Jeff King wrote:
> When we receive a remote ref update to sha1 "X", we want to check that
> we have all of the objects needed by "X". We can assume that our
> repository is not currently corrupted, and therefore if we have a ref
> pointing at "Y", we have all of its objects. So we can stop our
> traversal from "X" as soon as we hit "Y".
> 
> If we make the same non-corruption assumption about any repositories we
> use to store alternates, then we can also use their ref tips to shorten
> the traversal.

I was confused by this paragraph, because I didn't know about
for_each_alternate_ref() and how refs_From_alternate_cb() will
strip the "/objects" and append "/refs" to check refs if they
exist. All of that logic is in transport.c but used by
fetch-pack.c and builtin/receive-pack.c. But now we are adding
to revision.c, so the restriction to "this helps data transfer"
is getting murkier.

Is this something that should be extracted to the object-store
layer? Or is it so tricky to use that we shouldn't make it too
easy to fall into a bad pattern?

> This is especially useful when cloning with "--reference", as we
> otherwise do not have any local refs to check against, and have to
> traverse the whole history, even though the other side may have sent us
> few or no objects. Here are results for the included perf test (which
> shows off more or less the maximal savings, getting one new commit and
> sharing the whole history):
> 
> Test                        HEAD^             HEAD
> --------------------------------------------------------------------
> [on git.git]
> 5600.3: clone --reference   2.94(2.86+0.08)   0.09(0.08+0.01) -96.9%
> [on linux.git]
> 5600.3: clone --reference   45.74(45.34+0.41)   0.36(0.30+0.08) -99.2%

It's really hard to argue with numbers like these. Kudos!

> 
> Signed-off-by: Jeff King <peff@peff.net>
> ---
>  Documentation/rev-list-options.txt |  8 ++++
>  connected.c                        |  1 +
>  revision.c                         | 30 +++++++++++++++
>  t/perf/p5600-clone-reference.sh    | 27 ++++++++++++++
>  t/t5618-alternate-refs.sh          | 60 ++++++++++++++++++++++++++++++

Other than the high-level questions above, the code and tests look
good to me.

Thanks,
-Stolee 


  parent reply	other threads:[~2019-06-28 12:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-28 10:11 [PATCH] check_everything_connected: assume alternate ref tips are valid Jeff King
2019-06-28 10:18 ` Jeff King
2019-06-28 12:51 ` Derrick Stolee [this message]
2019-06-29  7:43   ` Jeff King
2019-07-01 12:25     ` Derrick Stolee
2019-07-01 12:59       ` Jeff King
2019-07-01 13:17         ` Jeff King
2019-07-01 13:17           ` [PATCH 1/2] object-store.h: move for_each_alternate_ref() from transport.h Jeff King
2019-07-01 13:23             ` Derrick Stolee
2019-07-01 13:18           ` [PATCH v2 2/2] check_everything_connected: assume alternate ref tips are valid Jeff King
2019-07-03  9:12             ` SZEDER Gábor
2019-07-03 16:41               ` Jeff King
2019-07-03 16:46                 ` Junio C Hamano
2019-07-03 16:50                 ` SZEDER Gábor
2019-07-03 17:05                   ` Junio C Hamano
2019-07-01 17:02           ` [PATCH] " Taylor Blau
2019-07-02  5:29             ` Jeff King
2019-06-28 16:22 ` Junio C Hamano
2019-06-29  7:55   ` Jeff King
2019-07-01 12:26     ` Derrick Stolee

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=601d8561-6e24-559c-6fbb-fa25a7389fa0@gmail.com \
    --to=stolee@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=peff@peff.net \
    /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).