Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f3d23d8

Browse files
committed
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
1 parent ac3a486 commit f3d23d8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,9 @@ pgstat_initialize(void)
29002900
MyBEEntry = &BackendStatusArray[MaxBackends + MyAuxProcType];
29012901
}
29022902

2903+
/* Initialize SLRU statistics to zero */
2904+
memset(&SLRUStats, 0, sizeof(SLRUStats));
2905+
29032906
/* Set up a process-exit hook to clean up */
29042907
on_shmem_exit(pgstat_beshutdown_hook, 0);
29052908
}

0 commit comments

Comments
 (0)