pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix LOCK_TIMEOUT handling during parallel apply.
Date: Wed, 24 Sep 2025 04:25:48 +0000
Message-ID: <E1v1H4d-002FwM-24@gemulon.postgresql.org> (raw)

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@gmail.com>
Diagnosed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 16, where it was introduced
Discussion: https://postgr.es/m/CACMiCkXyC4au74kvE2g6Y=mCEF8X6r-Ne_ty4r7qWkUjRE4+oQ@mail.gmail.com

Branch
------
REL_16_STABLE

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

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



view thread (4+ messages)  latest in thread

Message-ID: <E1v1H4d-002FwM-24@gemulon.postgresql.org>
Permalink:  ../E1v1H4d-002FwM-24@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1v1H4d-002FwM-24@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix LOCK_TIMEOUT handling during parallel apply.
  In-Reply-To: <E1v1H4d-002FwM-24@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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