git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] packfile.c: speed up loading lots of packfiles.

From
Jeff King <peff@peff.net>
Date
Dec 3, 2019, 15:34 UTC
Message-ID
<20191203153415.GA5813@sigill.intra.peff.net>
In-Reply-To
<20191203061744.GA74594@syl.local>
On Mon, Dec 02, 2019 at 10:17:44PM -0800, Taylor Blau wrote:
Show 14 quoted lines
> > Good catch. The issue is that we only add entries to the hashmap in
> > prepare_packed_git(), but they may be added to the pack list by other
> > callers of install_packed_git(). It probably makes sense to just push
> > the hashmap maintenance down into that function, like below. That
> > requires an extra strhash() when inserting a new pack, but I don't think
> > that's a big deal.
> 
> Ah, great catch, and thanks for pointing it out. We have been running
> this patch in production at GitHub for a few weeks now, but didn't
> notice this because we never run tests with
> 'GIT_TEST_MULTI_PACK_INDEX=1' in the environment.
> 
> Perhaps in the future that might change, but I think that for now that
> can explain why the failure wasn't noticed earlier.

It would trigger in other contexts, too: anywhere we call install_packed_git() outside of prepare_packed_git(). I think the main reason we didn't notice in the tests or in production is that:

  - it would generally require re-scanning the pack directory, which
    implies an unexpected missing object (or a racy repack), which is
    not likely to happen during the tests
  - in most cases duplicates don't impact the outcome of the command at
    all. A duplicate entry in the packed_git list would just mean an
    extra pack to check for lookups. Most objects would be found in
    other packs (including its doppelganger entry), so the duplicate
    would float to the bottom of the MRU order. It's only lookups for
    objects we don't have that would pay a penalty (and it would be
    relatively small).
But obviously it's still worth fixing.
-Peff
Previous: Taylor BlauNext: Junio C Hamano
Message 8 of 15 in “packfile.c: speed up loading lots of packfiles.”
  1. packfile.c: speed up loading lots of packfiles.Colin Stolley, Nov 27, 2019
  2. hashmap vs khash? Re: [PATCH] packfile.c: speed up loading lots of packfiles.Eric Wong, Nov 28, 2019
  3. Junio C HamanoNov 30, 2019
  4. Jeff KingDec 2, 2019
  5. SZEDER GáborDec 2, 2019
  6. Jeff KingDec 2, 2019
  7. Taylor BlauDec 3, 2019
  8. Jeff KingDec 3, 2019
  9. Junio C HamanoDec 3, 2019
  10. Colin StolleyDec 3, 2019
  11. Jeff KingDec 3, 2019
  12. Junio C HamanoDec 4, 2019
  13. Jeff KingDec 3, 2019
  14. Jonathan NiederDec 4, 2019
  15. Taylor BlauDec 3, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.