Commit df238b2c authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Turn XLOG off (do not create log file).

parent 3caa56fe
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
* 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.11 2000/03/07 23:49:31 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.12 2000/03/20 07:25:39 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
...@@ -76,6 +77,13 @@ typedef struct XLogCtlWrite ...@@ -76,6 +77,13 @@ typedef struct XLogCtlWrite
uint16 curridx; /* index of next block to write */ uint16 curridx; /* index of next block to write */
} XLogCtlWrite; } XLogCtlWrite;
#ifndef HAS_TEST_AND_SET
#define TAS(lck) 0
#define S_UNLOCK(lck)
#define S_INIT_LOCK(lck)
#endif
typedef struct XLogCtlData typedef struct XLogCtlData
{ {
XLogCtlInsert Insert; XLogCtlInsert Insert;
...@@ -1153,9 +1161,12 @@ BootStrapXLOG() ...@@ -1153,9 +1161,12 @@ BootStrapXLOG()
{ {
int fd; int fd;
char buffer[BLCKSZ]; char buffer[BLCKSZ];
XLogPageHeader page = (XLogPageHeader)buffer;
CheckPoint checkPoint; CheckPoint checkPoint;
#ifdef NOT_USED
XLogPageHeader page = (XLogPageHeader)buffer;
XLogRecord *record; XLogRecord *record;
#endif
#ifndef __CYGWIN__ #ifndef __CYGWIN__
fd = open(ControlFilePath, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR); fd = open(ControlFilePath, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
...@@ -1166,14 +1177,14 @@ BootStrapXLOG() ...@@ -1166,14 +1177,14 @@ BootStrapXLOG()
elog(STOP, "BootStrapXLOG failed to create control file (%s): %d", elog(STOP, "BootStrapXLOG failed to create control file (%s): %d",
ControlFilePath, errno); ControlFilePath, errno);
logFile = XLogFileInit(0, 0);
checkPoint.redo.xlogid = 0; checkPoint.redo.xlogid = 0;
checkPoint.redo.xrecoff = SizeOfXLogPHD; checkPoint.redo.xrecoff = SizeOfXLogPHD;
checkPoint.undo = checkPoint.redo; checkPoint.undo = checkPoint.redo;
checkPoint.nextXid = FirstTransactionId; checkPoint.nextXid = FirstTransactionId;
checkPoint.nextOid = BootstrapObjectIdData; checkPoint.nextOid = BootstrapObjectIdData;
#ifdef NOT_USED
memset(buffer, 0, BLCKSZ); memset(buffer, 0, BLCKSZ);
page->xlp_magic = XLOG_PAGE_MAGIC; page->xlp_magic = XLOG_PAGE_MAGIC;
page->xlp_info = 0; page->xlp_info = 0;
...@@ -1186,6 +1197,8 @@ BootStrapXLOG() ...@@ -1186,6 +1197,8 @@ BootStrapXLOG()
record->xl_rmid = RM_XLOG_ID; record->xl_rmid = RM_XLOG_ID;
memcpy((char*)record + SizeOfXLogRecord, &checkPoint, sizeof(checkPoint)); memcpy((char*)record + SizeOfXLogRecord, &checkPoint, sizeof(checkPoint));
logFile = XLogFileInit(0, 0);
if (write(logFile, buffer, BLCKSZ) != BLCKSZ) if (write(logFile, buffer, BLCKSZ) != BLCKSZ)
elog(STOP, "BootStrapXLOG failed to write logfile: %d", errno); elog(STOP, "BootStrapXLOG failed to write logfile: %d", errno);
...@@ -1195,6 +1208,8 @@ BootStrapXLOG() ...@@ -1195,6 +1208,8 @@ BootStrapXLOG()
close(logFile); close(logFile);
logFile = -1; logFile = -1;
#endif
memset(buffer, 0, BLCKSZ); memset(buffer, 0, BLCKSZ);
ControlFile = (ControlFileData*) buffer; ControlFile = (ControlFileData*) buffer;
ControlFile->logId = 0; ControlFile->logId = 0;
...@@ -1233,15 +1248,17 @@ str_time(time_t tnow) ...@@ -1233,15 +1248,17 @@ str_time(time_t tnow)
void void
StartupXLOG() StartupXLOG()
{ {
#ifdef NOT_USED
XLogCtlInsert *Insert; XLogCtlInsert *Insert;
CheckPoint checkPoint; CheckPoint checkPoint;
XLogRecPtr RecPtr, XLogRecPtr RecPtr,
LastRec; LastRec;
XLogRecord *record; XLogRecord *record;
char buffer[MAXLOGRECSZ+SizeOfXLogRecord]; char buffer[MAXLOGRECSZ+SizeOfXLogRecord];
int fd;
int recovery = 0; int recovery = 0;
bool sie_saved = false; bool sie_saved = false;
#endif
int fd;
elog(LOG, "Data Base System is starting up at %s", str_time(time(NULL))); elog(LOG, "Data Base System is starting up at %s", str_time(time(NULL)));
...@@ -1321,6 +1338,8 @@ tryAgain: ...@@ -1321,6 +1338,8 @@ tryAgain:
elog(LOG, "Data Base System was interrupted being in production at %s", elog(LOG, "Data Base System was interrupted being in production at %s",
str_time(ControlFile->time)); str_time(ControlFile->time));
#ifdef NOT_USED
LastRec = RecPtr = ControlFile->checkPoint; LastRec = RecPtr = ControlFile->checkPoint;
if (!XRecOffIsValid(RecPtr.xrecoff)) if (!XRecOffIsValid(RecPtr.xrecoff))
elog(STOP, "Invalid checkPoint in control file"); elog(STOP, "Invalid checkPoint in control file");
...@@ -1460,6 +1479,8 @@ tryAgain: ...@@ -1460,6 +1479,8 @@ tryAgain:
StopIfError = sie_saved; StopIfError = sie_saved;
} }
#endif /* NOT_USED */
ControlFile->state = DB_IN_PRODUCTION; ControlFile->state = DB_IN_PRODUCTION;
ControlFile->time = time(NULL); ControlFile->time = time(NULL);
UpdateControlFile(); UpdateControlFile();
...@@ -1486,6 +1507,7 @@ ShutdownXLOG() ...@@ -1486,6 +1507,7 @@ ShutdownXLOG()
void void
CreateCheckPoint(bool shutdown) CreateCheckPoint(bool shutdown)
{ {
#ifdef NOT_USED
CheckPoint checkPoint; CheckPoint checkPoint;
XLogRecPtr recptr; XLogRecPtr recptr;
XLogCtlInsert *Insert = &XLogCtl->Insert; XLogCtlInsert *Insert = &XLogCtl->Insert;
...@@ -1548,10 +1570,19 @@ CreateCheckPoint(bool shutdown) ...@@ -1548,10 +1570,19 @@ CreateCheckPoint(bool shutdown)
XLogFlush(recptr); XLogFlush(recptr);
#endif /* NOT_USED */
SpinAcquire(ControlFileLockId); SpinAcquire(ControlFileLockId);
if (shutdown) if (shutdown)
ControlFile->state = DB_SHUTDOWNED; ControlFile->state = DB_SHUTDOWNED;
#ifdef NOT_USED
ControlFile->checkPoint = MyLastRecPtr; ControlFile->checkPoint = MyLastRecPtr;
#else
ControlFile->checkPoint.xlogid = 0;
ControlFile->checkPoint.xrecoff = SizeOfXLogPHD;
#endif
ControlFile->time = time(NULL); ControlFile->time = time(NULL);
UpdateControlFile(); UpdateControlFile();
SpinRelease(ControlFileLockId); SpinRelease(ControlFileLockId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment