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

Re: [PATCH 1/1] commit-graph.c: avoid unnecessary tag dereference when merging

From
Jeff King <peff@peff.net>
Date
Mar 24, 2020, 06:11 UTC
Message-ID
<20200324061159.GC610977@coredump.intra.peff.net>
In-Reply-To
<20200322154749.GB53402@syl.local>
On Sun, Mar 22, 2020 at 09:47:49AM -0600, Taylor Blau wrote:
Show 22 quoted lines
> > > [1] I'm actually not quite sure about correctness here. It should be
> > >     fine to generate a graph file without any given commit; readers will
> > >     just have to load that commit the old-fashioned way. But at this
> > >     phase of "commit-graph write", I think we'll already have done the
> > >     close_reachable() check. What does it mean to throw away a commit at
> > >     this stage? If we're the parent of another commit, then it will have
> > >     trouble referring to us by a uint32_t. Will the actual writing phase
> > >     barf, or will we generate an invalid graph file?
> >
> > It doesn't seem great. If I instrument Git like this to simulate an
> > object temporarily "missing" (if it were really missing the whole repo
> > would be corrupt; we're trying to see what would happen if a race causes
> > us to momentarily not see it):
> 
> This is definitely a problem on either side of this patch, which is
> demonstrated by the fact that you applied your changes without my patch
> on top (and that my patch isn't changing anything substantial in this
> area like removing the 'continue' statement).
> 
> Should we address this before moving on with my patch? I think that we
> *could*, but I'd rather go forward with what we have for now, since it's
> only improving the situation, and not introducing a new bug.

I do agree it's a problem before your patch. But I think your patch may make it a lot more common, if only because it means we'd _actually_ be dropping entries for objects that went away, instead of accidentally keeping them due to re-using the graph result. So it probably is worth trying to deal with it now, or at least thinking hard about it.

The trouble is that I'm not sure what _should_ happen. Aborting the whole commit-graph generation seems overboard (and would be annoying for cases where whole swaths of history became unreachable and went away; presumably we'd be dropping _all_ of those objects, and the write phase would be just fine). I have a feeling the correct solution is to do this merging pass earlier, before we check close_reachable(). Or if not a true merging pass, at least a pass to check which existing entries are still valid. But I don't know how painful that reordering would be.

-Peff
Previous: Taylor BlauNext: Taylor Blau
Message 22 of 31 in “commit-graph: avoid unnecessary tag deference when merging”
  1. 0/1 commit-graph: avoid unnecessary tag deference when mergingTaylor Blau, Mar 21, 2020
  2. 1/1 commit-graph.c: avoid unnecessary tag dereference when mergingTaylor Blau, Mar 21, 2020
  3. Jeff KingMar 21, 2020
  4. Taylor BlauMar 21, 2020
  5. Taylor BlauMar 21, 2020
  6. Jeff KingMar 21, 2020
  7. Taylor BlauMar 21, 2020
  8. Jeff KingMar 22, 2020
  9. SZEDER GáborMar 22, 2020
  10. looking up object types quickly, was Re: [PATCH 1/1] commit-graph.c: avoid unnecessary tag dereference when mergingJeff King, Mar 22, 2020
  11. Jeff KingMar 22, 2020
  12. Taylor BlauMar 23, 2020
  13. Taylor BlauMar 22, 2020
  14. Jeff KingMar 24, 2020
  15. Junio C HamanoMar 21, 2020
  16. Derrick StoleeMar 22, 2020
  17. Taylor BlauMar 22, 2020
  18. Derrick StoleeMar 22, 2020
  19. Jeff KingMar 22, 2020
  20. Jeff KingMar 22, 2020
  21. Taylor BlauMar 22, 2020
  22. Jeff KingMar 24, 2020
  23. Taylor BlauMar 24, 2020
  24. Jeff KingMar 27, 2020
  25. Taylor BlauMar 27, 2020
  26. Taylor BlauMar 22, 2020
  27. Jeff KingMar 24, 2020
  28. Junio C HamanoMar 21, 2020
  29. Junio C HamanoMar 21, 2020
  30. Jeff KingMar 21, 2020
  31. Taylor BlauMar 21, 2020

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.