Hi, pgstat_prep_pending_entry() bundles three operations in a single call: lookup, entry creation, and pending data setup. This is convenient for the common case, but some callers need to do some other things in between these steps. For example, looking at what needs to be done for moving pg_stat_statements [1] to the cumulative statistics collector, it needs to:
1. Look up the entry (pgstat_get_entry_ref with create=false) 2. If not found, check capacity and possibly evict before creating 3. Create the entry (pgstat_get_entry_ref with create=true) 4. Attach pending data Steps 1-3 are already possible with pgstat_get_entry_ref(), but step 4 has no API. The attached adds pgstat_prep_pending() which exposes step 4 as a function. Together with pgstat_get_entry_ref(), callers can now perform the same work as pgstat_prep_pending_entry() in individual steps. pgstat_prep_pending_entry() itself is refactored to use the new function internally. [1] https://www.postgresql.org/message-id/flat/CAA5RZ0vZwR_dSK6fo0P2-EnskUVN0NjLHnGnJMFDPC8-kEW3sQ%40mail.gmail.com -- Sami Imseih Amazon Web Services (AWS)
v1-0001-pgstat-add-pgstat_prep_pending-for-entry-ref-pend.patch
Description: Binary data
