diff options
author | Fujii Masao | 2020-05-13 13:19:25 +0000 |
---|---|---|
committer | Fujii Masao | 2020-05-13 13:19:25 +0000 |
commit | f3d23d83ef9a33344391acbaa92a6235a4350791 (patch) | |
tree | 70108cd98c07c2a69dfd024f23d1686db19b1eec | |
parent | ac3a4866c0bf1d7a14009f18d3b42ffcb063a7e9 (diff) |
Initialize SLRU stats entries to zero.
Previously since SLRUStats was not initialized, SLRU stats counters
could begin with non-zero value. Which could lead to incorrect results
in pg_stat_slru view.
Author: Fujii Masao
Reviewed-by: Tomas Vondra
Discussion: https://postgr.es/m/976bbb73-a112-de3c-c488-b34b64609793@oss.nttdata.com
-rw-r--r-- | src/backend/postmaster/pgstat.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 3f8105c6ebc..416f86fbd66 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -2900,6 +2900,9 @@ 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); } |