pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. 3+ messages / 1 participants [nested] [flat]
* pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. @ 2025-12-09 07:34 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2025-12-09 07:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix LOCK_TIMEOUT handling in slotsync worker. Previously, the slotsync worker relied on SIGINT for graceful shutdown during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler to cancel queries. Since the slotsync worker can lock catalog tables while parsing libpq tuples, this overlap caused it to ignore LOCK_TIMEOUT signals and potentially wait indefinitely on locks. This patch replaces the slotsync worker's SIGINT handler with StatementCancelHandler to correctly process query-cancel interrupts. Additionally, the startup process now uses SIGUSR1 to signal the slotsync worker to stop during promotion. The worker exits after detecting that the shared memory flag stopSignaled is set. Author: Hou Zhijie <houzj.fnst@fujitsu.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 17, here it was introduced Discussion: https://postgr.es/m/TY4PR01MB169078F33846E9568412D878C94A2A@TY4PR01MB16907.jpnprd01.prod.outlook.com Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/04396eacd3faeaa4fa3d084a6749e4e384bdf0db Modified Files -------------- src/backend/replication/logical/slotsync.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. @ 2025-12-09 07:34 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2025-12-09 07:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix LOCK_TIMEOUT handling in slotsync worker. Previously, the slotsync worker relied on SIGINT for graceful shutdown during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler to cancel queries. Since the slotsync worker can lock catalog tables while parsing libpq tuples, this overlap caused it to ignore LOCK_TIMEOUT signals and potentially wait indefinitely on locks. This patch replaces the slotsync worker's SIGINT handler with StatementCancelHandler to correctly process query-cancel interrupts. Additionally, the startup process now uses SIGUSR1 to signal the slotsync worker to stop during promotion. The worker exits after detecting that the shared memory flag stopSignaled is set. Author: Hou Zhijie <houzj.fnst@fujitsu.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 17, here it was introduced Discussion: https://postgr.es/m/TY4PR01MB169078F33846E9568412D878C94A2A@TY4PR01MB16907.jpnprd01.prod.outlook.com Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6c61c69d5886c759c8c416486c6d7761b63c3e16 Modified Files -------------- src/backend/replication/logical/slotsync.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. @ 2025-12-09 07:34 Amit Kapila <akapila@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Amit Kapila @ 2025-12-09 07:34 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix LOCK_TIMEOUT handling in slotsync worker. Previously, the slotsync worker relied on SIGINT for graceful shutdown during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler to cancel queries. Since the slotsync worker can lock catalog tables while parsing libpq tuples, this overlap caused it to ignore LOCK_TIMEOUT signals and potentially wait indefinitely on locks. This patch replaces the slotsync worker's SIGINT handler with StatementCancelHandler to correctly process query-cancel interrupts. Additionally, the startup process now uses SIGUSR1 to signal the slotsync worker to stop during promotion. The worker exits after detecting that the shared memory flag stopSignaled is set. Author: Hou Zhijie <houzj.fnst@fujitsu.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Backpatch-through: 17, here it was introduced Discussion: https://postgr.es/m/TY4PR01MB169078F33846E9568412D878C94A2A@TY4PR01MB16907.jpnprd01.prod.outlook.com Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f2818868aec856e7d2502e5232e08d3a4857a802 Modified Files -------------- src/backend/replication/logical/slotsync.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2025-12-09 07:34 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2025-12-09 07:34 pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. Amit Kapila <akapila@postgresql.org> 2025-12-09 07:34 pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. Amit Kapila <akapila@postgresql.org> 2025-12-09 07:34 pgsql: Fix LOCK_TIMEOUT handling in slotsync worker. Amit Kapila <akapila@postgresql.org>
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