]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix handling of synchronous replication for stopping WAL senders
authorMichael Paquier <michael@paquier.xyz>
Thu, 29 Nov 2018 00:12:40 +0000 (09:12 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 29 Nov 2018 00:12:40 +0000 (09:12 +0900)
commitbad41764a443605bef9bb3d1c3614e1b3770005d
tree65b1ab44eb47ee3dac20c055e55901ff0ed5dc35
parent95c45718126fe081e9236335a85d15ad24adc107
Fix handling of synchronous replication for stopping WAL senders

This fixes an oversight from c6c3334 which forgot that if a subset of
WAL senders are stopping and in a sync state, other WAL senders could
still be waiting for a WAL position to be synced while committing a
transaction.  However the subset of stopping senders would not release
waiters, potentially breaking synchronous replication guarantees.  This
commit makes sure that even WAL senders stopping are able to release
waiters and are tracked properly.

On 9.4, this can also trigger an assertion failure when setting for
example max_wal_senders to 1 where a WAL sender is not able to find
itself as in synchronous state when the instance stops.

Reported-by: Paul Guo
Author: Paul Guo, Michael Paquier
Discussion: https://postgr.es/m/CAEET0ZEv8VFqT3C-cQm6byOB4r4VYWcef1J21dOX-gcVhCSpmA@mail.gmail.com
Backpatch-through: 9.4
src/backend/replication/syncrep.c