Re: [PATCH v2 14/24] pack-bitmap: write multi-pack bitmaps
From: Taylor Blau <hidden>
Date: 2021-07-27 20:33:04
On Tue, Jul 27, 2021 at 01:11:25PM -0400, Jeff King wrote:
On Mon, Jul 26, 2021 at 02:12:30PM -0400, Taylor Blau wrote:quoted
But it does mirror the behavior of our previous bitmap generation settings, which has been running for years. So... we could probably drop this hunk? I'd probably rather err on the safe side and leave this alone since it matches a system that we know to work well in practice.I'd rather drop it, if we think it's doing nothing. While I do value history in production as a sign of stability, upstream review is a good time to make sure we understand all of the "why", and to clean things up (e.g., another example is the questionable close_midx() stuff discussed elsewhere).
OK, I think that's a very reasonable way of thinking about it, so I'd rather just get rid of it (not to mention that I really doubt it's doing much of anything in the first place).
quoted
Luckily, any new packs will be loaded (and likewise have their indexes open, too), via the the add_pack_to_midx() callback that we pass as an argument to for_each_file_in_pack_dir().Hmm, OK. Your second paragraph makes it sound like we _don't_ need to do this. But the key is "new packs". In add_pack_to_midx() we skip any packs that are already in the existing midx, assuming they've already been added. And we probably must do that, otherwise we end up with duplicate structs that are not actually shared by ctx->m.
Exactly.
It's interesting that your earlier iteration didn't call open_pack_index(). Is it necessary, or not? From your description, it seems like it should be. But maybe some later step lazy-loads it? Even if so, I can see how prepare_midx_pack() would still be required (because we want to make sure we are using the same struct).
It's only necessary now (at least for determining a preferred pack if the caller didn't specify one with `--preferred-pack`) because we care about reading the `num_objects` field, which the index must be loaded for. Thanks, Taylor