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

Commit1bd42cd

Browse files
committed
Better fix for "unarchived WAL files get deleted on crash recovery" bug.
Revert my earlier fix for the bug that unarchived WAL files get deleted oncrash recovery, commitc9cc7e0. We createa .done file for files streamed or restored from archive, so the WAL filerecycling logic used during normal operation works just as well duringarchive recovery.Per Fujii Masao's suggestion.
1 parentc2f79ba commit1bd42cd

File tree

1 file changed

+1
-29
lines changed
  • src/backend/access/transam

1 file changed

+1
-29
lines changed

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

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,6 @@ typedef struct XLogCtlData
433433
* recovery. Protected by info_lck.
434434
*/
435435
boolSharedRecoveryInProgress;
436-
boolSharedInArchiveRecovery;
437436

438437
/*
439438
* SharedHotStandbyActive indicates if we're still in crash or archive
@@ -620,7 +619,6 @@ static bool bgwriterLaunched = false;
620619

621620
staticvoidreadRecoveryCommandFile(void);
622621
staticvoidexitArchiveRecovery(TimeLineIDendTLI,XLogSegNoendLogSegNo);
623-
staticboolArchiveRecoveryInProgress(void);
624622
staticboolrecoveryStopsHere(XLogRecord*record,bool*includeThis);
625623
staticvoidrecoveryPausesHere(void);
626624
staticvoidSetLatestXTime(TimestampTzxtime);
@@ -2925,7 +2923,7 @@ RemoveOldXlogFiles(XLogSegNo segno, XLogRecPtr endptr)
29252923
strspn(xlde->d_name,"0123456789ABCDEF")==24&&
29262924
strcmp(xlde->d_name+8,lastoff+8) <=0)
29272925
{
2928-
if (ArchiveRecoveryInProgress()||XLogArchiveCheckDone(xlde->d_name))
2926+
if (XLogArchiveCheckDone(xlde->d_name))
29292927
{
29302928
snprintf(path,MAXPGPATH,XLOGDIR"/%s",xlde->d_name);
29312929

@@ -3871,7 +3869,6 @@ XLOGShmemInit(void)
38713869
*/
38723870
XLogCtl->XLogCacheBlck=XLOGbuffers-1;
38733871
XLogCtl->SharedRecoveryInProgress= true;
3874-
XLogCtl->SharedInArchiveRecovery= false;
38753872
XLogCtl->SharedHotStandbyActive= false;
38763873
XLogCtl->WalWriterSleeping= false;
38773874
XLogCtl->Insert.currpage= (XLogPageHeader) (XLogCtl->pages);
@@ -4265,7 +4262,6 @@ readRecoveryCommandFile(void)
42654262

42664263
/* Enable fetching from archive recovery area */
42674264
InArchiveRecovery= true;
4268-
XLogCtl->SharedInArchiveRecovery= true;
42694265

42704266
/*
42714267
* If user specified recovery_target_timeline, validate it or compute the
@@ -4304,16 +4300,11 @@ exitArchiveRecovery(TimeLineID endTLI, XLogSegNo endLogSegNo)
43044300
{
43054301
charrecoveryPath[MAXPGPATH];
43064302
charxlogpath[MAXPGPATH];
4307-
/* use volatile pointer to prevent code rearrangement */
4308-
volatileXLogCtlData*xlogctl=XLogCtl;
43094303

43104304
/*
43114305
* We are no longer in archive recovery state.
43124306
*/
43134307
InArchiveRecovery= false;
4314-
SpinLockAcquire(&xlogctl->info_lck);
4315-
xlogctl->SharedInArchiveRecovery= false;
4316-
SpinLockRelease(&xlogctl->info_lck);
43174308

43184309
/*
43194310
* Update min recovery point one last time.
@@ -6110,25 +6101,6 @@ RecoveryInProgress(void)
61106101
}
61116102
}
61126103

6113-
/*
6114-
* Are we currently in archive recovery? In the startup process, you can just
6115-
* check InArchiveRecovery variable instead.
6116-
*/
6117-
staticbool
6118-
ArchiveRecoveryInProgress()
6119-
{
6120-
boolresult;
6121-
/* use volatile pointer to prevent code rearrangement */
6122-
volatileXLogCtlData*xlogctl=XLogCtl;
6123-
6124-
/* spinlock is essential on machines with weak memory ordering! */
6125-
SpinLockAcquire(&xlogctl->info_lck);
6126-
result=xlogctl->SharedInArchiveRecovery;
6127-
SpinLockRelease(&xlogctl->info_lck);
6128-
6129-
returnresult;
6130-
}
6131-
61326104
/*
61336105
* Is HotStandby active yet? This is only important in special backends
61346106
* since normal backends won't ever be able to connect until this returns

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp