git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Jeff King <peff@peff.net>
Cc: Taylor Blau <me@ttaylorr.com>,
	git@vger.kernel.org, gitster@pobox.com, derrickstolee@github.com
Subject: Re: [PATCH] midx.c: use `pack-objects --stdin-packs` when repacking
Date: Tue, 20 Sep 2022 16:35:45 -0400	[thread overview]
Message-ID: <YyokIf/Sd7SYztKQ@nand.local> (raw)
In-Reply-To: <YyodQg5diyr/UYK1@coredump.intra.peff.net>

On Tue, Sep 20, 2022 at 04:06:26PM -0400, Jeff King wrote:
> On Tue, Sep 20, 2022 at 03:49:07PM -0400, Taylor Blau wrote:
>
> > > Is that true also of "multi-pack-index repack"? I guess it would depend
> > > on how you invoke it. I admit I don't think I've ever used it myself,
> > > since the new "repack --geometric --write-midx" approach matches my
> > > mental model. I'm not sure when you'd actually run the "multi-pack-index
> > > repack" command. But if you did it with --batch-size=0 (the default), I
> > > think we'd end up traversing every object in history.
> >
> > We could probably benefit from it, but only if there is a MIDX bitmap
> > around to begin with. For instance, you could first try and lookup each
> > object you're missing a namehash for and then read its value out of the
> > hashcache extension in the MIDX bitmap (assuming the MIDX bitmap exists,
> > and has a hashcache).
> >
> > But if you don't have a MIDX bitmap, or it has a poor selection of
> > commits, then you're out of luck.
>
> You could also use a pack bitmap if there is one (and it's one of the
> included packs). But yes, if you have neither, it's no help.

Good point. But, yeah, you have to have them to begin with.

> Mostly I'm just concerned that this could have an outsized negative
> performance effect if you have a setup like:
>
>   - you have a gigantic repository, say that takes 15 minutes to do a
>     full "rev-list --objects" on (like linux.git with all its forks)
>
>   - most of that is in one big pack, but you acquire new packs
>     occasionally via pushes, etc
>
>   - doing "git repack --geometric" rolls up the new packs, nicely
>     traversing just the new objects
>
>   - doing "git multi-pack-index repack" before your patch is fast-ish.
>     It stuffs all the objects into a new pack. But after your patch, it
>     does that 15-minute traversal.
>
> But I don't know if that's even realistic, because I'm still wondering
> why somebody would run "git multi-pack-index repack" in the first place.
> And if they'd always do so with --batch-size anyway, which would
> mitigate this (because it gives a geometric-ish approach where we leave
> the huge pack untouched).

Yeah, the `--geometric` path(s) don't have this problem, because the big
pack will already be covered by either a pack or MIDX bitmap, and we can
read out all of the namehash values from there.

But I tend to agree that this is pretty unrealistic, so I'm hopeful that
it isn't a huge deal. If it is, though, we can always just "turn off"
the traversal parts. (Though I have to imagine that a repository large
enough to care about the existence of namehash values probably isn't
using `git multi-pack-index repack` anyway).

> Yeah, sorting the packs by mtime might be sensible. I know in the final
> midx, we use object order to find the "preferred" pack. And you could
> iterate the objects here, passing along their de-duped pack name. But I
> don't think we have the objects here in that useful order; that is
> really the order of the midx's .rev file, IIRC, and this is probably the
> actual sha1 order.

We already need the sorted order in order to compute the rollup for
non-zero `--batch-size` arguments, so using that to construct the pack
is just a matter of dragging the sort out of the function to compute the
rollup itself (and into `midx_repack()` instead).

Patches incoming... ;-)

Thanks,
Taylor

      reply	other threads:[~2022-09-20 20:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20  2:08 [PATCH] midx.c: use `pack-objects --stdin-packs` when repacking Taylor Blau
2022-09-20  2:14 ` Taylor Blau
2022-09-20 19:28 ` Jeff King
2022-09-20 19:49   ` Taylor Blau
2022-09-20 20:06     ` Jeff King
2022-09-20 20:35       ` Taylor Blau [this message]

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=YyokIf/Sd7SYztKQ@nand.local \
    --to=me@ttaylorr.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).