mirror of https://github.com/postgres/postgres
Get rid of a global variable
bootstrap_data_checksum_version can just as easily be passed to where it is used via function arguments. Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://www.postgresql.org/message-id/flat/e0a62134-83da-4ba4-8cdb-ceb0111c95ce@eisentraut.org
This commit is contained in:
parent
ffb0603929
commit
935e675f3c
|
@ -105,8 +105,6 @@
|
|||
#include "utils/timestamp.h"
|
||||
#include "utils/varlena.h"
|
||||
|
||||
extern uint32 bootstrap_data_checksum_version;
|
||||
|
||||
/* timeline ID to be used when bootstrapping */
|
||||
#define BootstrapTimeLineID 1
|
||||
|
||||
|
@ -683,7 +681,7 @@ static void ValidateXLOGDirectoryStructure(void);
|
|||
static void CleanupBackupHistory(void);
|
||||
static void UpdateMinRecoveryPoint(XLogRecPtr lsn, bool force);
|
||||
static bool PerformRecoveryXLogAction(void);
|
||||
static void InitControlFile(uint64 sysidentifier);
|
||||
static void InitControlFile(uint64 sysidentifier, uint32 data_checksum_version);
|
||||
static void WriteControlFile(void);
|
||||
static void ReadControlFile(void);
|
||||
static void UpdateControlFile(void);
|
||||
|
@ -4190,7 +4188,7 @@ CleanupBackupHistory(void)
|
|||
*/
|
||||
|
||||
static void
|
||||
InitControlFile(uint64 sysidentifier)
|
||||
InitControlFile(uint64 sysidentifier, uint32 data_checksum_version)
|
||||
{
|
||||
char mock_auth_nonce[MOCK_AUTH_NONCE_LEN];
|
||||
|
||||
|
@ -4221,7 +4219,7 @@ InitControlFile(uint64 sysidentifier)
|
|||
ControlFile->wal_level = wal_level;
|
||||
ControlFile->wal_log_hints = wal_log_hints;
|
||||
ControlFile->track_commit_timestamp = track_commit_timestamp;
|
||||
ControlFile->data_checksum_version = bootstrap_data_checksum_version;
|
||||
ControlFile->data_checksum_version = data_checksum_version;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4997,7 +4995,7 @@ XLOGShmemInit(void)
|
|||
* and the initial XLOG segment.
|
||||
*/
|
||||
void
|
||||
BootStrapXLOG(void)
|
||||
BootStrapXLOG(uint32 data_checksum_version)
|
||||
{
|
||||
CheckPoint checkPoint;
|
||||
char *buffer;
|
||||
|
@ -5139,7 +5137,7 @@ BootStrapXLOG(void)
|
|||
openLogFile = -1;
|
||||
|
||||
/* Now create pg_control */
|
||||
InitControlFile(sysidentifier);
|
||||
InitControlFile(sysidentifier, data_checksum_version);
|
||||
ControlFile->time = checkPoint.time;
|
||||
ControlFile->checkPoint = checkPoint.redo;
|
||||
ControlFile->checkPointCopy = checkPoint;
|
||||
|
|
|
@ -41,8 +41,6 @@
|
|||
#include "utils/rel.h"
|
||||
#include "utils/relmapper.h"
|
||||
|
||||
uint32 bootstrap_data_checksum_version = 0; /* No checksum */
|
||||
|
||||
|
||||
static void CheckerModeMain(void);
|
||||
static void bootstrap_signals(void);
|
||||
|
@ -202,6 +200,7 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
|
|||
char *progname = argv[0];
|
||||
int flag;
|
||||
char *userDoption = NULL;
|
||||
uint32 bootstrap_data_checksum_version = 0; /* No checksum */
|
||||
|
||||
Assert(!IsUnderPostmaster);
|
||||
|
||||
|
@ -332,7 +331,7 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
|
|||
BaseInit();
|
||||
|
||||
bootstrap_signals();
|
||||
BootStrapXLOG();
|
||||
BootStrapXLOG(bootstrap_data_checksum_version);
|
||||
|
||||
/*
|
||||
* To ensure that src/common/link-canary.c is linked into the backend, we
|
||||
|
|
|
@ -231,7 +231,7 @@ extern bool DataChecksumsEnabled(void);
|
|||
extern XLogRecPtr GetFakeLSNForUnloggedRel(void);
|
||||
extern Size XLOGShmemSize(void);
|
||||
extern void XLOGShmemInit(void);
|
||||
extern void BootStrapXLOG(void);
|
||||
extern void BootStrapXLOG(uint32 data_checksum_version);
|
||||
extern void InitializeWalConsistencyChecking(void);
|
||||
extern void LocalProcessControlFile(bool reset);
|
||||
extern WalLevel GetActiveWalLevelOnStandby(void);
|
||||
|
|
Loading…
Reference in New Issue