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

Re: [PATCH 3/5] odb/source-files: make the second read an implementation detail

From
Justin Tobler <jltobler@gmail.com>
Date
Oct 14, 2026, 15:37 UTC
Message-ID
<as-g2QdXl2zJkNoO@denethor>
In-Reply-To
<as8ne87RmBCl10ng@pks.im>
On 26/10/14 08:55AM, Patrick Steinhardt wrote:
Show 25 quoted lines
> On Tue, Oct 13, 2026 at 04:28:37PM -0500, Justin Tobler wrote:
> > On 26/10/13 09:36AM, Patrick Steinhardt wrote:
> > > Note that the "packed" source also used this flag to figure out whether
> > > it should try to surface an object via a packfile that should have the
> > > object as determined by a multi-pack index, but where the packfile has
> > > vanished. The multi-pack index is stale in that case, and that scenario
> > > should really only happen when the process is racing with a concurrent
> > > maintenance task.
> > > 
> > > This code is adapted to instead use `OBJECT_INFO_QUICK`, which means
> > > that the fallback may trigger on the first read already, but not in a
> > > case where callers know to handle false negatives already. In the worst
> > > case this could cause another scan through all packfiles covered by the
> > > multi-pack index. But that scan should be fast enough anyway, and it
> > > only triggers when we hit the race. So the effect thereof should be
> > > limited.
> > 
> > Would it be more correct to say that we are now using the absence of the
> > OBJECT_INFO_QUICK flag trigger the fallback?
> 
> I dunno. Whether we check for absence or presence, in either case we use
> the flag. So I'm inclined to leave this as-is as it starts to read a bit
> awkward otherwise.
> 
> Let me know in case you feel strongly though.

I don't feel too strongly either way. When I read it the first time, my first thought was that we were using the OBJECT_INFO_QUICK flag to mean the same thing as OBJECT_INFO_SECOND_READ which confused me. Then I realized it was in fact the exact opposite.

Show 24 quoted lines
> > > diff --git a/odb/source-files.c b/odb/source-files.c
> > > index 54235821d5..9788a5adf4 100644
> > > --- a/odb/source-files.c
> > > +++ b/odb/source-files.c
> > > @@ -444,6 +449,9 @@ static enum odb_read_status odb_source_files_read_object_info(struct odb_source
> > >  	}
> > >  
> > >  	for (struct odb_files_dir *dir = files->dirs; dir; dir = dir->next) {
> > > +		if (retry)
> > > +			break;
> > 
> > IIUC, we don't need to bother checking the loose objects a second time
> > so we exit the look early.
> > 
> > Nit: Mostly just a style preference, but instead of entering the loop
> > just to break out early for retries, could we just return early prior
> > the loop starting? It looks like the rest of the function is skipped on
> > the second read anyways.
> 
> Yes. But I've got a follow-up patch series that has some fixes for how
> we reload alternates, and as part of that I'll start to iterate over
> loose object directories that have been added after re-reading
> ".git/objects/info/alternates". So this is a bit awkward right now, but
> makes the follow-up series a bit easier.
Ok, this sounds reasonable to me.
-Justin
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 37 in “odb/files: cleanups and improvements for alternates”
  1. 0/5 odb/files: cleanups and improvements for alternatesPatrick Steinhardt, Oct 13, 2026
  2. 1/5 odb/source-files: fix performance when reading objects with alternatesPatrick Steinhardt, Oct 13, 2026
  3. Justin ToblerOct 13, 2026
  4. 2/5 odb/source-files: fix performance when streaming objects with alternatesPatrick Steinhardt, Oct 13, 2026
  5. Justin ToblerOct 13, 2026
  6. 3/5 odb/source-files: make the second read an implementation detailPatrick Steinhardt, Oct 13, 2026
  7. Justin ToblerOct 13, 2026
  8. Patrick SteinhardtOct 14, 2026
  9. Justin ToblerOct 14, 2026
  10. 4/5 odb: remove read loop for found objectsPatrick Steinhardt, Oct 13, 2026
  11. Justin ToblerOct 13, 2026
  12. Patrick SteinhardtOct 14, 2026
  13. Justin ToblerOct 14, 2026
  14. 5/5 odb/source: drop `local` flagPatrick Steinhardt, Oct 13, 2026
  15. Justin ToblerOct 13, 2026
  16. Patrick SteinhardtOct 14, 2026
  17. Justin ToblerOct 14, 2026
  18. Patrick SteinhardtOct 15, 2026
  19. 0/6 odb/files: cleanups and improvements for alternatesPatrick Steinhardt, Oct 14, 2026
  20. 1/6 odb/source-files: fix performance when reading objects with alternatesPatrick Steinhardt, Oct 14, 2026
  21. Johannes SchindelinOct 14, 2026
  22. Patrick SteinhardtOct 14, 2026
  23. 2/6 odb/source-files: fix performance when streaming objects with alternatesPatrick Steinhardt, Oct 14, 2026
  24. 3/6 odb/source-files: make the second read an implementation detailPatrick Steinhardt, Oct 14, 2026
  25. 4/6 odb: remove read loop for found objectsPatrick Steinhardt, Oct 14, 2026
  26. 5/6 odb: don't try re-fetching corrupt objectsPatrick Steinhardt, Oct 14, 2026
  27. Justin ToblerOct 14, 2026
  28. 6/6 odb/source: drop `local` flagPatrick Steinhardt, Oct 14, 2026
  29. 0/6 odb/files: cleanups and improvements for alternatesPatrick Steinhardt, Oct 15, 2026
  30. 1/6 odb/source-files: fix performance when reading objects with alternatesPatrick Steinhardt, Oct 15, 2026
  31. 2/6 odb/source-files: fix performance when streaming objects with alternatesPatrick Steinhardt, Oct 15, 2026
  32. 3/6 odb/source-files: make the second read an implementation detailPatrick Steinhardt, Oct 15, 2026
  33. 4/6 odb: remove read loop for found objectsPatrick Steinhardt, Oct 15, 2026
  34. 5/6 odb: don't try re-fetching corrupt objectsPatrick Steinhardt, Oct 15, 2026
  35. 6/6 odb/source: drop `local` flagPatrick Steinhardt, Oct 15, 2026
  36. Justin ToblerOct 15, 2026
  37. Junio C HamanoOct 16, 2026

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.