diff options
Diffstat (limited to 'src/backend/postmaster/pgstat.c')
-rw-r--r-- | src/backend/postmaster/pgstat.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 80a06e58ef2..0ecd29a1d99 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -2906,9 +2906,6 @@ pgstat_initialize(void) MyBEEntry = &BackendStatusArray[MaxBackends + MyAuxProcType]; } - /* Initialize SLRU statistics to zero */ - memset(&SLRUStats, 0, sizeof(SLRUStats)); - /* Set up a process-exit hook to clean up */ on_shmem_exit(pgstat_beshutdown_hook, 0); } @@ -6727,6 +6724,12 @@ pgstat_slru_name(int slru_idx) static inline PgStat_MsgSLRU * slru_entry(int slru_idx) { + /* + * The postmaster should never register any SLRU statistics counts; if it + * did, the counts would be duplicated into child processes via fork(). + */ + Assert(IsUnderPostmaster || !IsPostmasterEnvironment); + Assert((slru_idx >= 0) && (slru_idx < SLRU_NUM_ELEMENTS)); return &SLRUStats[slru_idx]; |