File tree 1 file changed +11
-1
lines changed
src/backend/access/transam
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout)
222
222
{
223
223
XLogRecPtr currentLSN ;
224
224
TimestampTz endtime = 0 ;
225
- int wake_events = WL_LATCH_SET | WL_EXIT_ON_PM_DEATH ;
225
+ int wake_events = WL_LATCH_SET | WL_POSTMASTER_DEATH ;
226
226
227
227
/* Shouldn't be called when shmem isn't initialized */
228
228
Assert (waitLSNState );
@@ -313,6 +313,16 @@ WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout)
313
313
rc = WaitLatch (MyLatch , wake_events , delay_ms ,
314
314
WAIT_EVENT_WAIT_FOR_WAL_REPLAY );
315
315
316
+ /*
317
+ * Emergency bailout if postmaster has died. This is to avoid the
318
+ * necessity for manual cleanup of all postmaster children.
319
+ */
320
+ if (rc & WL_POSTMASTER_DEATH )
321
+ ereport (FATAL ,
322
+ (errcode (ERRCODE_ADMIN_SHUTDOWN ),
323
+ errmsg ("terminating connection due to unexpected postmaster exit" ),
324
+ errcontext ("while waiting for LSN replay" )));
325
+
316
326
if (rc & WL_LATCH_SET )
317
327
ResetLatch (MyLatch );
318
328
}
You can’t perform that action at this time.
0 commit comments