| From: | Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com> | 
|---|---|
| To: | Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | Re: Function to track shmem reinit time | 
| Date: | 2018-03-04 16:17:32 | 
| Message-ID: | f6f6e258-3184-3aca-d087-721a72f33de2@2ndquadrant.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2018-03-04 16:19:27 | Re: Fwd: automatic disable unicode line style when terminal is not unicode | 
| Previous Message | Tom Lane | 2018-03-04 16:09:51 | Re: Function to track shmem reinit time |