Skip to content

Commit e8ff221

Browse files
committed
Fix OID bootstraping.
1 parent b31e83f commit e8ff221

File tree

2 files changed

+32
-32
lines changed

2 files changed

+32
-32
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.29 2000/11/21 02:11:06 vadim Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.30 2000/11/21 09:39:56 vadim Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -251,7 +251,7 @@ XLogInsert(RmgrId rmid, uint8 info, char *hdr, uint32 hdrlen, char *buf, uint32
251251
if (len == 0 || len > MAXLOGRECSZ)
252252
elog(STOP, "XLogInsert: invalid record len %u", len);
253253

254-
if (IsBootstrapProcessingMode())
254+
if (IsBootstrapProcessingMode() && rmid != RM_XLOG_ID)
255255
{
256256
RecPtr.xlogid = 0;
257257
RecPtr.xrecoff = SizeOfXLogPHD; /* start of 1st checkpoint record */
@@ -506,7 +506,7 @@ XLogFlush(XLogRecPtr record)
506506
fflush(stderr);
507507
}
508508

509-
if (IsBootstrapProcessingMode() || InRedo)
509+
if (InRedo)
510510
return;
511511
if (XLByteLE(record, LgwrResult.Flush))
512512
return;
@@ -1326,8 +1326,7 @@ BootStrapXLOG()
13261326

13271327
#endif
13281328

1329-
memset(buffer, 0, BLCKSZ);
1330-
ControlFile = (ControlFileData *) buffer;
1329+
memset(ControlFile, 0, BLCKSZ);
13311330
ControlFile->logId = 0;
13321331
ControlFile->logSeg = 1;
13331332
ControlFile->checkPoint = checkPoint.redo;
@@ -1337,7 +1336,7 @@ BootStrapXLOG()
13371336
ControlFile->relseg_size = RELSEG_SIZE;
13381337
ControlFile->catalog_version_no = CATALOG_VERSION_NO;
13391338

1340-
if (write(fd, buffer, BLCKSZ) != BLCKSZ)
1339+
if (write(fd, ControlFile, BLCKSZ) != BLCKSZ)
13411340
elog(STOP, "BootStrapXLOG failed to write control file: %d", errno);
13421341

13431342
if (fsync(fd) != 0)

src/backend/bootstrap/bootstrap.c

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.98 2000/11/09 11:25:58 vadim Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.99 2000/11/21 09:39:57 vadim Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -341,32 +341,33 @@ BootstrapMain(int argc, char *argv[])
341341
/*
342342
* XLOG operations
343343
*/
344-
if (xlogop != BS_XLOG_NOP)
344+
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
345+
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
346+
SetProcessingMode(NormalProcessing);
347+
if (xlogop == BS_XLOG_NOP)
348+
StartupXLOG();
349+
else if (xlogop == BS_XLOG_BOOTSTRAP)
345350
{
346-
snprintf(XLogDir, MAXPGPATH, "%s/pg_xlog", DataDir);
347-
snprintf(ControlFilePath, MAXPGPATH, "%s/global/pg_control", DataDir);
348-
if (xlogop == BS_XLOG_BOOTSTRAP)
349-
BootStrapXLOG();
350-
else
351+
BootStrapXLOG();
352+
StartupXLOG();
353+
}
354+
else
355+
{
356+
if (xlogop == BS_XLOG_CHECKPOINT)
351357
{
352-
SetProcessingMode(NormalProcessing);
353-
if (xlogop == BS_XLOG_STARTUP)
354-
StartupXLOG();
355-
else if (xlogop == BS_XLOG_CHECKPOINT)
356-
{
357-
#ifdef XLOG
358-
extern void CreateDummyCaches(void);
359-
CreateDummyCaches();
360-
#endif
361-
CreateCheckPoint(false);
362-
}
363-
else if (xlogop == BS_XLOG_SHUTDOWN)
364-
ShutdownXLOG();
365-
else
366-
elog(STOP, "Unsupported XLOG op %d", xlogop);
367-
proc_exit(0);
358+
extern void CreateDummyCaches(void);
359+
CreateDummyCaches();
360+
CreateCheckPoint(false);
368361
}
362+
else if (xlogop == BS_XLOG_STARTUP)
363+
StartupXLOG();
364+
else if (xlogop == BS_XLOG_SHUTDOWN)
365+
ShutdownXLOG();
366+
else
367+
elog(STOP, "Unsupported XLOG op %d", xlogop);
368+
proc_exit(0);
369369
}
370+
SetProcessingMode(BootstrapProcessing);
370371

371372
/*
372373
* backend initialization
@@ -407,9 +408,9 @@ BootstrapMain(int argc, char *argv[])
407408
*/
408409
Int_yyparse();
409410

410-
#ifdef XLOG
411-
FlushBufferPool();
412-
#endif
411+
SetProcessingMode(NormalProcessing);
412+
CreateCheckPoint(true);
413+
SetProcessingMode(BootstrapProcessing);
413414

414415
/* clean up processing */
415416
StartTransactionCommand();

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy