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

Re: Protecting old temporary objects being reused from concurrent "git gc"?

From
Matt McCutchen <matt@mattmccutchen.net>
Date
Nov 15, 2016, 19:12 UTC
Message-ID
<1479237172.2406.91.camel@mattmccutchen.net>
In-Reply-To
<20161115174028.zvohfcw4jse3jrmm@sigill.intra.peff.net>
On Tue, 2016-11-15 at 12:40 -0500, Jeff King wrote:
Show 24 quoted lines
> On Tue, Nov 15, 2016 at 12:33:04PM -0500, Matt McCutchen wrote:
> 
> > 
> > On Tue, 2016-11-15 at 12:06 -0500, Jeff King wrote:
> > > 
> > >  - when an object write is optimized out because we already have the
> > >    object, git will update the mtime on the file (loose object or
> > >    packfile) to freshen it
> > 
> > FWIW, I am not seeing this happen when I do "git read-tree --prefix"
> > followed by "git write-tree" using the current master (3ab2281).  See
> > the attached test script.
> 
> The optimization I'm thinking about is the one from write_sha1_file(),
> which learned to freshen in 33d4221c7 (write_sha1_file: freshen existing
> objects, 2014-10-15).
> 
> I suspect the issue is that read-tree populates the cache-tree index
> extension, and then write-tree omits the object write before it even
> gets to write_sha1_file(). The solution is that it should probably be
> calling one of the freshen() functions (possibly just replacing
> has_sha1_file() with check_and_freshen(), but I haven't looked).
> 
> I'd definitely welcome patches in this area.

Cool, it's nice to have an idea of what's going on.  I don't think I'm going to try to fix it myself though.

By the way, thanks for the fast response to my original question!
Matt
Previous: Matt McCutchenNext: Junio C Hamano
Message 6 of 13 in “Protecting old temporary objects being reused from concurrent "git gc"?”
  1. Matt McCutchenNov 15, 2016
  2. Jeff KingNov 15, 2016
  3. Matt McCutchenNov 15, 2016
  4. Jeff KingNov 15, 2016
  5. git-gc.txt: expand discussion of races with other processesMatt McCutchen, Nov 15, 2016
  6. Matt McCutchenNov 15, 2016
  7. Junio C HamanoNov 15, 2016
  8. Jeff KingNov 16, 2016
  9. Junio C HamanoNov 16, 2016
  10. Junio C HamanoNov 16, 2016
  11. Jeff KingNov 17, 2016
  12. Re* Protecting old temporary objects being reused from concurrent "git gc"?Junio C Hamano, Nov 17, 2016
  13. Jeff KingNov 17, 2016

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.