mirror of
https://github.com/postgres/postgres.git
synced 2025-06-29 10:41:53 +03:00
Check RELSEG_SIZE when postmaster starting up.
this is neccesary to make sure that the backend and the database uses same RELSEG_SIZE.
This commit is contained in:
@ -97,7 +97,13 @@ 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; /* */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* following data used to make sure that configurations for this DB
|
||||||
|
* do not conflict with the backend
|
||||||
|
*/
|
||||||
uint32 blcksz; /* block size for this DB */
|
uint32 blcksz; /* block size for this DB */
|
||||||
|
uint32 relseg_size; /* segmented file's block number */
|
||||||
/* 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
|
||||||
*/
|
*/
|
||||||
@ -1164,6 +1170,7 @@ BootStrapXLOG()
|
|||||||
ControlFile->time = time(NULL);
|
ControlFile->time = time(NULL);
|
||||||
ControlFile->state = DB_SHUTDOWNED;
|
ControlFile->state = DB_SHUTDOWNED;
|
||||||
ControlFile->blcksz = BLCKSZ;
|
ControlFile->blcksz = BLCKSZ;
|
||||||
|
ControlFile->relseg_size = RELSEG_SIZE;
|
||||||
|
|
||||||
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);
|
||||||
@ -1254,6 +1261,9 @@ tryAgain:
|
|||||||
if (ControlFile->blcksz != BLCKSZ)
|
if (ControlFile->blcksz != BLCKSZ)
|
||||||
elog(STOP, "database was initialized in BLCKSZ(%d), but the backend was compiled in BLCKSZ(%d)",ControlFile->blcksz,BLCKSZ);
|
elog(STOP, "database was initialized in BLCKSZ(%d), but the backend was compiled in BLCKSZ(%d)",ControlFile->blcksz,BLCKSZ);
|
||||||
|
|
||||||
|
if (ControlFile->relseg_size != RELSEG_SIZE)
|
||||||
|
elog(STOP, "database was initialized in RELSEG_SIZE(%d), but the backend was compiled in RELSEG_SIZE(%d)",ControlFile->relseg_size, RELSEG_SIZE);
|
||||||
|
|
||||||
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));
|
||||||
|
Reference in New Issue
Block a user