mirror of
https://github.com/postgres/postgres.git
synced 2025-11-04 20:11:56 +03:00
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
This commit is contained in:
@@ -650,7 +650,7 @@ logicalrep_worker_stop(Oid subid, Oid relid)
|
||||
/*
|
||||
* Stop the given logical replication parallel apply worker.
|
||||
*
|
||||
* Node that the function sends SIGINT instead of SIGTERM to the parallel apply
|
||||
* Node that the function sends SIGUSR2 instead of SIGTERM to the parallel apply
|
||||
* worker so that the worker exits cleanly.
|
||||
*/
|
||||
void
|
||||
@@ -688,7 +688,7 @@ logicalrep_pa_worker_stop(ParallelApplyWorkerInfo *winfo)
|
||||
* Only stop the worker if the generation matches and the worker is alive.
|
||||
*/
|
||||
if (worker->generation == generation && worker->proc)
|
||||
logicalrep_worker_stop_internal(worker, SIGINT);
|
||||
logicalrep_worker_stop_internal(worker, SIGUSR2);
|
||||
|
||||
LWLockRelease(LogicalRepWorkerLock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user