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

Re: [PATCH] midx.c: clear auxiliary MIDX files first

From
Jeff King <peff@peff.net>
Date
Oct 26, 2022, 05:41 UTC
Message-ID
<Y1jIo1dPl0M2TSHo@coredump.intra.peff.net>
In-Reply-To
<bf36093cd6d7ac83b16241b0199b3a8c904e6774.1666722316.git.me@ttaylorr.com>
On Tue, Oct 25, 2022 at 02:25:20PM -0400, Taylor Blau wrote:
Show 12 quoted lines
> Since they were added in c528e17966 (pack-bitmap: write multi-pack
> bitmaps, 2021-08-31), the routine to remove MIDXs removed the
> multi-pack-index file itself before removing its associated .bitmap and
> .rev file(s), if any.
> 
> This creates a window where a MIDX's .bitmap file exists without its
> corresponding MIDX. If a reader tries to load a MIDX bitmap during that
> time, they will get a warning, and the MIDX bitmap code will gracefully
> degrade.
> 
> Remove this window entirely by removing the MIDX last, and removing its
> auxiliary files first.

We remove that window, but don't we create a new one where a reader may see the midx but not the bitmap? That won't generate a warning (it just looks like a midx that never had a bitmap generated), but it will cause the reader to follow the slow, non-bitmap path.

Ideally this would just be atomic, but short of stuffing the metadata into the same file, we can't do that. But the replacement of the midx file itself is atomic, and I'd think everything would (or should at least) follow from there.

I.e., why are we reading the midx bitmap without having opened the midx file? Ideally we'd be holding a descriptor for it.

-Peff
Previous: Taylor BlauNext: Derrick Stolee
Message 2 of 5 in “midx.c: clear auxiliary MIDX files first”
  1. midx.c: clear auxiliary MIDX files firstTaylor Blau, Oct 25, 2022
  2. Jeff KingOct 26, 2022
  3. Derrick StoleeOct 26, 2022
  4. Taylor BlauOct 26, 2022
  5. Jeff KingOct 27, 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.