pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix lost wakeups in physical WAL senders 5+ messages / 1 participants [nested] [flat]
* pgsql: Fix lost wakeups in physical WAL senders @ 2026-11-03 01:53 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Fujii Masao @ 2026-11-03 01:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix lost wakeups in physical WAL senders Physical WAL senders could sleep even when flushed WAL was waiting to be sent, delaying replication and synchronous commits until another event woke them. In the reported case, commits stalled for about ten seconds, until the standby sent its next periodic status report. Commit bc971f4025c changed WAL sender wakeups to use condition variables, which notify only senders already on the waitlist. However, XLogSendPhysical() checks the flush position before WalSndWait() joins the waitlist. If WAL is flushed between these two steps, the wakeup can be missed, leaving the sender asleep despite having more WAL to send. Fix this by rechecking the flush position after joining the waitlist and returning to the send loop if more WAL is available. For cascading senders, also check for promotion or a timeline change, which require the sender to revisit the current timeline even if the flush position has not advanced. Backpatch to v16, where commit bc971f4025c introduced the condition-variable wakeup mechanism. Author: Alex Speller <alex@alexspeller.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/mvx5bs7q.33b99c32-67d8-4373-8611-7a8250fb2fd3@we.are.superhuman.com Backpatch-through: 16 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/782d9cf8bf823775efb604300713f6c39a5bfb02 Modified Files -------------- src/backend/replication/walsender.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix lost wakeups in physical WAL senders @ 2026-11-03 01:53 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Fujii Masao @ 2026-11-03 01:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix lost wakeups in physical WAL senders Physical WAL senders could sleep even when flushed WAL was waiting to be sent, delaying replication and synchronous commits until another event woke them. In the reported case, commits stalled for about ten seconds, until the standby sent its next periodic status report. Commit bc971f4025c changed WAL sender wakeups to use condition variables, which notify only senders already on the waitlist. However, XLogSendPhysical() checks the flush position before WalSndWait() joins the waitlist. If WAL is flushed between these two steps, the wakeup can be missed, leaving the sender asleep despite having more WAL to send. Fix this by rechecking the flush position after joining the waitlist and returning to the send loop if more WAL is available. For cascading senders, also check for promotion or a timeline change, which require the sender to revisit the current timeline even if the flush position has not advanced. Backpatch to v16, where commit bc971f4025c introduced the condition-variable wakeup mechanism. Author: Alex Speller <alex@alexspeller.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/mvx5bs7q.33b99c32-67d8-4373-8611-7a8250fb2fd3@we.are.superhuman.com Backpatch-through: 16 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/a9b32f4c818b2ea2857f80337e660802def51c63 Modified Files -------------- src/backend/replication/walsender.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix lost wakeups in physical WAL senders @ 2026-11-03 01:53 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Fujii Masao @ 2026-11-03 01:53 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix lost wakeups in physical WAL senders Physical WAL senders could sleep even when flushed WAL was waiting to be sent, delaying replication and synchronous commits until another event woke them. In the reported case, commits stalled for about ten seconds, until the standby sent its next periodic status report. Commit bc971f4025c changed WAL sender wakeups to use condition variables, which notify only senders already on the waitlist. However, XLogSendPhysical() checks the flush position before WalSndWait() joins the waitlist. If WAL is flushed between these two steps, the wakeup can be missed, leaving the sender asleep despite having more WAL to send. Fix this by rechecking the flush position after joining the waitlist and returning to the send loop if more WAL is available. For cascading senders, also check for promotion or a timeline change, which require the sender to revisit the current timeline even if the flush position has not advanced. Backpatch to v16, where commit bc971f4025c introduced the condition-variable wakeup mechanism. Author: Alex Speller <alex@alexspeller.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/mvx5bs7q.33b99c32-67d8-4373-8611-7a8250fb2fd3@we.are.superhuman.com Backpatch-through: 16 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1ff9f9380d32b04de71569ccebf475324dd39aaf Modified Files -------------- src/backend/replication/walsender.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix lost wakeups in physical WAL senders @ 2026-11-03 01:54 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Fujii Masao @ 2026-11-03 01:54 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix lost wakeups in physical WAL senders Physical WAL senders could sleep even when flushed WAL was waiting to be sent, delaying replication and synchronous commits until another event woke them. In the reported case, commits stalled for about ten seconds, until the standby sent its next periodic status report. Commit bc971f4025c changed WAL sender wakeups to use condition variables, which notify only senders already on the waitlist. However, XLogSendPhysical() checks the flush position before WalSndWait() joins the waitlist. If WAL is flushed between these two steps, the wakeup can be missed, leaving the sender asleep despite having more WAL to send. Fix this by rechecking the flush position after joining the waitlist and returning to the send loop if more WAL is available. For cascading senders, also check for promotion or a timeline change, which require the sender to revisit the current timeline even if the flush position has not advanced. Backpatch to v16, where commit bc971f4025c introduced the condition-variable wakeup mechanism. Author: Alex Speller <alex@alexspeller.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/mvx5bs7q.33b99c32-67d8-4373-8611-7a8250fb2fd3@we.are.superhuman.com Backpatch-through: 16 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6d34d5500e9dad93f2514295cc350fced1ec843e Modified Files -------------- src/backend/replication/walsender.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Fix lost wakeups in physical WAL senders @ 2026-11-03 01:54 Fujii Masao <fujii@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Fujii Masao @ 2026-11-03 01:54 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix lost wakeups in physical WAL senders Physical WAL senders could sleep even when flushed WAL was waiting to be sent, delaying replication and synchronous commits until another event woke them. In the reported case, commits stalled for about ten seconds, until the standby sent its next periodic status report. Commit bc971f4025c changed WAL sender wakeups to use condition variables, which notify only senders already on the waitlist. However, XLogSendPhysical() checks the flush position before WalSndWait() joins the waitlist. If WAL is flushed between these two steps, the wakeup can be missed, leaving the sender asleep despite having more WAL to send. Fix this by rechecking the flush position after joining the waitlist and returning to the send loop if more WAL is available. For cascading senders, also check for promotion or a timeline change, which require the sender to revisit the current timeline even if the flush position has not advanced. Backpatch to v16, where commit bc971f4025c introduced the condition-variable wakeup mechanism. Author: Alex Speller <alex@alexspeller.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/mvx5bs7q.33b99c32-67d8-4373-8611-7a8250fb2fd3@we.are.superhuman.com Backpatch-through: 16 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2ac618d717a34b984ef34ccb3f9764daa34d086b Modified Files -------------- src/backend/replication/walsender.c | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-11-03 01:54 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-03 01:53 pgsql: Fix lost wakeups in physical WAL senders Fujii Masao <fujii@postgresql.org> 2026-11-03 01:53 pgsql: Fix lost wakeups in physical WAL senders Fujii Masao <fujii@postgresql.org> 2026-11-03 01:53 pgsql: Fix lost wakeups in physical WAL senders Fujii Masao <fujii@postgresql.org> 2026-11-03 01:54 pgsql: Fix lost wakeups in physical WAL senders Fujii Masao <fujii@postgresql.org> 2026-11-03 01:54 pgsql: Fix lost wakeups in physical WAL senders Fujii Masao <fujii@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