On 02/28/2018 01:11 PM, Anastasia Lubennikova wrote: > > This new function can be periodiacally called by a monitoring agent, > and, if /shmem_init_time/ doesn't match /pg_postmaster_start_time,/ > we know that server crashed-restarted, and also know the exact time, > when. >
Actually, after looking at the code a bit, I think that test would not really work anyway, because those two timestamps come from two separate GetCurrentTimestamp calls, so you get this: test=# select pg_shmem_init_time(), pg_postmaster_start_time(); pg_shmem_init_time | pg_postmaster_start_time -------------------------------+------------------------------- 2018-03-04 17:10:59.017058+01 | 2018-03-04 17:10:59.022071+01 (1 row) test=# select pg_shmem_init_time() = pg_postmaster_start_time(); ?column? ---------- f (1 row) So there would have to be some sort of "fuzz" parameter when comparing the values, etc. Furthermore, the patch is yet another victim of fd1a421fe - fixing the pg_proc entries is trivial, but a new version is needed. I'd also like to see an example/explanation how this improves this situation compared to only having pg_postmaster_start_time. So I'm setting this as waiting on author for now. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services