pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_stat_replication view
2+ messages / 2 participants
[nested] [flat]

* pg_stat_replication view
@ 2018-12-10 19:24 Jeff Janes <jeff.janes@gmail.com>
  2018-12-11 01:57 ` Re: pg_stat_replication view Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 2+ messages in thread

From: Jeff Janes @ 2018-12-10 19:24 UTC (permalink / raw)
  To: pgsql-general

I'm not sure if this is a documentation issue, or something else.

The description of the pg_stat_replication.state column gives:

* catchup: This WAL sender's connected standby is catching up with the
primary.

* streaming: This WAL sender is streaming changes after its connected
standby server has caught up with the primary.

What does this mean?  Is the standby "caught up" when it replays the LSN
which was current on the master as-of the time that the standby initiated
this connection?  Or is it caught up when the master receives at least one
notification that a certain LSN was replayed on the replica, and verifies
that no new WAL has been generated after that certain LSN was generated?
Neither of those things?

If a replica has caught up and then fallen behind again, is that different
from a user/dba perspective than if it never caught up in the first place?

Also, the docs say "Lag times work automatically for physical replication.
Logical decoding plugins may optionally emit tracking messages; if they do
not, the tracking mechanism will simply display NULL lag."  Does the
logical decoding plugin associated with built-in PUBLICATION/SUBSCRIPTION
mechanism introduced in v10 emit tracking messages?

Cheers,

Jeff

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pg_stat_replication view
  2018-12-10 19:24 pg_stat_replication view Jeff Janes <jeff.janes@gmail.com>
@ 2018-12-11 01:57 ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2018-12-11 01:57 UTC (permalink / raw)
  To: Jeff Janes <jeff.janes@gmail.com>; +Cc: pgsql-general

On Mon, Dec 10, 2018 at 02:24:43PM -0500, Jeff Janes wrote:
> What does this mean?  Is the standby "caught up" when it replays the LSN
> which was current on the master as-of the time that the standby initiated
> this connection?  Or is it caught up when the master receives at least one
> notification that a certain LSN was replayed on the replica, and verifies
> that no new WAL has been generated after that certain LSN was generated?
> Neither of those things?

The WAL sender would switch from catchup to streaming mode when it sees
that there is no more data to send to the standby.  Please look for the
call of WalSndSetState(WALSNDSTATE_STREAMING) in walsender.c.

> If a replica has caught up and then fallen behind again, is that different
> from a user/dba perspective than if it never caught up in the first
> place?

Not really, because it means that it has been able to catch up with the
latest LSN of the primary at least once.  Perhaps you have suggestions
to improve the documentation?
--
Michael

Attachments:

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-12-11 01:57 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-12-10 19:24 pg_stat_replication view Jeff Janes <jeff.janes@gmail.com>
2018-12-11 01:57 ` Michael Paquier <michael@paquier.xyz>

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