For cascading replication, wake physical and logical walsenders separately
Andres Freund <andres@anarazel.de>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/xlogarchive.c | modified | +1 −1 |
| src/backend/access/transam/xlog.c | modified | +3 −3 |
| src/backend/access/transam/xlogrecovery.c | modified | +28 −9 |
| src/backend/replication/walreceiver.c | modified | +1 −1 |
| src/backend/replication/walsender.c | modified | +37 −4 |
| src/include/replication/walsender.h | modified | +11 −11 |
| src/include/replication/walsender_private.h | modified | +3 −0 |
Discussion
- Minimal logical decoding on standbys 360 messages · 2018-12-12 → 2023-04-12