.shared_data_off = offsetof(PgStatShared_IO, stats),
.shared_data_len = sizeof(((PgStatShared_IO *) 0)->stats),
- .flush_fixed_cb = pgstat_io_flush_cb,
- .have_fixed_pending_cb = pgstat_io_have_pending_cb,
+ .flush_static_cb = pgstat_io_flush_cb,
+ .have_static_pending_cb = pgstat_io_have_pending_cb,
.init_shmem_cb = pgstat_io_init_shmem_cb,
.reset_all_cb = pgstat_io_reset_all_cb,
.snapshot_cb = pgstat_io_snapshot_cb,
.shared_data_off = offsetof(PgStatShared_SLRU, stats),
.shared_data_len = sizeof(((PgStatShared_SLRU *) 0)->stats),
- .flush_fixed_cb = pgstat_slru_flush_cb,
- .have_fixed_pending_cb = pgstat_slru_have_pending_cb,
+ .flush_static_cb = pgstat_slru_flush_cb,
+ .have_static_pending_cb = pgstat_slru_have_pending_cb,
.init_shmem_cb = pgstat_slru_init_shmem_cb,
.reset_all_cb = pgstat_slru_reset_all_cb,
.snapshot_cb = pgstat_slru_snapshot_cb,
.shared_data_len = sizeof(((PgStatShared_Wal *) 0)->stats),
.init_backend_cb = pgstat_wal_init_backend_cb,
- .flush_fixed_cb = pgstat_wal_flush_cb,
- .have_fixed_pending_cb = pgstat_wal_have_pending_cb,
+ .flush_static_cb = pgstat_wal_flush_cb,
+ .have_static_pending_cb = pgstat_wal_have_pending_cb,
.init_shmem_cb = pgstat_wal_init_shmem_cb,
.reset_all_cb = pgstat_wal_reset_all_cb,
.snapshot_cb = pgstat_wal_snapshot_cb,
{
bool do_flush = false;
- /* Check for pending fixed-numbered stats */
+ /* Check for pending stats */
for (PgStat_Kind kind = PGSTAT_KIND_MIN; kind <= PGSTAT_KIND_MAX; kind++)
{
const PgStat_KindInfo *kind_info = pgstat_get_kind_info(kind);
if (!kind_info)
continue;
- if (!kind_info->fixed_amount)
- {
- Assert(kind_info->have_fixed_pending_cb == NULL);
- continue;
- }
- if (!kind_info->have_fixed_pending_cb)
+ if (!kind_info->have_static_pending_cb)
continue;
- if (kind_info->have_fixed_pending_cb())
+ if (kind_info->have_static_pending_cb())
{
do_flush = true;
break;
partial_flush = false;
- /* flush of variable-numbered stats */
+ /* flush of variable-numbered stats tracked in pending entries list */
partial_flush |= pgstat_flush_pending_entries(nowait);
- /* flush of fixed-numbered stats */
+ /* flush of other stats kinds */
for (PgStat_Kind kind = PGSTAT_KIND_MIN; kind <= PGSTAT_KIND_MAX; kind++)
{
const PgStat_KindInfo *kind_info = pgstat_get_kind_info(kind);
if (!kind_info)
continue;
- if (!kind_info->fixed_amount)
- {
- Assert(kind_info->flush_fixed_cb == NULL);
- continue;
- }
- if (!kind_info->flush_fixed_cb)
+ if (!kind_info->flush_static_cb)
continue;
- partial_flush |= kind_info->flush_fixed_cb(nowait);
+ partial_flush |= kind_info->flush_static_cb(nowait);
}
last_flush = now;
* Pending statistics data that will need to be flushed to shared memory
* stats eventually. Each stats kind utilizing pending data defines what
* format its pending data has and needs to provide a
- * PgStat_KindInfo->flush_pending_cb callback to merge pending into shared
- * stats.
+ * PgStat_KindInfo->flush_pending_cb callback to merge pending entries
+ * into the shared stats hash table.
*/
void *pending;
dlist_node pending_node; /* membership in pgStatPending list */
/*
* For variable-numbered stats: flush pending stats. Required if pending
- * data is used. See flush_fixed_cb for fixed-numbered stats.
+ * data is used. See flush_static_cb when dealing with stats data that
+ * that cannot use PgStat_EntryRef->pending.
*/
bool (*flush_pending_cb) (PgStat_EntryRef *sr, bool nowait);
void (*init_shmem_cb) (void *stats);
/*
- * For fixed-numbered statistics: Flush pending stats. Returns true if
- * some of the stats could not be flushed, due to lock contention for
- * example. Optional.
+ * For fixed-numbered or variable-numbered statistics: Flush pending stats
+ * entries, for stats kinds that do not use PgStat_EntryRef->pending.
+ *
+ * Returns true if some of the stats could not be flushed, due to lock
+ * contention for example. Optional.
*/
- bool (*flush_fixed_cb) (bool nowait);
+ bool (*flush_static_cb) (bool nowait);
/*
- * For fixed-numbered statistics: Check for pending stats in need of
- * flush. Returns true if there are any stats pending for flush. Optional.
+ * For fixed-numbered or variable-numbered statistics: Check for pending
+ * stats in need of flush with flush_static_cb, when these do not use
+ * PgStat_EntryRef->pending.
+ *
+ * Returns true if there are any stats pending for flush, triggering
+ * flush_static_cb. Optional.
*/
- bool (*have_fixed_pending_cb) (void);
+ bool (*have_static_pending_cb) (void);
/*
* For fixed-numbered statistics: Reset All.