1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-14 02:22:38 +03:00

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:
Peter Eisentraut
2024-07-23 09:53:54 +02:00
parent ffb0603929
commit 935e675f3c
3 changed files with 8 additions and 11 deletions

View File

@@ -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;