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

Commit7ccefe8

Browse files
committed
Fix tli history file fetching, broken by the archive after crash recevery patch.
If we were about to enter archive recovery after crash recovery, we scannedthe archive for the latest tli history file, and set the recovery targettimeline to that. However, when we actually tried to read the history file,we would not fetch the file from the archive, because we were not in archiverecovery yet.To fix, make readTimeLineHistory and existsTimeLineHistory to always fetchthe file from archive if archive recovery is requested, even if we're not inarchive recovery yet.Backpatch to 9.2. Mitsumasa KONDO
1 parent1908abc commit7ccefe8

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ readTimeLineHistory(TimeLineID targetTLI)
9292
returnlist_make1(entry);
9393
}
9494

95-
if (InArchiveRecovery)
95+
if (ArchiveRecoveryRequested)
9696
{
9797
TLHistoryFileName(histfname,targetTLI);
9898
fromArchive=
@@ -213,7 +213,7 @@ existsTimeLineHistory(TimeLineID probeTLI)
213213
if (probeTLI==1)
214214
return false;
215215

216-
if (InArchiveRecovery)
216+
if (ArchiveRecoveryRequested)
217217
{
218218
TLHistoryFileName(histfname,probeTLI);
219219
RestoreArchivedFile(path,histfname,"RECOVERYHISTORY",0, false);
@@ -316,7 +316,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI,
316316
/*
317317
* If a history file exists for the parent, copy it verbatim
318318
*/
319-
if (InArchiveRecovery)
319+
if (ArchiveRecoveryRequested)
320320
{
321321
TLHistoryFileName(histfname,parentTLI);
322322
RestoreArchivedFile(path,histfname,"RECOVERYHISTORY",0, false);

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static intLocalXLogInsertAllowed = -1;
200200
* will switch to using offline XLOG archives as soon as we reach the end of
201201
* WAL in pg_xlog.
202202
*/
203-
staticboolArchiveRecoveryRequested= false;
203+
boolArchiveRecoveryRequested= false;
204204
boolInArchiveRecovery= false;
205205

206206
/* Was the last xlog file restored from archive, or local? */
@@ -4339,11 +4339,6 @@ readRecoveryCommandFile(void)
43394339
*/
43404340
if (rtliGiven)
43414341
{
4342-
/*
4343-
* Temporarily set InArchiveRecovery, so that existsTimeLineHistory
4344-
* or findNewestTimeLine below will check the archive.
4345-
*/
4346-
InArchiveRecovery= true;
43474342
if (rtli)
43484343
{
43494344
/* Timeline 1 does not have a history file, all else should */
@@ -4360,7 +4355,6 @@ readRecoveryCommandFile(void)
43604355
recoveryTargetTLI=findNewestTimeLine(recoveryTargetTLI);
43614356
recoveryTargetIsLatest= true;
43624357
}
4363-
InArchiveRecovery= false;
43644358
}
43654359

43664360
FreeConfigVariables(head);

‎src/include/access/xlog_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ extern void GetOldestRestartPoint(XLogRecPtr *oldrecptr, TimeLineID *oldtli);
263263
* Exported for the functions in timeline.c and xlogarchive.c. Only valid
264264
* in the startup process.
265265
*/
266+
externboolArchiveRecoveryRequested;
266267
externboolInArchiveRecovery;
267268
externboolStandbyMode;
268269
externchar*recoveryRestoreCommand;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp