From: Patrick Steinhardt <ps@pks.im>
To: Christian Couder <christian.couder@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/4] odb/source-files: reload alternates on retry
Date: Fri, 23 Oct 2026 13:57:25 +0200 [thread overview]
Message-ID: <attLpY_V0uOZzGII@pks.im> (raw)
In-Reply-To: <CAP8UFD0woTHVqy0cXtWJCL9Pt_jqWXT3m0bN=LufOQ_zJaKeAA@mail.gmail.com>
On Wed, Oct 21, 2026 at 04:32:34PM +0200, Christian Couder wrote:
> On Tue, Oct 20, 2026 at 11:01 AM Patrick Steinhardt <ps@pks.im> wrote:
>
> > diff --git a/odb/source-files.c b/odb/source-files.c
> > index d31da6e5d9..86f3fd1136 100644
> > --- a/odb/source-files.c
> > +++ b/odb/source-files.c
> > @@ -425,6 +425,7 @@ static enum odb_read_status odb_source_files_read_object_info(struct odb_source
> > struct strbuf *errmsg)
> > {
> > struct odb_source_files *files = odb_source_files_downcast(source);
> > + struct odb_files_dir **tail = NULL;
> > enum odb_read_status status = ODB_READ_NOT_FOUND;
> > enum odb_read_status ret;
> > bool retry = false;
> > @@ -448,10 +449,11 @@ static enum odb_read_status odb_source_files_read_object_info(struct odb_source
> > status = ret;
> > }
> >
> > - for (struct odb_files_dir *dir = files->dirs; dir; dir = dir->next) {
> > - if (retry)
> > - break;
> > -
> > + /*
> > + * When we have reprepared alternates then we only re-scan directories
> > + * that were newly added.
> > + */
> > + for (struct odb_files_dir *dir = tail ? *tail : files->dirs; dir; dir = dir->next) {
> > ret = odb_source_read_object_info(&dir->loose->base, oid, oi, flags,
> > status == ODB_READ_NOT_FOUND ? errmsg : NULL);
> > if (!ret)
> > @@ -461,6 +463,8 @@ static enum odb_read_status odb_source_files_read_object_info(struct odb_source
> > }
> >
> > if (!retry && !(flags & OBJECT_INFO_QUICK)) {
> > + tail = files->dirs_tail;
> > + prepare_alternates(files, NULL);
>
> This calls `read_alternates(files->dirs->abspath, ...)`, but when we
> use a temporary primary directory, `files->dirs` is that temporary
> primary directory. The prepare_alternates() call will then quietly
> find nothing new because temporary primary directories have no
> alternates.
*sigh* True. I really wish that this in-place modification of dirs just
went away entirely. But that's a bigger change to make.
[snip]
> I wonder if it would be better to always reload the repository's real
> alternates, instead of `files->dirs`'s alternates. This way, objects
> that moved to an alternate would still be found, not only during a
> receive-pack like before 5946a564cd, but whenever a temporary primary
> directory is used.
Yeah, we should probably use `files->base.path` instead.
Thanks!
Patrick
next prev parent reply other threads:[~2026-10-23 11:57 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 8:54 [PATCH 0/4] odb/files: reload alternates on retry again Patrick Steinhardt
2026-10-20 8:54 ` [PATCH 1/4] odb/source-files: rename alternates-related functions Patrick Steinhardt
2026-10-20 8:54 ` [PATCH 2/4] odb/source-files: reload alternates on retry Patrick Steinhardt
2026-10-21 14:32 ` Christian Couder
2026-10-23 11:57 ` Patrick Steinhardt [this message]
2026-10-20 8:54 ` [PATCH 3/4] odb/source-files: avoid rechecking already-known alternates Patrick Steinhardt
2026-10-20 8:54 ` [PATCH 4/4] odb/source-files: only reload alternates when the file has changed Patrick Steinhardt
2026-10-20 19:59 ` Junio C Hamano
2026-10-21 10:17 ` Patrick Steinhardt
2026-10-23 12:47 ` [PATCH v2 0/6] odb/files: reload alternates on retry again Patrick Steinhardt
2026-10-23 12:48 ` [PATCH v2 1/6] odb/source-files: rename alternates-related functions Patrick Steinhardt
2026-10-23 12:48 ` [PATCH v2 2/6] odb/source-files: always load alternates via primary object directory Patrick Steinhardt
2026-10-27 12:20 ` Christian Couder
2026-10-23 12:48 ` [PATCH v2 3/6] odb/source-files: reload alternates on retry Patrick Steinhardt
2026-10-23 12:48 ` [PATCH v2 4/6] odb/source-files: simplify directory duplication detection Patrick Steinhardt
2026-10-27 12:13 ` Christian Couder
2026-10-27 13:14 ` Patrick Steinhardt
2026-10-23 12:48 ` [PATCH v2 5/6] odb/source-files: avoid stat'ing already-known alternates Patrick Steinhardt
2026-10-27 12:36 ` Christian Couder
2026-10-27 13:14 ` Patrick Steinhardt
2026-10-27 14:31 ` Christian Couder
2026-10-28 7:08 ` Patrick Steinhardt
2026-10-23 12:48 ` [PATCH v2 6/6] odb/source-files: only reload alternates when the file has changed Patrick Steinhardt
2026-10-27 11:22 ` Christian Couder
2026-10-27 13:15 ` Patrick Steinhardt
2026-10-27 12:43 ` [PATCH v2 0/6] odb/files: reload alternates on retry again Christian Couder
2026-10-28 7:11 ` [PATCH v3 " Patrick Steinhardt
2026-10-28 7:11 ` [PATCH v3 1/6] odb/source-files: rename alternates-related functions Patrick Steinhardt
2026-10-28 7:11 ` [PATCH v3 2/6] odb/source-files: always load alternates via primary object directory Patrick Steinhardt
2026-10-28 7:11 ` [PATCH v3 3/6] odb/source-files: reload alternates on retry Patrick Steinhardt
2026-10-28 7:11 ` [PATCH v3 4/6] odb/source-files: simplify directory duplication detection Patrick Steinhardt
2026-10-28 8:59 ` Christian Couder
2026-10-28 9:07 ` Patrick Steinhardt
2026-10-28 16:27 ` Junio C Hamano
2026-10-28 7:11 ` [PATCH v3 5/6] odb/source-files: avoid stat'ing already-known alternates Patrick Steinhardt
2026-10-28 7:11 ` [PATCH v3 6/6] odb/source-files: only reload alternates when the file has changed Patrick Steinhardt
2026-10-28 16:12 ` [PATCH v3 0/6] odb/files: reload alternates on retry again Junio C Hamano
2026-10-29 8:37 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=attLpY_V0uOZzGII@pks.im \
--to=ps@pks.im \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox