pgsql: Fix LOCK_TIMEOUT handling during parallel apply.

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix LOCK_TIMEOUT handling during parallel apply.
Date: 2025-09-24 04:25:48
Message-ID: E1v1H4d-002FwG-1t@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix LOCK_TIMEOUT handling during parallel apply.

Previously, the parallel apply worker used SIGINT to receive a graceful
shutdown signal from the leader apply worker. However, SIGINT is also used
by the LOCK_TIMEOUT handler to trigger a query-cancel interrupt. This
overlap caused the parallel apply worker to miss LOCK_TIMEOUT signals,
leading to incorrect behavior during lock wait/contention.

This patch resolves the conflict by switching the graceful shutdown signal
from SIGINT to SIGUSR2.

Reported-by: Zane Duffield <duffieldzane(at)gmail(dot)com>
Diagnosed-by: Zhijie Hou <houzj(dot)fnst(at)fujitsu(dot)com>
Author: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Backpatch-through: 16, where it was introduced
Discussion: https://postgr.es/m/CACMiCkXyC4au74kvE2g6Y=mCEF8X6r-Ne_ty4r7qWkUjRE4+oQ@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/postmaster/interrupt.c | 5 ++---
src/backend/replication/logical/applyparallelworker.c | 17 ++++++++++++-----
src/backend/replication/logical/launcher.c | 4 ++--
3 files changed, 16 insertions(+), 10 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message John Naylor 2025-09-24 06:29:13 pgsql: Update GB18030 encoding from version 2000 to 2022
Previous Message Michael Paquier 2025-09-23 23:40:36 Re: pgsql: Fix meson build with -Duuid=ossp when using version older than 0