At Fri, 22 Oct 2021 02:10:21 +0900, Fujii Masao <masao.fu...@oss.nttdata.com> wrote in > Even in prior to the commit, pgstat_shutdown_hook() can be called > before ProcKill() at the backend exit, so ISTM that the problem can > be reproduced. > > Probably we need to make sure that pgstat_shutdown_hook() is called > after ProcKill(), e.g., by registering pgstat_shutdown_hook() into
Considering the coming shared-memory based stats collector, pgstat must be shutdown before shared memory shutdown. Every operation that requires stats collector also must be shut down before the pgstat shutdown. A naive solution would be having before-pgstat-shutdown hook but I'm not sure it's the right direction. > on_proc_exit_list (I'm not sure if this change is safe, though). > Or maybe pgstat logic for replication slot drop needs to be > overhauled. I think we don't want to lose the stats numbers of the to-be-dropped slot. So the slot-drop must happen before pgstat shutdown. regards. -- Kyotaro Horiguchi NTT Open Source Software Center