Re: [PATCH] commit-graph: retain commit slab when closing NULL commit_graph
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 11, 2024, 18:35 UTC
- Message-ID
- <xmqqedenhg5v.fsf@gitster.g>
- In-Reply-To
- <20240111075313.GF48154@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 14 quoted lines
> On Wed, Jan 10, 2024 at 08:38:18AM -0800, Junio C Hamano wrote: > >> > It should be easy-ish to iterate through the slab and look at the >> > commits that are mentioned in it. Though maybe not? Each commit knows >> > its slab-id, but I'm not sure if we have a master list of commits to go >> > the other way. >> >> We have table of all in-core objects, don't we? > > Oh, duh. Yes, we could iterate over obj_hash. I do think the "on demand" > version I showed later in the message is better, though, as the work > both scales with the number of affected commits (rather than the total > number of objects) and can be done lazily (so callers that are not buggy > pay no price at all).
Yeah, it is far more desirable than scanning obj_hash if we can do the right thing on lazily.
> So what if we just tried harder to look it up in the graph file (rather > than the slab) when we see COMMIT_NOT_FROM_GRAPH? And indeed, we even > have a function to do this already!
;-)
> but: > ... > I somehow sniped myself into thinking about it more, but that has only > reinforced my feeling that I'm afraid to touch it. ;)
Thanks for a nice summary.