From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Toon Claes <toon@iotcl.com>, git@vger.kernel.org
Subject: Re: [PATCH 6/6] packfile: skip closing packs marked as do-not-close
Date: Wed, 2 Dec 2026 10:10:56 +0100 [thread overview]
Message-ID: <aw_goIRqH1cvPsLF@pks.im> (raw)
In-Reply-To: <aw_ZErPswHh2Trcf@pks.im>
On Wed, Dec 02, 2026 at 09:38:45AM +0100, Patrick Steinhardt wrote:
> On Thu, Nov 26, 2026 at 11:56:28AM -0800, Junio C Hamano wrote:
> > Toon Claes <toon@iotcl.com> writes:
> >
> > > Junio C Hamano <gitster@pobox.com> writes:
> > >
> > >> Patrick Steinhardt <ps@pks.im> writes:
> > >>
> > >>> When closing a packfile to maintain the maximum number of open packs we
> > >>> completely ignore the `do_not_close` bit. That bit is only set by
> > >>> git-fast-import(1), and as that command allocates its packs manually it
> > >>> wouldn't add those packs to the list of all packfiles, and consequently
> > >>> we won't ever try to close such a packfile via `close_one_pack()`. But
> > >>> that feels like coincidence rather than proper design, and the result is
> > >>> rather fragile.
> > >>>
> > >>> Skip over packfiles marked as do-not-close to reduce the fragility. This
> > >>> should not result in a user-visible change in behaviour.
> > >>
> > >> Hmph. If the only user of the bit does not care that this codepath does
> > >> not honor the bit, perhaps a simpler alternative is to retire the bit
> > >> that nobody else uses? Or am I reading the above analysis incorrectly?
> > >
> > > Before this patch, there is one user of this bit: use_pack(). This
> > > function might open the pack to mmap() it, and close afterward, unless
> > > do_not_close is set.
> >
> > Yes, use_pack() may pay attention to it.
> >
> > But my point was that use_pack() may pay attention to the bit, but the
> > bit is set only by a caller that does not do use_pack() at all and
> > managed the packfiles itself, if I read the description correctly.
> >
> > So isn't it an obvious and simpler alternative solution to remove the
> > code from use_pack() to pay attention to this bit, remove the bit from
> > the interface, and tell fast-import that the bit no longer exists?
>
> I was kind of torn here myself. The question is whether this safeguard
> buys us anything, and how important it is that we indeed keep it. I'm
> mostly worried about a future refactoring that starts to reuse more of
> the machinery of "packfile.c" and that thus starts to honor the bit.
>
> I'm not sure how likely that is though. Overall, git-fast-import(1) is
> quite a mess with regards to how it writes its data, and it's completely
> incompatible with pluggable object databases because of that. We want to
> fix that, but that's likely going to result in a large refactoring
> anyway.
>
> So... yeah, I dunno. I guess it's probably fine to just remove this bit
> altogether?
I have spent some more time on this now, and the result is that we
actually need this bit because we _do_ call `use_pack()` via
`unpack_entry()`. So dropping it actually causes a bunch of test
failures, which is good.
I'll adapt the commit message accordingly.
Patrick
next prev parent reply other threads:[~2026-12-02 9:11 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 12:02 [PATCH 0/6] packfile: some lifecycle improvements Patrick Steinhardt
2026-11-20 12:02 ` [PATCH 1/6] builtin/fast-import: stop reporting packfile statistics Patrick Steinhardt
2026-11-24 20:43 ` Junio C Hamano
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-24 22:19 ` brian m. carlson
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-26 14:15 ` Toon Claes
2026-11-20 12:02 ` [PATCH 2/6] packfile: rename lifecycle functions Patrick Steinhardt
2026-11-24 23:47 ` Junio C Hamano
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-26 14:16 ` Toon Claes
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-20 12:02 ` [PATCH 3/6] packfile: inline `open_packed_git_1()` Patrick Steinhardt
2026-11-24 22:04 ` Junio C Hamano
2026-11-26 14:16 ` Toon Claes
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-26 14:16 ` Toon Claes
2026-11-26 20:39 ` Junio C Hamano
2026-11-20 12:02 ` [PATCH 4/6] packfile: introduce function to free a packfile Patrick Steinhardt
2026-11-24 21:34 ` Junio C Hamano
2026-11-26 14:13 ` Toon Claes
2026-11-26 20:41 ` Junio C Hamano
2026-12-02 8:38 ` Patrick Steinhardt
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-20 12:02 ` [PATCH 5/6] packfile: maintain process-wide limits globally Patrick Steinhardt
2026-11-24 23:24 ` Junio C Hamano
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-26 15:11 ` Toon Claes
2026-12-02 8:38 ` Patrick Steinhardt
2026-11-20 12:02 ` [PATCH 6/6] packfile: skip closing packs marked as do-not-close Patrick Steinhardt
2026-11-24 21:14 ` Junio C Hamano
2026-11-26 15:26 ` Toon Claes
2026-11-26 19:56 ` Junio C Hamano
2026-12-02 8:38 ` Patrick Steinhardt
2026-12-02 9:10 ` Patrick Steinhardt [this message]
2026-11-26 15:29 ` [PATCH 0/6] packfile: some lifecycle improvements Toon Claes
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=aw_goIRqH1cvPsLF@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=toon@iotcl.com \
/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