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

Re: git gc does not clean tmp_pack* files

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 19, 2024, 11:17 UTC
Message-ID
<xmqqmsgrncr6.fsf@gitster.g>
In-Reply-To
<CADMKT28cZcdW8UJ59vZHoMa0WEbyAccx4A10-jk3MiBkhZLxEg@mail.gmail.com>
Boomman <boomman37@gmail.com> writes:
> Yes, if the behavior in case of running out of disk space is to just
> leave the malformed file there, it stands to reason that cleaning up
> those malformed files should be the first operation to do for gc.

It is misleading to call them malformed, isn't it? When a Git process creates a packfile (or loose object file for that matter), they are written under these tmp_* names. When the processes die without finalizing these (either removing or renaming into their final names), they are left behind, and it would be better if we can remove it _before_ another process wants to consume more disk space.

But the issue is how you tell which one of these "malformed" files are still being written and will be finalized, and which ones are leftover ones. You want to remove the latter without molesting the former. And you want to do so in a portable way, possibly even across the network file systems.

I guess, as Peff alluded to, we could do at the beginning of "gc" to prune only these "possibly in progress, possibly leftover" files that are too old, repack the clearly "finalized" ones, and then prune again, this time including the "finalized" ones that are no longer in use, which would help the creation of new packfiles from being blocked by these leftover files that are hoarding disk quota.

Previous: BoommanNext: Jeff King
Message 4 of 8 in “git gc does not clean tmp_pack* files”
  1. BoommanDec 19, 2024
  2. Jeff KingDec 19, 2024
  3. BoommanDec 19, 2024
  4. Junio C HamanoDec 19, 2024
  5. Jeff KingDec 20, 2024
  6. BoommanDec 21, 2024
  7. Jeff KingDec 28, 2024
  8. BoommanDec 28, 2024

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.