Re: [PATCH v3 2/2] reftable: fix quadratic behavior in the presence of tombstones
- From
Kristofer Karlsson <krka@spotify.com>
- Date
- Jul 10, 2026, 15:03 UTC
- Message-ID
- <CAL71e4POhVpQ9FvLmjUc4ex_=T-DuCd7cas1D4uzqzg3RyDw+Q@mail.gmail.com>
- In-Reply-To
- <alECc90WZ9RPqMaA@pks.im>
On Fri, 10 Jul 2026 at 16:32, Patrick Steinhardt <ps@pks.im> wrote:
Show 5 quoted lines
> > > This also requires adding deletion checks to the log iteration paths, > > since suppress_deletions applied to both ref and log iterators. > > Nit: s/applied/applies/
Language and using correct tense is always the tricky part -- will fix if a reroll is needed for other reasons.
> > + int suppress_deletions; > > A comment would've been nice, but I don't think this warrants a reroll.
Agreed, the field name felt self-documenting to me, but I will add a short comment if there is a reroll. Something like this? "boolean: filters out tombstoned/deleted refs early if true"
> > - new_merged->suppress_deletions = 1; > > + new_merged->suppress_deletions = st->opts.suppress_deletions; > > Yup, this looks good to me.
Thanks for the quick review.
Another thing I have been thinking about: should we consider suppress_deletions a temporary stopgap, with the goal of eventually removing it?
I took a look at libgit2's refdb_reftable.c to see what it would look like. It doesn't seem _too_ complicated (but I have been wrong about complexity before):
reftable_stack_read_ref() and reftable_stack_read_log() already check is_deletion() after the seek+next, so the call sites that use those would work correctly without suppress_deletions too. (I think?)
The other call sites that iterate would need the same type of filter as we have in this patch series.
So the total cost for libgit2 to stop relying on suppress_deletions would be fairly small and it would maybe also got a nice performance boost for the edge cases, though I have not attempted to verify that.
That said, it does not affect this patch - regardless of the future we will need this flag now.
Thanks, Kristofer