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

Re: Race condition between repack and loose-objects maintenance task

From
Gregory Szorc <gregory.szorc@gmail.com>
Date
Jul 20, 2022, 01:41 UTC
Message-ID
<CAKQoGakg9+cvsHSepXyWFT9Jzg0_anq-YDBNZch95TnUAZ-Ohg@mail.gmail.com>
In-Reply-To
<Yr0XMWWyD5C9uhlb@nand.local>
On Wed, Jun 29, 2022 at 8:23 PM Taylor Blau <me@ttaylorr.com> wrote:
Show 23 quoted lines
>
> On Wed, Jun 29, 2022 at 11:19:09PM -0400, Taylor Blau wrote:
> > > However, I think there is yet another bug at play: running
> > > `incremental-repack` appears to be able to repack the cruft packfile.
> > > In doing so, it deletes its .mtimes file and the metadata inside.
> >
> > That sounds like a bug to me. I'll take a look into it and see what I
> > can find.
>
> I actually think that there are two bugs here.
>
> One is that we run a MIDX repack and expire, which could lead to us
> repacking the entire contents of the cruft pack and then expiring the
> metadata file. This is a bug, and we should exclude cruft packs from
> this computation.
>
> Another bug can happen when the cruft pack gets written into the MIDX
> and is MIDX-expireable (meaning that no objects are selected from the
> cruft pack). In that case, the `git multi-pack-index expire` step would
> remove the cruft pack entirely, which is also incorrect.
>
> I'll take a look at fixing both of these, and thanks for pointing them
> out!

For posterity, when I disabled cruft packfiles after having it enabled for a few weeks, the next `git gc` invocation on a high traffic repo resulted in >100k loose objects/files being created before they were summarily deleted by the GC's prune. This is significantly greater than the unreferenced object creation rate of the underlying repo. So it appears as if the MIDX stripping of the cruft packfile mtimes effectively disabled pruning, leading to a build-up of unreferenced objects.

Fortunately I hadn't deployed cruft packfiles to production. If I had, the excessive filesystem churn on NFS would have caused an incident due to degraded performance.

Since the interaction between cruft packfiles and MIDX appears to be buggy, I think I'm going to leave cruft packfiles disabled until these features work better together.

Previous: Ævar Arnfjörð Bjarmason
Message 16 of 16 in “Race condition between repack and loose-objects maintenance task”
  1. Gregory SzorcJun 29, 2022
  2. Taylor BlauJun 29, 2022
  3. Taylor BlauJun 29, 2022
  4. Gregory SzorcJun 29, 2022
  5. Taylor BlauJun 29, 2022
  6. Gregory SzorcJun 30, 2022
  7. Taylor BlauJun 30, 2022
  8. Taylor BlauJun 30, 2022
  9. Junio C HamanoJun 30, 2022
  10. Gregory SzorcJul 5, 2022
  11. Ævar Arnfjörð BjarmasonJul 6, 2022
  12. Gregory SzorcJul 20, 2022
  13. Ævar Arnfjörð BjarmasonJul 20, 2022
  14. Gregory SzorcJul 26, 2022
  15. Ævar Arnfjörð BjarmasonJul 26, 2022
  16. Gregory SzorcJul 20, 2022

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.