Hi,

44539786b82 allowed a variable-numbered stats kind to use its own
dshash.  One remaining gap is that pgstat_drop_matching_entries() still
scans all variable-numbered stats hash tables, even when the caller
already knows which stats kind it wants.

This patch adds pgstat_drop_matching_entries_of_kind(), a form of
pgstat_drop_matching_entries() that takes a kind.  The existing per-hash
drop logic is moved to a static helper, so pgstat_drop_matching_entries()
keeps its current behavior by calling the helper without a kind filter.

Because pgStatLocal.kind_hash[kind] may be the shared variable stats
hash, the helper filters by kind before using the match callback.  A nice
side effect is that callers of the new function do not need to repeat the kind
check in their match callbacks.

The test_custom_stats module is adjusted so its existing named drop path
uses the new function with a small match callback.

--
Sami Imseih
Amazon Web Services (AWS)

Attachment: v1-0001-pgstat-Add-helper-to-drop-entries-from-a-stats-ki.patch
Description: Binary data

Reply via email to