aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 32e208c7c72..4041ab4051e 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6508,11 +6508,15 @@ StartupXLOG(void)
/*
* Initialize shared variables for tracking progress of WAL replay,
- * as if we had just replayed the record before the REDO location.
+ * as if we had just replayed the record before the REDO location
+ * (or the checkpoint record itself, if it's a shutdown checkpoint).
*/
SpinLockAcquire(&xlogctl->info_lck);
- xlogctl->replayEndRecPtr = checkPoint.redo;
- xlogctl->lastReplayedEndRecPtr = checkPoint.redo;
+ if (XLByteLT(checkPoint.redo, RecPtr))
+ xlogctl->replayEndRecPtr = checkPoint.redo;
+ else
+ xlogctl->replayEndRecPtr = EndRecPtr;
+ xlogctl->lastReplayedEndRecPtr = xlogctl->replayEndRecPtr;
xlogctl->recoveryLastXTime = 0;
xlogctl->recoveryPause = false;
SpinLockRelease(&xlogctl->info_lck);