Fix WaitLSNWakeup() fast-path check for InvalidXLogRecPtr
Alexander Korotkov <akorotkov@postgresql.org>
Author:
Alexander Korotkov <akorotkov@postgresql.org>
Date: 2025-11-15T10:27:42Z
Releases:
19 (unreleased)
Fix WaitLSNWakeup() fast-path check for InvalidXLogRecPtr WaitLSNWakeup() incorrectly returned early when called with InvalidXLogRecPtr (meaning "wake all waiters"), because the fast-path check compared minWaitedLSN > 0 without validating currentLSN first. This caused WAIT FOR LSN commands to wait indefinitely during standby promotion until random signals woke them. Add an XLogRecPtrIsValid() check before the comparison so that InvalidXLogRecPtr bypasses the fast-path and wakes all waiters immediately. Discussion: https://postgr.es/m/CABPTF7UieOYbOgH3EnQCasaqcT1T4N6V2wammwrWCohQTnD_Lw%40mail.gmail.com Author: Xuneng Zhou <xunengzhou@gmail.com> Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/xlogwait.c | modified | +6 −2 |
Discussion
- Implement waiting for wal lsn replay: reloaded 154 messages · 2024-11-27 → 2026-07-08