* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* 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 <unistd.h>
#include <errno.h>
uint16 curridx; /* index of next block to write */
} XLogCtlWrite;
+
+#ifndef HAS_TEST_AND_SET
+#define TAS(lck) 0
+#define S_UNLOCK(lck)
+#define S_INIT_LOCK(lck)
+#endif
+
typedef struct XLogCtlData
{
XLogCtlInsert Insert;
{
int fd;
char buffer[BLCKSZ];
- XLogPageHeader page = (XLogPageHeader)buffer;
CheckPoint checkPoint;
+
+#ifdef NOT_USED
+ XLogPageHeader page = (XLogPageHeader)buffer;
XLogRecord *record;
+#endif
#ifndef __CYGWIN__
fd = open(ControlFilePath, O_RDWR|O_CREAT|O_EXCL, S_IRUSR|S_IWUSR);
elog(STOP, "BootStrapXLOG failed to create control file (%s): %d",
ControlFilePath, errno);
- logFile = XLogFileInit(0, 0);
-
checkPoint.redo.xlogid = 0;
checkPoint.redo.xrecoff = SizeOfXLogPHD;
checkPoint.undo = checkPoint.redo;
checkPoint.nextXid = FirstTransactionId;
checkPoint.nextOid = BootstrapObjectIdData;
+#ifdef NOT_USED
+
memset(buffer, 0, BLCKSZ);
page->xlp_magic = XLOG_PAGE_MAGIC;
page->xlp_info = 0;
record->xl_rmid = RM_XLOG_ID;
memcpy((char*)record + SizeOfXLogRecord, &checkPoint, sizeof(checkPoint));
+ logFile = XLogFileInit(0, 0);
+
if (write(logFile, buffer, BLCKSZ) != BLCKSZ)
elog(STOP, "BootStrapXLOG failed to write logfile: %d", errno);
close(logFile);
logFile = -1;
+#endif
+
memset(buffer, 0, BLCKSZ);
ControlFile = (ControlFileData*) buffer;
ControlFile->logId = 0;
void
StartupXLOG()
{
+#ifdef NOT_USED
XLogCtlInsert *Insert;
CheckPoint checkPoint;
XLogRecPtr RecPtr,
LastRec;
XLogRecord *record;
char buffer[MAXLOGRECSZ+SizeOfXLogRecord];
- int fd;
int recovery = 0;
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 was interrupted being in production at %s",
str_time(ControlFile->time));
+#ifdef NOT_USED
+
LastRec = RecPtr = ControlFile->checkPoint;
if (!XRecOffIsValid(RecPtr.xrecoff))
elog(STOP, "Invalid checkPoint in control file");
StopIfError = sie_saved;
}
+#endif /* NOT_USED */
+
ControlFile->state = DB_IN_PRODUCTION;
ControlFile->time = time(NULL);
UpdateControlFile();
void
CreateCheckPoint(bool shutdown)
{
+#ifdef NOT_USED
CheckPoint checkPoint;
XLogRecPtr recptr;
XLogCtlInsert *Insert = &XLogCtl->Insert;
XLogFlush(recptr);
+#endif /* NOT_USED */
+
SpinAcquire(ControlFileLockId);
if (shutdown)
ControlFile->state = DB_SHUTDOWNED;
+
+#ifdef NOT_USED
ControlFile->checkPoint = MyLastRecPtr;
+#else
+ ControlFile->checkPoint.xlogid = 0;
+ ControlFile->checkPoint.xrecoff = SizeOfXLogPHD;
+#endif
+
ControlFile->time = time(NULL);
UpdateControlFile();
SpinRelease(ControlFileLockId);