Fix OID bootstraping.

This commit is contained in:
Vadim B. Mikheev 2000-11-21 09:39:57 +00:00
parent b31e83f461
commit e8ff221d8b
2 changed files with 34 additions and 34 deletions

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc * Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.29 2000/11/21 02:11:06 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.30 2000/11/21 09:39:56 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -251,7 +251,7 @@ XLogInsert(RmgrId rmid, uint8 info, char *hdr, uint32 hdrlen, char *buf, uint32
if (len == 0 || len > MAXLOGRECSZ) if (len == 0 || len > MAXLOGRECSZ)
elog(STOP, "XLogInsert: invalid record len %u", len); elog(STOP, "XLogInsert: invalid record len %u", len);
if (IsBootstrapProcessingMode()) if (IsBootstrapProcessingMode() && rmid != RM_XLOG_ID)
{ {
RecPtr.xlogid = 0; RecPtr.xlogid = 0;
RecPtr.xrecoff = SizeOfXLogPHD; /* start of 1st checkpoint record */ RecPtr.xrecoff = SizeOfXLogPHD; /* start of 1st checkpoint record */
@ -506,7 +506,7 @@ XLogFlush(XLogRecPtr record)
fflush(stderr); fflush(stderr);
} }
if (IsBootstrapProcessingMode() || InRedo) if (InRedo)
return; return;
if (XLByteLE(record, LgwrResult.Flush)) if (XLByteLE(record, LgwrResult.Flush))
return; return;
@ -1326,8 +1326,7 @@ BootStrapXLOG()
#endif #endif
memset(buffer, 0, BLCKSZ); memset(ControlFile, 0, BLCKSZ);
ControlFile = (ControlFileData *) buffer;
ControlFile->logId = 0; ControlFile->logId = 0;
ControlFile->logSeg = 1; ControlFile->logSeg = 1;
ControlFile->checkPoint = checkPoint.redo; ControlFile->checkPoint = checkPoint.redo;
@ -1337,7 +1336,7 @@ BootStrapXLOG()
ControlFile->relseg_size = RELSEG_SIZE; ControlFile->relseg_size = RELSEG_SIZE;
ControlFile->catalog_version_no = CATALOG_VERSION_NO; ControlFile->catalog_version_no = CATALOG_VERSION_NO;
if (write(fd, buffer, BLCKSZ) != BLCKSZ) if (write(fd, ControlFile, BLCKSZ) != BLCKSZ)
elog(STOP, "BootStrapXLOG failed to write control file: %d", errno); elog(STOP, "BootStrapXLOG failed to write control file: %d", errno);
if (fsync(fd) != 0) if (fsync(fd) != 0)

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.98 2000/11/09 11:25:58 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.99 2000/11/21 09:39:57 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -341,32 +341,33 @@ BootstrapMain(int argc, char *argv[])
/* /*
* XLOG operations * XLOG operations
*/ */
if (xlogop != BS_XLOG_NOP) snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
SetProcessingMode(NormalProcessing);
if (xlogop == BS_XLOG_NOP)
StartupXLOG();
else if (xlogop == BS_XLOG_BOOTSTRAP)
{ {
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir); BootStrapXLOG();
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir); StartupXLOG();
if (xlogop == BS_XLOG_BOOTSTRAP)
BootStrapXLOG();
else
{
SetProcessingMode(NormalProcessing);
if (xlogop == BS_XLOG_STARTUP)
StartupXLOG();
else if (xlogop == BS_XLOG_CHECKPOINT)
{
#ifdef XLOG
extern void CreateDummyCaches(void);
CreateDummyCaches();
#endif
CreateCheckPoint(false);
}
else if (xlogop == BS_XLOG_SHUTDOWN)
ShutdownXLOG();
else
elog(STOP, "Unsupported XLOG op %d", xlogop);
proc_exit(0);
}
} }
else
{
if (xlogop == BS_XLOG_CHECKPOINT)
{
extern void CreateDummyCaches(void);
CreateDummyCaches();
CreateCheckPoint(false);
}
else if (xlogop == BS_XLOG_STARTUP)
StartupXLOG();
else if (xlogop == BS_XLOG_SHUTDOWN)
ShutdownXLOG();
else
elog(STOP, "Unsupported XLOG op %d", xlogop);
proc_exit(0);
}
SetProcessingMode(BootstrapProcessing);
/* /*
* backend initialization * backend initialization
@ -407,9 +408,9 @@ BootstrapMain(int argc, char *argv[])
*/ */
Int_yyparse(); Int_yyparse();
#ifdef XLOG SetProcessingMode(NormalProcessing);
FlushBufferPool(); CreateCheckPoint(true);
#endif SetProcessingMode(BootstrapProcessing);
/* clean up processing */ /* clean up processing */
StartTransactionCommand(); StartTransactionCommand();