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

Commit4439517

Browse files
Record data_checksum_version in control file.
The value is not used anywhere in code, but willallow future changes to the checksum versionshould that become necessary in the future.
1 parent7309243 commit4439517

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#include"utils/timestamp.h"
6161
#include"pg_trace.h"
6262

63-
externboolbootstrap_data_checksums;
63+
externuint32bootstrap_data_checksum_version;
6464

6565
/* File path names (all relative to $PGDATA) */
6666
#defineRECOVERY_COMMAND_FILE"recovery.conf"
@@ -3797,7 +3797,7 @@ bool
37973797
DataChecksumsEnabled(void)
37983798
{
37993799
Assert(ControlFile!=NULL);
3800-
returnControlFile->data_checksums;
3800+
return(ControlFile->data_checksum_version>0);
38013801
}
38023802

38033803
/*
@@ -4126,7 +4126,7 @@ BootStrapXLOG(void)
41264126
ControlFile->max_prepared_xacts=max_prepared_xacts;
41274127
ControlFile->max_locks_per_xact=max_locks_per_xact;
41284128
ControlFile->wal_level=wal_level;
4129-
ControlFile->data_checksums=bootstrap_data_checksums;
4129+
ControlFile->data_checksum_version=bootstrap_data_checksum_version;
41304130

41314131
/* some additional ControlFile fields are set in WriteControlFile() */
41324132

‎src/backend/bootstrap/bootstrap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include"postmaster/walwriter.h"
3535
#include"replication/walreceiver.h"
3636
#include"storage/bufmgr.h"
37+
#include"storage/bufpage.h"
3738
#include"storage/ipc.h"
3839
#include"storage/proc.h"
3940
#include"tcop/tcopprot.h"
@@ -48,7 +49,7 @@
4849
externintoptind;
4950
externchar*optarg;
5051

51-
boolbootstrap_data_checksums=false;
52+
uint32bootstrap_data_checksum_version=0;/* No checksum */
5253

5354

5455
#defineALLOC(t,c)((t *) calloc((unsigned)(c), sizeof(t)))
@@ -262,7 +263,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
262263
SetConfigOption("fsync","false",PGC_POSTMASTER,PGC_S_ARGV);
263264
break;
264265
case'k':
265-
bootstrap_data_checksums=true;
266+
bootstrap_data_checksum_version=PG_DATA_CHECKSUM_VERSION;
266267
break;
267268
case'r':
268269
strlcpy(OutputFileName,optarg,MAXPGPATH);

‎src/bin/pg_controldata/pg_controldata.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ main(int argc, char *argv[])
287287
(ControlFile.float4ByVal ?_("by value") :_("by reference")));
288288
printf(_("Float8 argument passing: %s\n"),
289289
(ControlFile.float8ByVal ?_("by value") :_("by reference")));
290-
printf(_("Data pagechecksums: %s\n"),
291-
(ControlFile.data_checksums ?_("enabled") :_("disabled")));
290+
printf(_("Data pagechecksum version:%u\n"),
291+
ControlFile.data_checksum_version);
292292
return0;
293293
}

‎src/bin/pg_resetxlog/pg_resetxlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,8 +624,8 @@ PrintControlValues(bool guessed)
624624
(ControlFile.float4ByVal ?_("by value") :_("by reference")));
625625
printf(_("Float8 argument passing: %s\n"),
626626
(ControlFile.float8ByVal ?_("by value") :_("by reference")));
627-
printf(_("Data pagechecksums: %s\n"),
628-
(ControlFile.data_checksums ?_("enabled") :_("disabled")));
627+
printf(_("Data pagechecksum version:%u\n"),
628+
ControlFile.data_checksum_version);
629629
}
630630

631631

‎src/include/catalog/pg_control.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ typedef struct ControlFileData
213213
boolfloat4ByVal;/* float4 pass-by-value? */
214214
boolfloat8ByVal;/* float8, int8, etc pass-by-value? */
215215

216-
/* Are data pages protected by checksums? */
217-
booldata_checksums;
216+
/* Are data pages protected by checksums?Zero if no checksum version*/
217+
uint32data_checksum_version;
218218

219219
/* CRC of all above ... MUST BE LAST! */
220220
pg_crc32crc;

‎src/include/storage/bufpage.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,12 @@ typedef PageHeaderData *PageHeader;
189189
* Release 8.3 uses 4; it changed the HeapTupleHeader layout again, and
190190
*added the pd_flags field (by stealing some bits from pd_tli),
191191
*as well as adding the pd_prune_xid field (which enlarges the header).
192+
*
193+
* As of Release 9.3, the checksum version must also be considered when
194+
* handling pages.
192195
*/
193196
#definePG_PAGE_LAYOUT_VERSION4
194-
197+
#definePG_DATA_CHECKSUM_VERSION1
195198

196199
/* ----------------------------------------------------------------
197200
*page support macros

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp