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

Commit2387f52

Browse files
committed
Remove useless arguments in ReadCheckpointRecord().
This commit removes two arguments "report" and "whichChkpt"in ReadCheckpointRecord()."report" is obviously useless because it's always true, i.e., there aretwo callers of the function and they always specify true as "report".Commit1d919de removed the only call with "report" = false."whichChkpt" indicated where the specified checkpoint locationcame from, pg_control or backup_label. This information was usedto report different error messages depending on where the invalidcheckpoint record came from, when it was found.But ReadCheckpointRecord() doesn't need to do that becauseits callers already do that and users can still identify wherethe invalid checkpoint record came from, by reading such log messages.Also when "whichChkpt" was 0, the word "primary checkpoint" was usedin the log message and could confuse users because the concept ofprimary and secondary checkpoints was already removed before.These are why this commit removes "whichChkpt" argument.Author: Fujii MasaoReviewed-by: Bharath Rupireddy, Kyotaro HoriguchiDiscussion:https://postgr.es/m/fa2e12eb-81c3-0717-0272-755f8a81c8f2@oss.nttdata.com
1 parent6955bba commit2387f52

File tree

1 file changed

+15
-69
lines changed

1 file changed

+15
-69
lines changed

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

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,8 @@ static XLogPageReadResult WaitForWALToBecomeAvailable(XLogRecPtr RecPtr,
422422
XLogRecPtrreplayLSN,
423423
boolnonblocking);
424424
staticintemode_for_corrupt_record(intemode,XLogRecPtrRecPtr);
425-
staticXLogRecord*ReadCheckpointRecord(XLogPrefetcher*xlogprefetcher,XLogRecPtrRecPtr,
426-
intwhichChkpt,boolreport,TimeLineIDreplayTLI);
425+
staticXLogRecord*ReadCheckpointRecord(XLogPrefetcher*xlogprefetcher,
426+
XLogRecPtrRecPtr,TimeLineIDreplayTLI);
427427
staticboolrescanLatestTimeLine(TimeLineIDreplayTLI,XLogRecPtrreplayLSN);
428428
staticintXLogFileRead(XLogSegNosegno,intemode,TimeLineIDtli,
429429
XLogSourcesource,boolnotfoundOk);
@@ -605,7 +605,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
605605
* When a backup_label file is present, we want to roll forward from
606606
* the checkpoint it identifies, rather than using pg_control.
607607
*/
608-
record=ReadCheckpointRecord(xlogprefetcher,CheckPointLoc,0, true,
608+
record=ReadCheckpointRecord(xlogprefetcher,CheckPointLoc,
609609
CheckPointTLI);
610610
if (record!=NULL)
611611
{
@@ -744,7 +744,7 @@ InitWalRecovery(ControlFileData *ControlFile, bool *wasShutdown_ptr,
744744
CheckPointTLI=ControlFile->checkPointCopy.ThisTimeLineID;
745745
RedoStartLSN=ControlFile->checkPointCopy.redo;
746746
RedoStartTLI=ControlFile->checkPointCopy.ThisTimeLineID;
747-
record=ReadCheckpointRecord(xlogprefetcher,CheckPointLoc,1, true,
747+
record=ReadCheckpointRecord(xlogprefetcher,CheckPointLoc,
748748
CheckPointTLI);
749749
if (record!=NULL)
750750
{
@@ -3843,13 +3843,10 @@ emode_for_corrupt_record(int emode, XLogRecPtr RecPtr)
38433843

38443844
/*
38453845
* Subroutine to try to fetch and validate a prior checkpoint record.
3846-
*
3847-
* whichChkpt identifies the checkpoint (merely for reporting purposes).
3848-
* 1 for "primary", 0 for "other" (backup_label)
38493846
*/
38503847
staticXLogRecord*
38513848
ReadCheckpointRecord(XLogPrefetcher*xlogprefetcher,XLogRecPtrRecPtr,
3852-
intwhichChkpt,boolreport,TimeLineIDreplayTLI)
3849+
TimeLineIDreplayTLI)
38533850
{
38543851
XLogRecord*record;
38553852
uint8info;
@@ -3858,20 +3855,8 @@ ReadCheckpointRecord(XLogPrefetcher *xlogprefetcher, XLogRecPtr RecPtr,
38583855

38593856
if (!XRecOffIsValid(RecPtr))
38603857
{
3861-
if (!report)
3862-
returnNULL;
3863-
3864-
switch (whichChkpt)
3865-
{
3866-
case1:
3867-
ereport(LOG,
3868-
(errmsg("invalid primary checkpoint link in control file")));
3869-
break;
3870-
default:
3871-
ereport(LOG,
3872-
(errmsg("invalid checkpoint link in backup_label file")));
3873-
break;
3874-
}
3858+
ereport(LOG,
3859+
(errmsg("invalid checkpoint location")));
38753860
returnNULL;
38763861
}
38773862

@@ -3880,67 +3865,28 @@ ReadCheckpointRecord(XLogPrefetcher *xlogprefetcher, XLogRecPtr RecPtr,
38803865

38813866
if (record==NULL)
38823867
{
3883-
if (!report)
3884-
returnNULL;
3885-
3886-
switch (whichChkpt)
3887-
{
3888-
case1:
3889-
ereport(LOG,
3890-
(errmsg("invalid primary checkpoint record")));
3891-
break;
3892-
default:
3893-
ereport(LOG,
3894-
(errmsg("invalid checkpoint record")));
3895-
break;
3896-
}
3868+
ereport(LOG,
3869+
(errmsg("invalid checkpoint record")));
38973870
returnNULL;
38983871
}
38993872
if (record->xl_rmid!=RM_XLOG_ID)
39003873
{
3901-
switch (whichChkpt)
3902-
{
3903-
case1:
3904-
ereport(LOG,
3905-
(errmsg("invalid resource manager ID in primary checkpoint record")));
3906-
break;
3907-
default:
3908-
ereport(LOG,
3909-
(errmsg("invalid resource manager ID in checkpoint record")));
3910-
break;
3911-
}
3874+
ereport(LOG,
3875+
(errmsg("invalid resource manager ID in checkpoint record")));
39123876
returnNULL;
39133877
}
39143878
info=record->xl_info& ~XLR_INFO_MASK;
39153879
if (info!=XLOG_CHECKPOINT_SHUTDOWN&&
39163880
info!=XLOG_CHECKPOINT_ONLINE)
39173881
{
3918-
switch (whichChkpt)
3919-
{
3920-
case1:
3921-
ereport(LOG,
3922-
(errmsg("invalid xl_info in primary checkpoint record")));
3923-
break;
3924-
default:
3925-
ereport(LOG,
3926-
(errmsg("invalid xl_info in checkpoint record")));
3927-
break;
3928-
}
3882+
ereport(LOG,
3883+
(errmsg("invalid xl_info in checkpoint record")));
39293884
returnNULL;
39303885
}
39313886
if (record->xl_tot_len!=SizeOfXLogRecord+SizeOfXLogRecordDataHeaderShort+sizeof(CheckPoint))
39323887
{
3933-
switch (whichChkpt)
3934-
{
3935-
case1:
3936-
ereport(LOG,
3937-
(errmsg("invalid length of primary checkpoint record")));
3938-
break;
3939-
default:
3940-
ereport(LOG,
3941-
(errmsg("invalid length of checkpoint record")));
3942-
break;
3943-
}
3888+
ereport(LOG,
3889+
(errmsg("invalid length of checkpoint record")));
39443890
returnNULL;
39453891
}
39463892
returnrecord;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp