From: Simon Riggs <simon@2ndQuadrant.com>
To: pgsql-committers@postgresql.org
Subject: pgsql: Replication lag tracking for walsenders
Date: Thu, 23 Mar 2017 14:07:44 +0000
Message-ID: <E1cr3Oy-0005cA-L8@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Replication lag tracking for walsenders
Adds write_lag, flush_lag and replay_lag cols to pg_stat_replication.
Implements a lag tracker module that reports the lag times based upon
measurements of the time taken for recent WAL to be written, flushed and
replayed and for the sender to hear about it. These times
represent the commit lag that was (or would have been) introduced by each
synchronous commit level, if the remote server was configured as a
synchronous standby. For an asynchronous standby, the replay_lag column
approximates the delay before recent transactions became visible to queries.
If the standby server has entirely caught up with the sending server and
there is no more WAL activity, the most recently measured lag times will
continue to be displayed for a short time and then show NULL.
Physical replication lag tracking is automatic. Logical replication tracking
is possible but is the responsibility of the logical decoding plugin.
Tracking is a private module operating within each walsender individually,
with values reported to shared memory. Module not used outside of walsender.
Design and code is good enough now to commit - kudos to the author.
In many ways a difficult topic, with important and subtle behaviour so this
shoudl be expected to generate discussion and multiple open items: Test now!
Author: Thomas Munro, following designs by Fujii Masao and Simon Riggs
Review: Simon Riggs, Ian Barwick and Craig Ringer
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/6912acc04f0bbcfdb799a120618507601e862490
Modified Files
--------------
doc/src/sgml/monitoring.sgml | 69 +++++++
src/backend/access/transam/xlog.c | 14 ++
src/backend/catalog/system_views.sql | 3 +
src/backend/replication/walsender.c | 277 +++++++++++++++++++++++++++-
src/include/catalog/pg_proc.h | 2 +-
src/include/replication/logical.h | 2 +
src/include/replication/walsender_private.h | 5 +
src/test/regress/expected/rules.out | 5 +-
8 files changed, 370 insertions(+), 7 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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-committers@postgresql.org
Cc: simon@2ndQuadrant.com
Subject: Re: pgsql: Replication lag tracking for walsenders
In-Reply-To: <E1cr3Oy-0005cA-L8@gemulon.postgresql.org>
References: <E1cr3Oy-0005cA-L8@gemulon.postgresql.org>
* 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