提交 55808e18 编写于 作者: J Jimmy Yih

Fix support of recovery_target_timeline recovery.conf setting

When recovery_target_timeline setting is set in recovery.conf, we expect the
recoveryTargetTLI variable to change (e.g. when set to 'latest', it will read
the primary's history file to get latest TLI). This logic seems to have been
removed from the bottom of readRecoveryCommandFile() when WAL replication was
backported for master/standby replication.
Co-authored-by: NPaul Guo <pguo@pivotal.io>
上级 ea196b2f
......@@ -5389,6 +5389,33 @@ readRecoveryCommandFile(void)
/* Enable fetching from archive recovery area */
ArchiveRecoveryRequested = true;
/*
* If user specified recovery_target_timeline, validate it or compute the
* "latest" value. We can't do this until after we've gotten the restore
* command and set InArchiveRecovery, because we need to fetch timeline
* history files from the archive.
*/
if (rtliGiven)
{
if (rtli)
{
/* Timeline 1 does not have a history file, all else should */
if (rtli != 1 && !existsTimeLineHistory(rtli))
ereport(FATAL,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("recovery target timeline %u does not exist",
rtli)));
recoveryTargetTLI = rtli;
recoveryTargetIsLatest = false;
}
else
{
/* We start the "latest" search from pg_control's timeline */
recoveryTargetTLI = findNewestTimeLine(recoveryTargetTLI);
recoveryTargetIsLatest = true;
}
}
FreeConfigVariables(head);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册