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

Commitd4337a0

Browse files
Init crash recovery using the latest available TLI
This simplifies the handling of crashes after fast promotion and variousminor cases that can exist in short timing windows around that case.Broad fix to bug reported by Michael Paquier on -hackers,approach prompted by Heikki Linnakangas
1 parent1781744 commitd4337a0

File tree

1 file changed

+6
-18
lines changed
  • src/backend/access/transam

1 file changed

+6
-18
lines changed

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

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4932,10 +4932,14 @@ StartupXLOG(void)
49324932
RelationCacheInitFileRemove();
49334933

49344934
/*
4935-
* Initialize on the assumption we want to recover to thesame timeline
4935+
* Initialize on the assumption we want to recover to thelatest timeline
49364936
* that's active according to pg_control.
49374937
*/
4938-
recoveryTargetTLI=ControlFile->checkPointCopy.ThisTimeLineID;
4938+
if (ControlFile->minRecoveryPointTLI>
4939+
ControlFile->checkPointCopy.ThisTimeLineID)
4940+
recoveryTargetTLI=ControlFile->minRecoveryPointTLI;
4941+
else
4942+
recoveryTargetTLI=ControlFile->checkPointCopy.ThisTimeLineID;
49394943

49404944
/*
49414945
* Check for recovery control file, and if so set up state for offline
@@ -4972,22 +4976,6 @@ StartupXLOG(void)
49724976
ereport(LOG,
49734977
(errmsg("starting archive recovery")));
49744978
}
4975-
elseif (ControlFile->minRecoveryPointTLI>0)
4976-
{
4977-
/*
4978-
* If the minRecoveryPointTLI is set when not in Archive Recovery
4979-
* it means that we have crashed after ending recovery and
4980-
* yet before we wrote a new checkpoint on the new timeline.
4981-
* That means we are doing a crash recovery that needs to cross
4982-
* timelines to get to our newly assigned timeline again.
4983-
* The timeline we are headed for is exact and not 'latest'.
4984-
* As soon as we hit a checkpoint, the minRecoveryPointTLI is
4985-
* reset, so we will not enter crash recovery again.
4986-
*/
4987-
Assert(ControlFile->minRecoveryPointTLI!=1);
4988-
recoveryTargetTLI=ControlFile->minRecoveryPointTLI;
4989-
recoveryTargetIsLatest= false;
4990-
}
49914979

49924980
/*
49934981
* Take ownership of the wakeup latch if we're going to sleep during

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp