From: | Amit Kapila <akapila(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Fix the race condition in ReplicationSlotAcquire(). |
Date: | 2025-02-27 04:30:08 |
Message-ID: | E1tnVXC-000I6m-2X@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix the race condition in ReplicationSlotAcquire().
After commit f41d8468dd, a process could acquire and use a replication
slot that had just been invalidated, leading to failures while accessing
WAL.
To ensure that we don't accidentally start using invalid slots, we must
perform the invalidation check after acquiring the slot or under the
spinlock where we associate the slot with a particular process. We choose
the earlier method to keep the code simple.
Reported-by: Hou Zhijie <houzj(dot)fnst(at)fujitsu(dot)com>
Author: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Reviewed-by: Hou Zhijie <houzj(dot)fnst(at)fujitsu(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Discussion: https://postgr.es/m/CABdArM7J-LbGoMPGUPiFiLOyB_TZ5+YaZb=HMES0mQqzVTn8Gg@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/8709dccc793da0c0c6619cafa182c8e67a871154
Modified Files
--------------
src/backend/replication/slot.c | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2025-02-27 05:06:57 | pgsql: pg_amcheck: Fix inconsistency in memory freeing |
Previous Message | Amit Kapila | 2025-02-27 03:26:01 | pgsql: Doc: Additional clarification for -d option of pg_createsubscrib |