pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix race condition in invalidating obsolete replication slots
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix race condition in invalidating obsolete replication slots
@ 2021-06-11 16:21  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2021-06-11 16:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix race condition in invalidating obsolete replication slots

The code added to mark replication slots invalid in commit c6550776394e
had the race condition that a slot can be dropped or advanced
concurrently with checkpointer trying to invalidate it.  Rewrite the
code to close those races.

The changes to ReplicationSlotAcquire's API added with c6550776394e are
not necessary anymore.  To avoid an ABI break in released branches, this
commit leaves that unchanged; it'll be changed in a master-only commit
separately.

Backpatch to 13, where this code first appeared.

Reported-by: Andres Freund <andres@anarazel.de>
Author: Andres Freund <andres@anarazel.de>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20210408001037.wfmk6jud36auhfqm@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/96540f80f8334a3f0f4a13f0d42e4565d8fa9eb7

Modified Files
--------------
src/backend/replication/slot.c | 221 +++++++++++++++++++++++++++--------------
1 file changed, 144 insertions(+), 77 deletions(-)



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

* pgsql: Fix race condition in invalidating obsolete replication slots
@ 2021-06-11 16:21  Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2021-06-11 16:21 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix race condition in invalidating obsolete replication slots

The code added to mark replication slots invalid in commit c6550776394e
had the race condition that a slot can be dropped or advanced
concurrently with checkpointer trying to invalidate it.  Rewrite the
code to close those races.

The changes to ReplicationSlotAcquire's API added with c6550776394e are
not necessary anymore.  To avoid an ABI break in released branches, this
commit leaves that unchanged; it'll be changed in a master-only commit
separately.

Backpatch to 13, where this code first appeared.

Reported-by: Andres Freund <andres@anarazel.de>
Author: Andres Freund <andres@anarazel.de>
Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20210408001037.wfmk6jud36auhfqm@alap3.anarazel.de

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/218b101008b533156d7e5832fe143d1e04a01301

Modified Files
--------------
src/backend/replication/slot.c | 223 +++++++++++++++++++++++++++--------------
1 file changed, 145 insertions(+), 78 deletions(-)



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


end of thread, other threads:[~2021-06-11 16:21 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 16:21 pgsql: Fix race condition in invalidating obsolete replication slots Alvaro Herrera <alvherre@alvh.no-ip.org>
2021-06-11 16:21 pgsql: Fix race condition in invalidating obsolete replication slots Alvaro Herrera <alvherre@alvh.no-ip.org>

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