From: Taylor Blau <me@ttaylorr.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/5] pack-bitmap: tag bitmapped packs with their corresponding MIDX
Date: Tue, 17 Sep 2024 05:58:09 -0400 [thread overview]
Message-ID: <ZulSsfi/XouIlWtq@nand.local> (raw)
In-Reply-To: <20240905090024.GA2556395@coredump.intra.peff.net>
On Thu, Sep 05, 2024 at 05:00:24AM -0400, Jeff King wrote:
> On Thu, Aug 29, 2024 at 02:58:19PM -0400, Taylor Blau wrote:
>
> > On Tue, Aug 27, 2024 at 05:14:14PM -0700, Junio C Hamano wrote:
> > > > diff --git a/midx.c b/midx.c
> > > > index ca98bfd7c6..67e0d64004 100644
> > > > --- a/midx.c
> > > > +++ b/midx.c
> > > > @@ -496,6 +496,7 @@ int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m,
> > > > MIDX_CHUNK_BITMAPPED_PACKS_WIDTH * local_pack_int_id +
> > > > sizeof(uint32_t));
> > > > bp->pack_int_id = pack_int_id;
> > > > + bp->from_midx = m;
> > >
> > > Do multi_pack_index objects live as long as bitmapped_pack objects
> > > that point at them live? If m later goes away without letting the
> > > bitmapped_pack know about it, the borrowed pointer in from_midx
> > > would become dangling, which is not what we want to see.
> > >
> > > "None of these objects are released or relocated while we are
> > > running pack-objects, so once the .from_midx member is assigned
> > > here, it will always be pointing at a valid multi_pack_index object"
> > > is a satisfactory answer, I guess.
> >
> > Good question, and good answer ;-).
> >
> > This is only relevant in a read-only path where we're generating a new
> > pack from existing packs and not altering those pack or rewriting /
> > deleting the MIDX attached to them. So I think we're OK here and don't
> > have any lifetime/scope issues.
>
> Do we ever close/reopen the midx? For example, if a simultaneous process
> wrote a new one and we triggered reprepare_packed_git()?
>
> I think the answer is "no"; we might read a new midx, but we never ditch
> the old one (just like we do for packed_git structs). Which I suspect is
> needed even before this patch, since various other parts of the bitmap
> code (and probably others) rely on the struct staying in place across as
> we read many objects.
I think that we *could* close and reopen the MIDX via a call to
close_object_store() (which dispatches a call to close_midx(), before
NULL-ing out o->multi_pack_index) and then calling prepare_packed_git()
or similar.
But I'm not aware of any such codepaths that deal with pack reuse and
calling nth_bitmapped_pack that would do such a thing, so I think that
we're OK here.
Thanks,
Taylor
next prev parent reply other threads:[~2024-09-17 9:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-27 21:13 [PATCH 0/5] pack-objects: brown-paper-bag fixes for multi-pack reuse Taylor Blau
2024-08-27 21:13 ` [PATCH 1/5] t/t5332-multi-pack-reuse.sh: verify pack generation with --strict Taylor Blau
2024-08-27 21:13 ` [PATCH 2/5] pack-bitmap: tag bitmapped packs with their corresponding MIDX Taylor Blau
2024-08-28 0:14 ` Junio C Hamano
2024-08-29 18:58 ` Taylor Blau
2024-09-05 9:00 ` Jeff King
2024-09-17 9:58 ` Taylor Blau [this message]
2024-08-27 21:13 ` [PATCH 3/5] builtin/pack-objects.c: translate bit positions during pack-reuse Taylor Blau
2024-09-04 18:18 ` Junio C Hamano
2024-08-27 21:13 ` [PATCH 4/5] pack-bitmap.c: avoid repeated `pack_pos_to_offset()` during reuse Taylor Blau
2024-09-04 18:54 ` Junio C Hamano
2024-09-04 19:28 ` Taylor Blau
2024-08-27 21:13 ` [PATCH 5/5] builtin/pack-objects.c: do not open-code `MAX_PACK_OBJECT_HEADER` Taylor Blau
2024-09-04 18:56 ` [PATCH 0/5] pack-objects: brown-paper-bag fixes for multi-pack reuse Junio C Hamano
2024-09-04 19:28 ` Taylor Blau
2024-09-05 9:10 ` Jeff King
2024-09-05 15:21 ` Junio C Hamano
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=ZulSsfi/XouIlWtq@nand.local \
--to=me@ttaylorr.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
/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;
as well as URLs for NNTP newsgroup(s).