pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix handling of synchronous replication for stopping WAL senders
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix handling of synchronous replication for stopping WAL senders
@ 2018-11-29 00:15 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2018-11-29 00:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4c703369af3e34cd7289d99c1b6f10e3b3bbbb4d

Modified Files
--------------
src/backend/replication/syncrep.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)



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

* pgsql: Fix handling of synchronous replication for stopping WAL senders
@ 2018-11-29 00:15 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2018-11-29 00:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/replication/syncrep.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)



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

* pgsql: Fix handling of synchronous replication for stopping WAL senders
@ 2018-11-29 00:15 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2018-11-29 00:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/04e381a19929bed34c664233eb4357f0d7d78696

Modified Files
--------------
src/backend/replication/syncrep.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)



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

* pgsql: Fix handling of synchronous replication for stopping WAL senders
@ 2018-11-29 00:15 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2018-11-29 00:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8340eba6d8473b072a58f3fd50dbeb8fdb706cb2

Modified Files
--------------
src/backend/replication/syncrep.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)



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

* pgsql: Fix handling of synchronous replication for stopping WAL senders
@ 2018-11-29 00:15 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2018-11-29 00:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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

Branch
------
REL9_5_STABLE

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

Modified Files
--------------
src/backend/replication/syncrep.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)



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

* pgsql: Fix handling of synchronous replication for stopping WAL senders
@ 2018-11-29 00:15 Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2018-11-29 00:15 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of synchronous replication for stopping WAL senders

This fixes an oversight from c6c3334 which has introduced a more strict
ordering in the way WAL senders are stopped to prevent current WAL
activity when a shutdown checkpoint is created.  After all backends are
stopped, all WAL senders are requested to stop which makes them stop any
activity, and switching their state as stopping.  Once the checkpointer
knows that all WAL senders are in a stopping state, the shutdown
checkpoint can begin, with all WAL senders activated, waiting for their
clients to flush the shutdown checkpoint record.

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 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

Branch
------
REL9_4_STABLE

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

Modified Files
--------------
src/backend/replication/syncrep.c   | 9 ++++++---
src/backend/replication/walsender.c | 6 ++++--
2 files changed, 10 insertions(+), 5 deletions(-)



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


end of thread, other threads:[~2018-11-29 00:15 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 00:15 pgsql: Fix handling of synchronous replication for stopping WAL senders Michael Paquier <michael@paquier.xyz>
2018-11-29 00:15 pgsql: Fix handling of synchronous replication for stopping WAL senders Michael Paquier <michael@paquier.xyz>
2018-11-29 00:15 pgsql: Fix handling of synchronous replication for stopping WAL senders Michael Paquier <michael@paquier.xyz>
2018-11-29 00:15 pgsql: Fix handling of synchronous replication for stopping WAL senders Michael Paquier <michael@paquier.xyz>
2018-11-29 00:15 pgsql: Fix handling of synchronous replication for stopping WAL senders Michael Paquier <michael@paquier.xyz>
2018-11-29 00:15 pgsql: Fix handling of synchronous replication for stopping WAL senders 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