Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4521cc8

Browse files
committed
Fix lastReplayedEndRecPtr calculation when starting from shutdown checkpoint.
When entering crash recovery followed by archive recovery, and the latestcheckpoint is a shutdown checkpoint, and there are no more WAL records toreplay before transitioning from crash to archive recovery, we would notimmediately allow read-only connections in hot standby mode even if wecould. That's because when starting from a shutdown checkpoint, we setlastReplayedEndRecPtr incorrectly to the record before the checkpointrecord, instead of the checkpoint record itself. We don't run the redoroutine of the shutdown checkpoint record, but starting recovery from itgoes through the same motions, so it should be considered as replayed.Reported by Kyotaro HORIGUCHI. All versions with hot standby are affected,so backpatch to 9.0.
1 parent43af0e8 commit4521cc8

File tree

1 file changed

+7
-3
lines changed
  • src/backend/access/transam

1 file changed

+7
-3
lines changed

‎src/backend/access/transam/xlog.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6179,11 +6179,15 @@ StartupXLOG(void)
61796179

61806180
/*
61816181
* Initialize shared variables for tracking progress of WAL replay,
6182-
* as if we had just replayed the record before the REDO location.
6182+
* as if we had just replayed the record before the REDO location
6183+
* (or the checkpoint record itself, if it's a shutdown checkpoint).
61836184
*/
61846185
SpinLockAcquire(&xlogctl->info_lck);
6185-
xlogctl->replayEndRecPtr=checkPoint.redo;
6186-
xlogctl->lastReplayedEndRecPtr=checkPoint.redo;
6186+
if (XLByteLT(checkPoint.redo,RecPtr))
6187+
xlogctl->replayEndRecPtr=checkPoint.redo;
6188+
else
6189+
xlogctl->replayEndRecPtr=EndRecPtr;
6190+
xlogctl->lastReplayedEndRecPtr=xlogctl->replayEndRecPtr;
61876191
xlogctl->recoveryLastXTime=0;
61886192
SpinLockRelease(&xlogctl->info_lck);
61896193

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp