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

Re: [PATCH 1/2] builtin/repack.c: simplify cruft pack aggregation

From
Elijah Newren <newren@gmail.com>
Date
Mar 4, 2025, 21:52 UTC
Message-ID
<CABPp-BGnbQdeSC=XUwTWOnr8=PiGMnt1Q0OXkUAzD=ZiaZoUhw@mail.gmail.com>
In-Reply-To
<Z8FrIfAj_oVwxz3X@pks.im>
On Thu, Feb 27, 2025 at 11:52 PM Patrick Steinhardt <ps@pks.im> wrote:
Show 34 quoted lines
>
> On Thu, Feb 27, 2025 at 01:29:28PM -0500, Taylor Blau wrote:
> > In 37dc6d8104 (builtin/repack.c: implement support for
> > `--max-cruft-size`, 2023-10-02), 'git repack' built on support for
> > multiple cruft packs in Git by instructing 'git pack-objects --cruft'
> > how to aggregate smaller cruft packs up to the provided threshold.
> >
> > The implementation in 37dc6d8104 worked something like the following
> > pseudo-code:
> >
> >     total_size = 0;
> >
> >     for (p in cruft packs) {
> >       if (p->pack_size + total_size < max_size) {
> >         total_size += p->pack_size;
> >         collapse(p)
> >       } else {
> >         retain(p);
> >       }
> >     }
> >
> > The original idea behind this approach was that smaller cruft packs
> > would get combined together until the sum of their sizes was no larger
> > than the given max pack size.
> >
> > There is a much simpler way to achieve this, however, which is to simply
> > combine *all* cruft packs which are smaller than the threshold,
> > regardless of what their sum is. With '--max-pack-size', 'pack-objects'
> > will split out the resulting pack into individual pack(s) if necessary
> > to ensure that the written pack(s) are each no larger than the provided
> > threshold.
>
> Hm. So the result would be a new set of packfiles where each of them is
> smaller than the threshold, right?

Are you assuming there's only one threshold, or that --max-pack-size == --max-cruft-size?

I read this assuming --max-pack-size >> --max-cruft-size, so the odds that the N packs smaller than --max-cruft-size add up to more than --max-pack-size is small -- but even if it does happen, it just results in the cruft packs being split out into a couple packs.

> Wouldn't that mean that the next time
> we'll again do the same thing and try to combine the new set of cruft
> packs into one, and basically never arrive at a state where we don't
> touch the cruft packs anymore?

This would be a risk if we allow --max-cruft-size to approach or be equal to --max-pack-size. (And if --max-pack-size is less than --max-cruft-size, then we'll perversely split into even more cruft packs rather than combining as intended.)

Previous: Patrick SteinhardtNext: Junio C Hamano
Message 6 of 54 in “pack-objects: freshen objects with multi-cruft packs”
  1. 0/2 pack-objects: freshen objects with multi-cruft packsTaylor Blau, Feb 27, 2025
  2. 1/2 builtin/repack.c: simplify cruft pack aggregationTaylor Blau, Feb 27, 2025
  3. Elijah NewrenFeb 27, 2025
  4. Taylor BlauFeb 27, 2025
  5. Patrick SteinhardtFeb 28, 2025
  6. Elijah NewrenMar 4, 2025
  7. Junio C HamanoMar 5, 2025
  8. Taylor BlauMar 5, 2025
  9. 2/2 builtin/pack-objects.c: freshen objects from existing cruft packsTaylor Blau, Feb 27, 2025
  10. Elijah NewrenFeb 27, 2025
  11. Taylor BlauFeb 27, 2025
  12. Elijah NewrenFeb 27, 2025
  13. Taylor BlauFeb 27, 2025
  14. 0/2 pack-objects: freshen objects with multi-cruft packsTaylor Blau, Mar 4, 2025
  15. 1/2 builtin/repack.c: simplify cruft pack aggregationTaylor Blau, Mar 4, 2025
  16. 2/2 builtin/pack-objects.c: freshen objects from existing cruft packsTaylor Blau, Mar 4, 2025
  17. Elijah NewrenMar 4, 2025
  18. Taylor BlauMar 5, 2025
  19. Taylor BlauMar 5, 2025
  20. 0/1 pack-objects: freshen objects with multi-cruft packsTaylor Blau, Mar 5, 2025
  21. 1/1 builtin/pack-objects.c: freshen objects from existing cruft packsTaylor Blau, Mar 5, 2025
  22. Patrick SteinhardtMar 6, 2025
  23. Taylor BlauMar 13, 2025
  24. Patrick SteinhardtMar 6, 2025
  25. 0/6 pack-objects: freshen objects with multi-cruft packsTaylor Blau, Mar 11, 2025
  26. 1/6 t/t5329-pack-objects-cruft.sh: evict 'repack'-related testsTaylor Blau, Mar 11, 2025
  27. 2/6 t7704-repack-cruft.sh: consolidate `write_blob()`Taylor Blau, Mar 11, 2025
  28. 3/6 t/lib-cruft.sh: extract some cruft-related helpersTaylor Blau, Mar 11, 2025
  29. 4/6 pack-objects: generate cruft packs at most one object over thresholdTaylor Blau, Mar 11, 2025
  30. Junio C HamanoMar 11, 2025
  31. Taylor BlauMar 12, 2025
  32. Junio C HamanoMar 12, 2025
  33. Taylor BlauMar 12, 2025
  34. Elijah NewrenMar 12, 2025
  35. Taylor BlauMar 12, 2025
  36. Junio C HamanoMar 12, 2025
  37. Elijah NewrenMar 12, 2025
  38. Junio C HamanoMar 13, 2025
  39. Elijah NewrenMar 13, 2025
  40. Junio C HamanoMar 13, 2025
  41. 5/6 builtin/repack.c: simplify cruft pack aggregationTaylor Blau, Mar 11, 2025
  42. 6/6 builtin/pack-objects.c: freshen objects from existing cruft packsTaylor Blau, Mar 11, 2025
  43. Junio C HamanoMar 11, 2025
  44. Taylor BlauMar 12, 2025
  45. Junio C HamanoMar 12, 2025
  46. Taylor BlauMar 12, 2025
  47. Junio C HamanoMar 12, 2025
  48. Taylor BlauMar 12, 2025
  49. Junio C HamanoMar 13, 2025
  50. Taylor BlauMar 13, 2025
  51. Jeff KingMar 13, 2025
  52. Junio C HamanoMar 13, 2025
  53. builtin/pack-objects.c: freshen objects from existing cruft packsTaylor Blau, Mar 13, 2025
  54. Junio C HamanoMar 13, 2025

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.