pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Martín Marqués <martin@2ndquadrant.com>
Cc: pgsql-bugs@lists.postgresql.org, PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Non-null values of recovery functions after promote or crash of primary
Date: Tue, 8 Oct 2019 14:03:02 -0400
Message-ID: <20191008180302.GP6962@tamriel.snowman.net> (raw)
In-Reply-To: <576b29e5-5edf-b4b7-bb73-7ffad63535e2@2ndquadrant.com>
References: <576b29e5-5edf-b4b7-bb73-7ffad63535e2@2ndquadrant.com>

Greetings,

* Martín Marqués (martin@2ndquadrant.com) wrote:
> pg_last_wal_receive_lsn()
> pg_last_wal_replay_lsn()
> pg_last_xact_replay_timestamp()
> 
> Under normal circumstances we would expect to receive NULLs from all
> three functions on a primary node, and code comments back up my thoughts.

Agreed.

> The problem is, what if the node is a standby which was promoted without
> restarting, or that had to perform crash recovery?
> 
> So during the time it's recovering the values in ` XLogCtl` are updated
> with recovery information, and once the recovery finishes, due to crash
> recovery reaching a consistent state, or a promotion of a standby
> happening, those values are not reset to startup defaults.
> 
> That's when you start seeing non-null values returned by
> `pg_last_wal_replay_lsn()`and `pg_last_xact_replay_timestamp()`.
> 
> Now, I don't know if we should call this a bug, or an undocumented
> anomaly. We could fix the bug by resetting the values from ` XLogCtl`
> after finishing recovery, or document that we might see non-NULL values
> in certain cases.

IMV, and not unlike other similar cases I've talked about on another
thread, these should be cleared when the system is promoted as they're
otherwise confusing and nonsensical.

Thanks,

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (3+ messages)  latest in thread

Message-ID: <20191008180302.GP6962@tamriel.snowman.net>
Permalink:  ../20191008180302.GP6962@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20191008180302.GP6962@tamriel.snowman.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: sfrost@snowman.net, martin@2ndquadrant.com, pgsql-hackers@postgresql.org
  Subject: Re: Non-null values of recovery functions after promote or crash of primary
  In-Reply-To: <20191008180302.GP6962@tamriel.snowman.net>
  References: <576b29e5-5edf-b4b7-bb73-7ffad63535e2@2ndquadrant.com> <20191008180302.GP6962@tamriel.snowman.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox