File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
src/backend/access/transam Expand file tree Collapse file tree 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)
222222{
223223 XLogRecPtr currentLSN ;
224224 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 ;
226226
227227 /* Shouldn't be called when shmem isn't initialized */
228228 Assert (waitLSNState );
@@ -313,6 +313,16 @@ WaitForLSNReplay(XLogRecPtr targetLSN, int64 timeout)
313313 rc = WaitLatch (MyLatch , wake_events , delay_ms ,
314314 WAIT_EVENT_WAIT_FOR_WAL_REPLAY );
315315
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+
316326 if (rc & WL_LATCH_SET )
317327 ResetLatch (MyLatch );
318328 }
You can’t perform that action at this time.
0 commit comments