Fix LOCK_TIMEOUT handling during parallel apply.
Amit Kapila <akapila@postgresql.org>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/postmaster/interrupt.c | modified | +2 −3 |
| src/backend/replication/logical/applyparallelworker.c | modified | +12 −5 |
| src/backend/replication/logical/launcher.c | modified | +2 −2 |
Discussion
- Lock timeouts and unusual spikes in replication lag with logical parallel transaction streaming 11 messages · 2025-08-11 → 2025-09-24