Skip to content
Snippets Groups Projects
Commit 7adb1b00 authored by Tatsuo Ishii's avatar Tatsuo Ishii
Browse files

Add blcksz to struct ControlFileData to check BLCKSZ is same

as BLCKSZ which the backend was compiled in.
parent 433c2135
No related branches found
No related tags found
No related merge requests found
...@@ -97,6 +97,7 @@ typedef struct ControlFileData ...@@ -97,6 +97,7 @@ typedef struct ControlFileData
XLogRecPtr checkPoint; /* last check point record ptr */ XLogRecPtr checkPoint; /* last check point record ptr */
time_t time; /* time stamp of last modification */ time_t time; /* time stamp of last modification */
DBState state; /* */ DBState state; /* */
uint32 blcksz; /* block size for this DB */
/* MORE DATA FOLLOWS AT THE END OF THIS STRUCTURE /* MORE DATA FOLLOWS AT THE END OF THIS STRUCTURE
* - locations of data dirs * - locations of data dirs
*/ */
...@@ -1162,6 +1163,7 @@ BootStrapXLOG() ...@@ -1162,6 +1163,7 @@ BootStrapXLOG()
ControlFile->checkPoint = checkPoint.redo; ControlFile->checkPoint = checkPoint.redo;
ControlFile->time = time(NULL); ControlFile->time = time(NULL);
ControlFile->state = DB_SHUTDOWNED; ControlFile->state = DB_SHUTDOWNED;
ControlFile->blcksz = BLCKSZ;
if (write(fd, buffer, BLCKSZ) != BLCKSZ) if (write(fd, buffer, BLCKSZ) != BLCKSZ)
elog(STOP, "BootStrapXLOG failed to write control file: %d", errno); elog(STOP, "BootStrapXLOG failed to write control file: %d", errno);
...@@ -1249,6 +1251,9 @@ tryAgain: ...@@ -1249,6 +1251,9 @@ tryAgain:
!XRecOffIsValid(ControlFile->checkPoint.xrecoff)) !XRecOffIsValid(ControlFile->checkPoint.xrecoff))
elog(STOP, "Control file context is broken"); elog(STOP, "Control file context is broken");
if (ControlFile->blcksz != BLCKSZ)
elog(STOP, "database was initialized in BLCKSZ(%d), but the backend was compiled in BLCKSZ(%d)",ControlFile->blcksz,BLCKSZ);
if (ControlFile->state == DB_SHUTDOWNED) if (ControlFile->state == DB_SHUTDOWNED)
elog(LOG, "Data Base System was shutdowned at %s", elog(LOG, "Data Base System was shutdowned at %s",
str_time(ControlFile->time)); str_time(ControlFile->time));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment