Fix LOCK_TIMEOUT handling during parallel apply.
authorAmit Kapila <akapila@postgresql.org>
Wed, 24 Sep 2025 04:00:15 +0000 (04:00 +0000)
committerAmit Kapila <akapila@postgresql.org>
Wed, 24 Sep 2025 04:00:15 +0000 (04:00 +0000)
commit37fc5de438b423f34ba8551a9902a52963be98f5
treea59cb37b76731a5869bfa587119643a792f7b4ed
parent178bbf403cc51d912b50f8ad8ea318e42cc29f42
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
src/backend/postmaster/interrupt.c
src/backend/replication/logical/applyparallelworker.c
src/backend/replication/logical/launcher.c