pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: For cascading replication, wake physical and logical walsenders
Date: Sat, 08 Apr 2023 08:10:56 +0000
Message-ID: <E1pl3ex-0020iq-Dm@gemulon.postgresql.org> (raw)

For cascading replication, wake physical and logical walsenders separately

Physical walsenders can't send data until it's been flushed; logical
walsenders can't decode and send data until it's been applied. On the
standby, the WAL is flushed first, which will only wake up physical
walsenders; and then applied, which will only wake up logical
walsenders.

Previously, all walsenders were awakened when the WAL was flushed. That
was fine for logical walsenders on the primary; but on the standby the
flushed WAL would have been not applied yet, so logical walsenders were
awakened too early.

Per idea from Jeff Davis and Amit Kapila.

Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com>
Reviewed-By: Jeff Davis <pgsql@j-davis.com>
Reviewed-By: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1+zO5LUeisabX10c81LU-fWMKO4M9Wyg1cdkbW7Hqh6vQ@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e101dfac3a53c20bfbf1ca85d30a368c2954facf

Modified Files
--------------
src/backend/access/transam/xlog.c           |  6 ++---
src/backend/access/transam/xlogarchive.c    |  2 +-
src/backend/access/transam/xlogrecovery.c   | 37 +++++++++++++++++++-------
src/backend/replication/walreceiver.c       |  2 +-
src/backend/replication/walsender.c         | 41 ++++++++++++++++++++++++++---
src/include/replication/walsender.h         | 22 ++++++++--------
src/include/replication/walsender_private.h |  3 +++
7 files changed, 84 insertions(+), 29 deletions(-)



Message-ID: <E1pl3ex-0020iq-Dm@gemulon.postgresql.org>
Permalink:  ../E1pl3ex-0020iq-Dm@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1pl3ex-0020iq-Dm@gemulon.postgresql.org

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: For cascading replication, wake physical and logical walsenders
  In-Reply-To: <E1pl3ex-0020iq-Dm@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