diff --git a/src/backend/access/transam/xlogfuncs.c b/src/backend/access/transam/xlogfuncs.c index 4795c6fa94..8a70503228 100644 *** a/src/backend/access/transam/xlogfuncs.c --- b/src/backend/access/transam/xlogfuncs.c *************** *** 759,764 **** pg_promote(PG_FUNCTION_ARGS) --- 759,766 ---- #define WAITS_PER_SECOND 10 for (i = 0; i < WAITS_PER_SECOND * wait_seconds; i++) { + int rc; + ResetLatch(MyLatch); if (!RecoveryInProgress()) *************** *** 766,775 **** pg_promote(PG_FUNCTION_ARGS) CHECK_FOR_INTERRUPTS(); ! (void) WaitLatch(MyLatch, ! WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, ! 1000L / WAITS_PER_SECOND, ! WAIT_EVENT_PROMOTE); } ereport(WARNING, --- 768,784 ---- CHECK_FOR_INTERRUPTS(); ! rc = WaitLatch(MyLatch, ! WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH, ! 1000L / WAITS_PER_SECOND, ! WAIT_EVENT_PROMOTE); ! ! /* ! * Emergency bailout if postmaster has died. This is to avoid the ! * necessity for manual cleanup of all postmaster children. ! */ ! if (rc & WL_POSTMASTER_DEATH) ! PG_RETURN_BOOL(false); } ereport(WARNING,