Remove useless arguments in ReadCheckpointRecord(). - Mailing list pgsql-hackers

From Fujii Masao
Subject Remove useless arguments in ReadCheckpointRecord().
Date
Msg-id fa2e12eb-81c3-0717-0272-755f8a81c8f2@oss.nttdata.com
Whole thread Raw
Responses Re: Remove useless arguments in ReadCheckpointRecord().
List pgsql-hackers
Hi,

I'd like to propose to remove "whichChkpt" and "report" arguments in ReadCheckpointRecord(). "report" is obviously
uselessbecause it's always true, i.e., there are two callers of the function and they always specify true as "report".
 

"whichChkpt" indicates where the specified checkpoint location came from, pg_control or backup_label. This information
isused to log different messages as follows.
 

        switch (whichChkpt)
        {
            case 1:
                ereport(LOG,
                        (errmsg("invalid primary checkpoint link in control file")));
                break;
            default:
                ereport(LOG,
                        (errmsg("invalid checkpoint link in backup_label file")));
                break;
        }
        return NULL;
        ...
        switch (whichChkpt)
        {
            case 1:
                ereport(LOG,
                        (errmsg("invalid primary checkpoint record")));
                break;
            default:
                ereport(LOG,
                        (errmsg("invalid checkpoint record")));
                break;
        }
        return NULL;
        ...

But the callers of ReadCheckpointRecord() already output different log messages depending on where the invalid
checkpointrecord came from. So even if ReadCheckpointRecord() doesn't use "whichChkpt", i.e., use the same log message
inboth pg_control and backup_label cases, users can still identify where the invalid checkpoint record came from, by
readingthe log message.
 

Also when whichChkpt = 0, "primary checkpoint" is used in the log message and sounds confusing because, as far as I
recallcorrectly, we removed the concept of primary and secondary checkpoints before.
 

  Therefore I think that it's better to remove "whichChkpt" argument in ReadCheckpointRecord().

Patch attached. Thought?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Attachment

pgsql-hackers by date:

Previous
From: Önder Kalacı
Date:
Subject: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Next
From: Justin Pryzby
Date:
Subject: [PATCH] Renumber confusing value for GUC_UNIT_BYTE