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

Re: [PATCH] builtin/repack.c: avoid making cruft packs preferred

From
Jeff King <peff@peff.net>
Date
Oct 3, 2023, 20:16 UTC
Message-ID
<20231003201617.GE1562@coredump.intra.peff.net>
In-Reply-To
<19d9aae08eab05c6b5dda4c2090236b1c3f62998.1696349955.git.me@ttaylorr.com>
On Tue, Oct 03, 2023 at 12:27:51PM -0400, Taylor Blau wrote:
Show 13 quoted lines
> Note that this behavior is usually just a performance regression. But
> it's possible it could be a correctness issue.
> 
> Suppose an object was duplicated among the cruft and non-cruft pack. The
> MIDX will pick the one from the pack with the lowest mtime, which will
> always be the cruft one. But if the non-cruft pack happens to sort
> earlier in lexical order, we'll treat that one as preferred, but not all
> duplicates will be resolved in favor of that pack.
> 
> So if we happened to have an object which appears in both packs
> (e.g., due to a cruft object being freshened, causing it to appear
> loose, and then repacking it via the `--geometric` repack) it's possible
> the duplicate would be picked from the non-preferred pack.

I'm not sure I understand how that is a correctness issue. The contents of the object are the same in either pack. Or do you mean that the pack-reuse code in pack-objects.c may get confused and try to use the wrong pack/offset when sending the object out? I would think it would always be coming from the preferred pack for that code (so the outcome is just that we fail to do the pack-reuse optimization very well, but we don't generate a wrong answer).

Other than that, the explanation and patch make perfect sense to me, and the patch looks good.

-Peff
Previous: Taylor BlauNext: Taylor Blau
Message 5 of 10 in “builtin/repack.c: avoid making cruft packs preferred”
  1. builtin/repack.c: avoid making cruft packs preferredTaylor Blau, Oct 3, 2023
  2. Taylor BlauOct 3, 2023
  3. Junio C HamanoOct 3, 2023
  4. Taylor BlauOct 3, 2023
  5. Jeff KingOct 3, 2023
  6. Taylor BlauOct 3, 2023
  7. builtin/repack.c: avoid making cruft packs preferredTaylor Blau, Oct 3, 2023
  8. Jeff KingOct 4, 2023
  9. Patrick SteinhardtOct 5, 2023
  10. Eric SunshineOct 5, 2023

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.