Fix WAIT FOR LSN cleanup on subtransaction abort
Alexander Korotkov <akorotkov@postgresql.org>
Author:
Alexander Korotkov <akorotkov@postgresql.org>
Date: 2026-05-06T10:56:38Z
Releases:
19 (unreleased)
Fix WAIT FOR LSN cleanup on subtransaction abort WAIT FOR LSN registers the current backend in shared memory before entering an interruptible wait loop. Top-level abort and backend exit already call WaitLSNCleanup(), but subtransaction abort did not. If an interrupt, such as statement_timeout, occurred while waiting inside a savepoint, rolling back to the savepoint left the backend marked as present in the WAIT FOR LSN heap. Clean up WAIT FOR LSN state from AbortSubTransaction() as well, and add a TAP test covering reuse of WAIT FOR LSN after a savepoint rollback. Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Discussion: https://postgr.es/m/CAJTYsWXDRwo-RVRaQgwxVcXgURVFeX8BKnijQrPiPcSCkDDX9A%40mail.gmail.com Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Author: Xuneng Zhou <xunengzhou@gmail.com> Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/xact.c | modified | +5 −0 |
| src/backend/access/transam/xlogwait.c | modified | +1 −1 |
| src/test/recovery/t/049_wait_for_lsn.pl | modified | +48 −0 |
Discussion
- [PATCH] Fix WAIT FOR LSN cleanup on subtransaction abort 4 messages · 2026-05-06