pgsql: Enhance slot synchronization API to respect promotion signal.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Enhance slot synchronization API to respect promotion signal.
Date: 2025-12-11 03:59:08
Message-ID: E1vTXpb-0005JI-2z@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Enhance slot synchronization API to respect promotion signal.

Previously, during a promotion, only the slot synchronization worker was
signaled to shut down. The backend executing slot synchronization via the
pg_sync_replication_slots() SQL function was not signaled, allowing it to
complete its synchronization cycle before exiting.

An upcoming patch improves pg_sync_replication_slots() to wait until
replication slots are fully persisted before finishing. This behaviour
requires the backend to exit promptly if a promotion occurs.

This patch ensures that, during promotion, a signal is also sent to the
backend running pg_sync_replication_slots(), allowing it to be interrupted
and exit immediately.

Author: Ajin Cherian <itsajin(at)gmail(dot)com>
Reviewed-by: Shveta Malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1362bc33e025fd2848ff38558f5672e2f0f0c7de

Modified Files
--------------
src/backend/replication/logical/slotsync.c | 157 ++++++++++++++++++-----------
1 file changed, 99 insertions(+), 58 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2025-12-11 05:12:21 pgsql: pg_buffercache: Fix memory allocation formula
Previous Message Peter Geoghegan 2025-12-11 01:51:12 pgsql: Clarify why _bt_killitems sorts its items array.