[PATCH 0/4] odb/files: reload alternates on retry again
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Oct 20, 2026, 08:54 UTC
- Message-ID
- <20261020-pks-odb-files-reload-alternates-v1-0-d9e156323836@pks.im>
Hi,
we recently noticed that we don't reload alternates anymore when an object cannot be found. This used to be the case, but broke with 5946a564cd (odb/source: make `read_object_info()` function pluggable, 2026-03-05). And while it's a rather uncommon scenario that alternates are getting rewritten while a Git process runs we managed to hit some such scenarios in production systems.
In any case, this patch series fixes that. In practice, only the second commit is really needed to restore functionality. I was a bit unhappy about the performance impact of this change though, as fixing the logic regressed us from 180ms when looking up 20k missing objects to 309ms. So the last two patches do some optimizations that bring us down to 197ms.
The series is built on top of 47fdf2208c (The 7th batch, 2026-10-19) with ps/odb-files-alternates-cleanups at f211a3f0b5 (odb/source: drop `local` flag, 2026-10-15) merged into it.
Thanks!
Patrick
---
Patrick Steinhardt (4):
odb/source-files: rename alternates-related functions
odb/source-files: reload alternates on retry
odb/source-files: avoid rechecking already-known alternates
odb/source-files: only reload alternates when the file has changedodb/source-files.c | 84 +++++++++++++++++++++++++++++++---------------------- odb/source-files.h | 4 +++ t/t1006-cat-file.sh | 32 ++++++++++++++++++++ 3 files changed, 86 insertions(+), 34 deletions(-)
--- base-commit: c8e565497cff47f6b23a6b96bef6fa82afa11667 change-id: 20261014-pks-odb-files-reload-alternates-dfc6dc010122