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

Re: Git packs friendly to block-level deduplication

From
Jeff King <peff@peff.net>
Date
Jan 25, 2018, 00:29 UTC
Message-ID
<20180125002942.GA21184@sigill.intra.peff.net>
In-Reply-To
<20180125001015.GA17856@sigill.intra.peff.net>
On Wed, Jan 24, 2018 at 07:10:15PM -0500, Jeff King wrote:
Show 20 quoted lines
> On Thu, Jan 25, 2018 at 01:03:25AM +0100, Ævar Arnfjörð Bjarmason wrote:
> 
> > > You may also want to use "--threads=1" to avoid non-determinism in the
> > > generated packs. In theory, both repos would then produce identical base
> > > packs, though it does not seem to do so in practice (I didn't dig in to
> > > what the different may be).
> > 
> > ..and north of 20% with --threads=1.
> >
> > [...]
> >
> > Thanks. I'll look into that, although the above results (sans hacking on
> > the core pack-objects logic) suggest that even once I create an island
> > I'm getting at most 20%.
> 
> I think it may be worth figuring out where the two differ. With
> --no-reuse-object and --no-reuse-delta, I'd think that the pack
> generated for a particular apex commit would be totally deterministic,
> regardless of other objects available in the repo. But it's not for some
> reason.

I think I see it. If I compare the objects in pack-order of the two packs:

  diff -u <(git show-index <$one | sort -n) <(git show-index <$two | sort -n)
I get:
  6281 fac64e011f1b1ecabcccf7ad2511efcac3e26bdc (9381a4f9)
  6585 59c276cf4da0705064c32c9dba54baefa282ea55 (1b02a1c0)
  6869 8279ed033f703d4115bee620dccd32a9ec94d9aa (ca7acf33)
 -7042 298d861208d71089dd308761ae96738e81ad3e68 (135aefd7)
 -7222 ea7b5de1c1187294d3d4dca93b129e049ca7ca76 (3708bbfc)
 -7512 b6947af2294ea0c814f5b4cb8737c782895519b2 (719fad14)
 -8004 e26f7f19b6c7485f04234946a59ab8f4fd21d6d1 (59127876)
 -8826 2512f15446149235156528dafbe75930c712b29e (fc72468e)
  [...]
 +7042 2512f15446149235156528dafbe75930c712b29e (fc72468e)
 +7215 c6c75c93aaeb97bab6fd25b672a641c84dd85d59 (68fe0b8d)
 +7391 36438dc19dd2a305dddebd44bf7a65f1a220075b (c424e726)
 +7565 1eaabe34fc6f486367a176207420378f587d3b48 (4a27450b)
So the write order differs; one pack stuck 2512f15446 much earlier.
That's probably due to this line from compute_write_order():
     /*
      * Mark objects that are at the tip of tags.
      */
     for_each_tag_ref(mark_tagged, NULL);

If I remove that line, then your manual pack (with --threads=1) gives me identical packs for each repo.

And if I then mark each with a .keep, then "git repack -ad" to remove duplicates, your block-dedup check yields:

   17742 2
    1939 1

which is 90%, and about what I'd expect between those two repos. So I think the idea of computing a "base" pack (either as a separate pack, or as a layer in the pack) is a viable strategy.

-Peff
Previous: Jeff King
Message 13 of 13 in “Git packs friendly to block-level deduplication”
  1. Ævar Arnfjörð BjarmasonJan 24, 2018
  2. Mike HommeyJan 24, 2018
  3. Junio C HamanoJan 24, 2018
  4. Mike HommeyJan 24, 2018
  5. Ævar Arnfjörð BjarmasonJan 24, 2018
  6. Eric WongJan 24, 2018
  7. Elijah NewrenJan 24, 2018
  8. Ævar Arnfjörð BjarmasonJan 24, 2018
  9. Jeff KingJan 24, 2018
  10. Jeff KingJan 24, 2018
  11. Ævar Arnfjörð BjarmasonJan 25, 2018
  12. Jeff KingJan 25, 2018
  13. Jeff KingJan 25, 2018

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.