@@ -97,6 +97,7 @@ typedef struct ControlFileData
97
97
XLogRecPtr checkPoint ; /* last check point record ptr */
98
98
time_t time ; /* time stamp of last modification */
99
99
DBState state ; /* */
100
+ uint32 blcksz ; /* block size for this DB */
100
101
/* MORE DATA FOLLOWS AT THE END OF THIS STRUCTURE
101
102
* - locations of data dirs
102
103
*/
@@ -1162,6 +1163,7 @@ BootStrapXLOG()
1162
1163
ControlFile -> checkPoint = checkPoint .redo ;
1163
1164
ControlFile -> time = time (NULL );
1164
1165
ControlFile -> state = DB_SHUTDOWNED ;
1166
+ ControlFile -> blcksz = BLCKSZ ;
1165
1167
1166
1168
if (write (fd , buffer , BLCKSZ ) != BLCKSZ )
1167
1169
elog (STOP , "BootStrapXLOG failed to write control file: %d" , errno );
@@ -1249,6 +1251,9 @@ StartupXLOG()
1249
1251
!XRecOffIsValid (ControlFile -> checkPoint .xrecoff ))
1250
1252
elog (STOP , "Control file context is broken" );
1251
1253
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
+
1252
1257
if (ControlFile -> state == DB_SHUTDOWNED )
1253
1258
elog (LOG , "Data Base System was shutdowned at %s" ,
1254
1259
str_time (ControlFile -> time ));
0 commit comments