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

Re: [PATCH 1/4] odb: decouple source path comparisons from `the_repository`

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 12, 2026, 05:39 UTC
Message-ID
<anwG_yIy0eNsZi2n@pks.im>
In-Reply-To
<anuP0Mh9aBz9VdBK@denethor>
On Tue, Aug 11, 2026 at 05:04:58PM -0500, Justin Tobler wrote:
Show 21 quoted lines
> On 26/08/10 03:33PM, Patrick Steinhardt wrote:
> > When registering alternates we deduplicate object database sources by
> > their path so that the same source won't be added twice. Ever since
> > cf2dc1c238 (speed up alt_odb_usable() with many alternates, 2021-07-07)
> > this duplicate check is backed by a map keyed by the source's path,
> > using `fspathhash()` and `fspatheq()` as hash and equality functions,
> > respectively.
> > 
> > These functions are problematic in this context for two reasons:
> > 
> >   - They implicitly depend on `the_repository` instead of the
> >     repository that owns the object database.
> > 
> >   - They derive case-sensitivity from `repo_ignore_case()`, which
> >     returns a default value in case the repository's configuration has
> >     not been parsed yet. Object database sources may be registered
> >     before that is the case, so the answer may flip depending on when a
> >     source gets registered.
> 
> Are alternates currently always registered after repository
> configuration has been parsed? Or is this an existing bug?

They are, because of the lazy-loading. So this is not a bug, we merely have to ensure that we retain this behaviour.

Show 10 quoted lines
> > Overall it's quite debatable whether all of this complexity really is
> > worth it, or whether we should just linearly search through all sources
> > to find duplicates. But the mentioned commit cares about cases with
> > thousands of alternates, and a linear search would of course regress
> > performance quite a bit. This doesn't really feel like a reasonable case
> > to care about though, but I don't feel comfortable regressing it anyway.
> 
> Ya, my first though here was also whether all of this song and dance is
> really needed for alternates. There may be someone out there with tons
> of alternates I guess though. Probably good to be on the safe side.

cf2dc1c238 (speed up alt_odb_usable() with many alternates, 2021-07-07) mentions a repository with 100k alternates in total, but that's an artificial testing setup. I doubt you can get any kind of reasonable performance out of such a repository, regardless of whether on not parsing the alternates is going to be fast.

For now though I didn't want to remove this infra. It feels overblown, but it's not an unmaintainable mess, either.

Patrick
Previous: Justin ToblerNext: Patrick Steinhardt
Message 4 of 47 in “odb: eagerly load alternates”
  1. 0/4 odb: eagerly load alternatesPatrick Steinhardt, Aug 10, 2026
  2. 1/4 odb: decouple source path comparisons from `the_repository`Patrick Steinhardt, Aug 10, 2026
  3. Justin ToblerAug 11, 2026
  4. Patrick SteinhardtAug 12, 2026
  5. 2/4 odb: eagerly initialize alternatesPatrick Steinhardt, Aug 10, 2026
  6. Justin ToblerAug 11, 2026
  7. Patrick SteinhardtAug 12, 2026
  8. 3/4 odb: drop `loaded_alternates` fieldPatrick Steinhardt, Aug 10, 2026
  9. Justin ToblerAug 11, 2026
  10. 4/4 odb: drop `alternates_db` fieldPatrick Steinhardt, Aug 10, 2026
  11. Justin ToblerAug 11, 2026
  12. Patrick SteinhardtAug 12, 2026
  13. 0/4 odb: eagerly load alternatesPatrick Steinhardt, Aug 12, 2026
  14. 1/4 odb: decouple source path comparisons from `the_repository`Patrick Steinhardt, Aug 12, 2026
  15. Karthik NayakAug 13, 2026
  16. Patrick SteinhardtAug 13, 2026
  17. Karthik NayakAug 14, 2026
  18. Jeff KingAug 14, 2026
  19. Junio C HamanoAug 14, 2026
  20. Jeff KingAug 14, 2026
  21. Patrick SteinhardtAug 17, 2026
  22. Patrick SteinhardtAug 17, 2026
  23. Jeff KingAug 17, 2026
  24. Patrick SteinhardtAug 17, 2026
  25. Jeff KingAug 17, 2026
  26. Jeff KingAug 17, 2026
  27. Jeff KingAug 14, 2026
  28. Patrick SteinhardtAug 17, 2026
  29. 2/4 odb: eagerly initialize alternatesPatrick Steinhardt, Aug 12, 2026
  30. 3/4 odb: drop `loaded_alternates` fieldPatrick Steinhardt, Aug 12, 2026
  31. Karthik NayakAug 13, 2026
  32. 4/4 odb: drop `alternates_db` fieldPatrick Steinhardt, Aug 12, 2026
  33. Junio C HamanoAug 12, 2026
  34. Patrick SteinhardtAug 13, 2026
  35. Karthik NayakAug 13, 2026
  36. Justin ToblerAug 13, 2026
  37. 0/5 odb: eagerly load alternatesPatrick Steinhardt, Aug 17, 2026
  38. 1/5 setup: create ref and object databases after config is writtenPatrick Steinhardt, Aug 17, 2026
  39. Karthik NayakAug 20, 2026
  40. 2/5 odb: decouple source path comparisons from `the_repository`Patrick Steinhardt, Aug 17, 2026
  41. Junio C HamanoAug 20, 2026
  42. Patrick SteinhardtAug 21, 2026
  43. Junio C HamanoAug 21, 2026
  44. 3/5 odb: eagerly initialize alternatesPatrick Steinhardt, Aug 17, 2026
  45. 4/5 odb: drop `loaded_alternates` fieldPatrick Steinhardt, Aug 17, 2026
  46. 5/5 odb: drop `alternates_db` fieldPatrick Steinhardt, Aug 17, 2026
  47. Karthik NayakAug 20, 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.