diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index a82919229a..6345d0746c 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -6053,12 +6053,22 @@ recoveryApplyDelay(XLogReaderState *record) { ResetLatch(&XLogCtl->recoveryWakeupLatch); - /* might change the trigger file's location */ + /* + * This might change recovery_min_apply_delay or the trigger file's + * location. + */ HandleStartupProcInterrupts(); if (CheckForStandbyTrigger()) break; + /* + * Recalculate recoveryDelayUntilTime as recovery_min_apply_delay + * could have changed while waiting in this loop. + */ + recoveryDelayUntilTime = + TimestampTzPlusMilliseconds(xtime, recovery_min_apply_delay); + /* * Wait for difference between GetCurrentTimestamp() and * recoveryDelayUntilTime