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

Commite45057e

Browse files
committed
Don't set reachedMinRecoveryPoint during crash recovery. In crash recovery,
we don't reach consistency before replaying all of the WAL. Rename thevariable to reachedConsistency, to make its intention clearer.In master, that was an active bug because of the recent patch toimmediately PANIC if a reference to a missing page is found in WAL afterreaching consistency, as Tom Lane's test case demonstrated. In 9.1 and 9.0,the only consequence was a misleading "consistent recovery state reached at%X/%X" message in the log at the beginning of crash recovery (the databaseis not consistent at that point yet). In 8.4, the log message was notprinted in crash recovery, even though there was a similarreachedMinRecoveryPoint local variable that was also set early. So,backpatch to 9.1 and 9.0.
1 parent85d85ff commite45057e

File tree

1 file changed

+17
-4
lines changed
  • src/backend/access/transam

1 file changed

+17
-4
lines changed

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

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,13 @@ static TimeLineID lastPageTLI = 0;
554554
staticXLogRecPtrminRecoveryPoint;/* local copy of
555555
* ControlFile->minRecoveryPoint */
556556
staticboolupdateMinRecoveryPoint= true;
557-
staticboolreachedMinRecoveryPoint= false;
557+
558+
/*
559+
* Have we reached a consistent database state? In crash recovery, we have
560+
* to replay all the WAL, so reachedConsistency is never set. During archive
561+
* recovery, the database is consistent once minRecoveryPoint is reached.
562+
*/
563+
staticboolreachedConsistency= false;
558564

559565
staticboolInRedo= false;
560566

@@ -6952,14 +6958,21 @@ StartupXLOG(void)
69526958
staticvoid
69536959
CheckRecoveryConsistency(void)
69546960
{
6961+
/*
6962+
* During crash recovery, we don't reach a consistent state until we've
6963+
* replayed all the WAL.
6964+
*/
6965+
if (XLogRecPtrIsInvalid(minRecoveryPoint))
6966+
return;
6967+
69556968
/*
69566969
* Have we passed our safe starting point?
69576970
*/
6958-
if (!reachedMinRecoveryPoint&&
6971+
if (!reachedConsistency&&
69596972
XLByteLE(minRecoveryPoint,EndRecPtr)&&
69606973
XLogRecPtrIsInvalid(ControlFile->backupStartPoint))
69616974
{
6962-
reachedMinRecoveryPoint= true;
6975+
reachedConsistency= true;
69636976
ereport(LOG,
69646977
(errmsg("consistent recovery state reached at %X/%X",
69656978
EndRecPtr.xlogid,EndRecPtr.xrecoff)));
@@ -6972,7 +6985,7 @@ CheckRecoveryConsistency(void)
69726985
*/
69736986
if (standbyState==STANDBY_SNAPSHOT_READY&&
69746987
!LocalHotStandbyActive&&
6975-
reachedMinRecoveryPoint&&
6988+
reachedConsistency&&
69766989
IsUnderPostmaster)
69776990
{
69786991
/* use volatile pointer to prevent code rearrangement */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp