Re: Function to track shmem reinit time - Mailing list pgsql-hackers

From Tomas Vondra
Subject Re: Function to track shmem reinit time
Date
Msg-id f6f6e258-3184-3aca-d087-721a72f33de2@2ndquadrant.com
Whole thread Raw
In response to Function to track shmem reinit time  (Anastasia Lubennikova <a.lubennikova@postgrespro.ru>)
Responses Re: Function to track shmem reinit time  (Grigory Smolkin <g.smolkin@postgrespro.ru>)
Re: Function to track shmem reinit time  (David Steele <david@pgmasters.net>)
List pgsql-hackers
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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Function to track shmem reinit time
Next
From: Pavel Stehule
Date:
Subject: Re: Fwd: automatic disable unicode line style when terminal is not unicode