Record data_checksum_version in control file.
The value is not used anywhere in code, but will allow future changes to the checksum version should that become necessary in the future.
This commit is contained in:
parent
730924397c
commit
443951748c
@ -60,7 +60,7 @@
|
|||||||
#include "utils/timestamp.h"
|
#include "utils/timestamp.h"
|
||||||
#include "pg_trace.h"
|
#include "pg_trace.h"
|
||||||
|
|
||||||
extern bool bootstrap_data_checksums;
|
extern uint32 bootstrap_data_checksum_version;
|
||||||
|
|
||||||
/* File path names (all relative to $PGDATA) */
|
/* File path names (all relative to $PGDATA) */
|
||||||
#define RECOVERY_COMMAND_FILE "recovery.conf"
|
#define RECOVERY_COMMAND_FILE "recovery.conf"
|
||||||
@ -3797,7 +3797,7 @@ bool
|
|||||||
DataChecksumsEnabled(void)
|
DataChecksumsEnabled(void)
|
||||||
{
|
{
|
||||||
Assert(ControlFile != NULL);
|
Assert(ControlFile != NULL);
|
||||||
return ControlFile->data_checksums;
|
return (ControlFile->data_checksum_version > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4126,7 +4126,7 @@ BootStrapXLOG(void)
|
|||||||
ControlFile->max_prepared_xacts = max_prepared_xacts;
|
ControlFile->max_prepared_xacts = max_prepared_xacts;
|
||||||
ControlFile->max_locks_per_xact = max_locks_per_xact;
|
ControlFile->max_locks_per_xact = max_locks_per_xact;
|
||||||
ControlFile->wal_level = wal_level;
|
ControlFile->wal_level = wal_level;
|
||||||
ControlFile->data_checksums = bootstrap_data_checksums;
|
ControlFile->data_checksum_version = bootstrap_data_checksum_version;
|
||||||
|
|
||||||
/* some additional ControlFile fields are set in WriteControlFile() */
|
/* some additional ControlFile fields are set in WriteControlFile() */
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "postmaster/walwriter.h"
|
#include "postmaster/walwriter.h"
|
||||||
#include "replication/walreceiver.h"
|
#include "replication/walreceiver.h"
|
||||||
#include "storage/bufmgr.h"
|
#include "storage/bufmgr.h"
|
||||||
|
#include "storage/bufpage.h"
|
||||||
#include "storage/ipc.h"
|
#include "storage/ipc.h"
|
||||||
#include "storage/proc.h"
|
#include "storage/proc.h"
|
||||||
#include "tcop/tcopprot.h"
|
#include "tcop/tcopprot.h"
|
||||||
@ -48,7 +49,7 @@
|
|||||||
extern int optind;
|
extern int optind;
|
||||||
extern char *optarg;
|
extern char *optarg;
|
||||||
|
|
||||||
bool bootstrap_data_checksums = false;
|
uint32 bootstrap_data_checksum_version = 0; /* No checksum */
|
||||||
|
|
||||||
|
|
||||||
#define ALLOC(t, c) ((t *) calloc((unsigned)(c), sizeof(t)))
|
#define ALLOC(t, c) ((t *) calloc((unsigned)(c), sizeof(t)))
|
||||||
@ -262,7 +263,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
|
|||||||
SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
|
SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
bootstrap_data_checksums = true;
|
bootstrap_data_checksum_version = PG_DATA_CHECKSUM_VERSION;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
strlcpy(OutputFileName, optarg, MAXPGPATH);
|
strlcpy(OutputFileName, optarg, MAXPGPATH);
|
||||||
|
@ -287,7 +287,7 @@ main(int argc, char *argv[])
|
|||||||
(ControlFile.float4ByVal ? _("by value") : _("by reference")));
|
(ControlFile.float4ByVal ? _("by value") : _("by reference")));
|
||||||
printf(_("Float8 argument passing: %s\n"),
|
printf(_("Float8 argument passing: %s\n"),
|
||||||
(ControlFile.float8ByVal ? _("by value") : _("by reference")));
|
(ControlFile.float8ByVal ? _("by value") : _("by reference")));
|
||||||
printf(_("Data page checksums: %s\n"),
|
printf(_("Data page checksum version: %u\n"),
|
||||||
(ControlFile.data_checksums ? _("enabled") : _("disabled")));
|
ControlFile.data_checksum_version);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -624,8 +624,8 @@ PrintControlValues(bool guessed)
|
|||||||
(ControlFile.float4ByVal ? _("by value") : _("by reference")));
|
(ControlFile.float4ByVal ? _("by value") : _("by reference")));
|
||||||
printf(_("Float8 argument passing: %s\n"),
|
printf(_("Float8 argument passing: %s\n"),
|
||||||
(ControlFile.float8ByVal ? _("by value") : _("by reference")));
|
(ControlFile.float8ByVal ? _("by value") : _("by reference")));
|
||||||
printf(_("Data page checksums: %s\n"),
|
printf(_("Data page checksum version: %u\n"),
|
||||||
(ControlFile.data_checksums ? _("enabled") : _("disabled")));
|
ControlFile.data_checksum_version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -213,8 +213,8 @@ typedef struct ControlFileData
|
|||||||
bool float4ByVal; /* float4 pass-by-value? */
|
bool float4ByVal; /* float4 pass-by-value? */
|
||||||
bool float8ByVal; /* float8, int8, etc pass-by-value? */
|
bool float8ByVal; /* float8, int8, etc pass-by-value? */
|
||||||
|
|
||||||
/* Are data pages protected by checksums? */
|
/* Are data pages protected by checksums? Zero if no checksum version */
|
||||||
bool data_checksums;
|
uint32 data_checksum_version;
|
||||||
|
|
||||||
/* CRC of all above ... MUST BE LAST! */
|
/* CRC of all above ... MUST BE LAST! */
|
||||||
pg_crc32 crc;
|
pg_crc32 crc;
|
||||||
|
@ -189,9 +189,12 @@ typedef PageHeaderData *PageHeader;
|
|||||||
* Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and
|
* Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and
|
||||||
* added the pd_flags field (by stealing some bits from pd_tli),
|
* added the pd_flags field (by stealing some bits from pd_tli),
|
||||||
* as well as adding the pd_prune_xid field (which enlarges the header).
|
* as well as adding the pd_prune_xid field (which enlarges the header).
|
||||||
|
*
|
||||||
|
* As of Release 9.3, the checksum version must also be considered when
|
||||||
|
* handling pages.
|
||||||
*/
|
*/
|
||||||
#define PG_PAGE_LAYOUT_VERSION 4
|
#define PG_PAGE_LAYOUT_VERSION 4
|
||||||
|
#define PG_DATA_CHECKSUM_VERSION 1
|
||||||
|
|
||||||
/* ----------------------------------------------------------------
|
/* ----------------------------------------------------------------
|
||||||
* page support macros
|
* page support macros
|
||||||
|
Loading…
x
Reference in New Issue
Block a user