Skip to content

Commit 7adb1b0

Browse files
committed
Add blcksz to struct ControlFileData to check BLCKSZ is same
as BLCKSZ which the backend was compiled in.
1 parent 433c213 commit 7adb1b0

File tree

1 file changed

+5
-0
lines changed
  • src/backend/access/transam

1 file changed

+5
-0
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ typedef struct ControlFileData
9797
XLogRecPtr checkPoint; /* last check point record ptr */
9898
time_t time; /* time stamp of last modification */
9999
DBState state; /* */
100+
uint32 blcksz; /* block size for this DB */
100101
/* MORE DATA FOLLOWS AT THE END OF THIS STRUCTURE
101102
* - locations of data dirs
102103
*/
@@ -1162,6 +1163,7 @@ BootStrapXLOG()
11621163
ControlFile->checkPoint = checkPoint.redo;
11631164
ControlFile->time = time(NULL);
11641165
ControlFile->state = DB_SHUTDOWNED;
1166+
ControlFile->blcksz = BLCKSZ;
11651167

11661168
if (write(fd, buffer, BLCKSZ) != BLCKSZ)
11671169
elog(STOP, "BootStrapXLOG failed to write control file: %d", errno);
@@ -1249,6 +1251,9 @@ StartupXLOG()
12491251
!XRecOffIsValid(ControlFile->checkPoint.xrecoff))
12501252
elog(STOP, "Control file context is broken");
12511253

1254+
if (ControlFile->blcksz != BLCKSZ)
1255+
elog(STOP, "database was initialized in BLCKSZ(%d), but the backend was compiled in BLCKSZ(%d)",ControlFile->blcksz,BLCKSZ);
1256+
12521257
if (ControlFile->state == DB_SHUTDOWNED)
12531258
elog(LOG, "Data Base System was shutdowned at %s",
12541259
str_time(ControlFile->time));

0 commit comments

Comments
 (0)