Thanks!

> FWIW, I'd vote for an helper comparing the five counters that can be
> flushed immediately. There are only five, and adding another one would
> already require updating the merge and baseline logic.
>
> That would keep the policy local to pgstat_relation_flush_cb() and avoid
> making PgStat_TableCounts field order part of the flush logic.

Fair point.

I was looking at it less as a one-off fix here and more as a reusable approach
for kinds that mix the two. I'd rather not end up with a
field-by-field compare in
every flush callback, and just keep it a single memcmp(). I went with grouping
the counters and comparing by offset mainly because it was the least
friction to
get there, although not the cleanest.

What about splitting the transaction-safe and non-transaction-safe counters
into two nested structs inside PgStat_TableCounts? That puts the boundary in
the type instead of an offset, and each group is still one memcmp().

> That said, let's see what Michael thinks.

+1

--
Sami Imseih
Amazon Web Services (AWS)


Reply via email to