Commit 3fea625e authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Make tree compilable (+WAL).

parent 539b6304
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.53 1999/09/24 00:24:05 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.54 1999/09/28 11:41:03 vadim Exp $
* *
* NOTES * NOTES
* Transaction aborts can now occur two ways: * Transaction aborts can now occur two ways:
...@@ -632,7 +632,7 @@ RecordTransactionCommit() ...@@ -632,7 +632,7 @@ RecordTransactionCommit()
*/ */
if (SharedBufferChanged) if (SharedBufferChanged)
{ {
FlushBufferPool(!TransactionFlushEnabled()); FlushBufferPool();
if (leak) if (leak)
ResetBufferPool(); ResetBufferPool();
...@@ -646,7 +646,7 @@ RecordTransactionCommit() ...@@ -646,7 +646,7 @@ RecordTransactionCommit()
* Now write the log info to the disk too. * Now write the log info to the disk too.
*/ */
leak = BufferPoolCheckLeak(); leak = BufferPoolCheckLeak();
FlushBufferPool(!TransactionFlushEnabled()); FlushBufferPool();
} }
if (leak) if (leak)
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h>
#include "postgres.h" #include "postgres.h"
#include "access/xlog.h" #include "access/xlog.h"
...@@ -1376,12 +1377,10 @@ CreateCheckPoint(bool shutdown) ...@@ -1376,12 +1377,10 @@ CreateCheckPoint(bool shutdown)
/* Get REDO record ptr */ /* Get REDO record ptr */
while (!TAS(&(XLogCtl->insert_lck))) while (!TAS(&(XLogCtl->insert_lck)))
{ {
struct timeval delay; struct timeval delay = {0, 5000};
if (shutdown) if (shutdown)
elog(STOP, "XLog insert lock is busy while data base is shutting down"); elog(STOP, "XLog insert lock is busy while data base is shutting down");
delay.tv_sec = 0;
delay.tv_usec = 0;
(void) select(0, NULL, NULL, NULL, &delay); (void) select(0, NULL, NULL, NULL, &delay);
} }
freespace = ((char*) Insert->currpage) + BLCKSZ - Insert->currpos; freespace = ((char*) Insert->currpage) + BLCKSZ - Insert->currpos;
...@@ -1408,7 +1407,7 @@ CreateCheckPoint(bool shutdown) ...@@ -1408,7 +1407,7 @@ CreateCheckPoint(bool shutdown)
checkPoint.nextOid = ShmemVariableCache->nextOid; checkPoint.nextOid = ShmemVariableCache->nextOid;
SpinRelease(OidGenLockId); SpinRelease(OidGenLockId);
FlushBufferPool(false); FlushBufferPool();
/* Get UNDO record ptr */ /* Get UNDO record ptr */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.121 1999/09/24 00:24:17 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.122 1999/09/28 11:41:04 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1703,9 +1703,9 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)", ...@@ -1703,9 +1703,9 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
* flush buffers and record status of current transaction as * flush buffers and record status of current transaction as
* committed, and continue. - vadim 11/13/96 * committed, and continue. - vadim 11/13/96
*/ */
FlushBufferPool(!TransactionFlushEnabled()); FlushBufferPool();
TransactionIdCommit(myXID); TransactionIdCommit(myXID);
FlushBufferPool(!TransactionFlushEnabled()); FlushBufferPool();
} }
/* /*
...@@ -1899,12 +1899,10 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages) ...@@ -1899,12 +1899,10 @@ vc_vacheap(VRelStats *vacrelstats, Relation onerel, VPageList vacuum_pages)
vacrelstats->num_pages, nblocks); vacrelstats->num_pages, nblocks);
/* /*
* we have to flush "empty" end-pages (if changed, but who knows * We have to flush "empty" end-pages (if changed, but who knows it)
* it) before truncation * before truncation
*
* XXX wouldn't passing 'true' to FlushRelationBuffers do the job?
*/ */
FlushBufferPool(!TransactionFlushEnabled()); FlushBufferPool();
i = FlushRelationBuffers(onerel, nblocks, false); i = FlushRelationBuffers(onerel, nblocks, false);
if (i < 0) if (i < 0)
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.63 1999/09/24 00:24:29 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/buffer/bufmgr.c,v 1.64 1999/09/28 11:41:06 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1240,13 +1240,10 @@ relname=%s, blockNum=%d, flags=0x%x, refcount=%d %d)", ...@@ -1240,13 +1240,10 @@ relname=%s, blockNum=%d, flags=0x%x, refcount=%d %d)",
* ------------------------------------------------ * ------------------------------------------------
*/ */
void void
FlushBufferPool(int StableMainMemoryFlag) FlushBufferPool(void)
{ {
if (!StableMainMemoryFlag) BufferSync();
{ smgrcommit();
BufferSync();
smgrcommit();
}
} }
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.54 1999/09/24 00:24:47 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.55 1999/09/28 11:41:07 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -815,6 +815,12 @@ mdtruncate(Relation reln, int nblocks) ...@@ -815,6 +815,12 @@ mdtruncate(Relation reln, int nblocks)
int int
mdcommit() mdcommit()
{ {
#ifdef XLOG
sync();
sleep(1);
sync();
return SM_SUCCESS;
#else
int i; int i;
MdfdVec *v; MdfdVec *v;
...@@ -838,6 +844,7 @@ mdcommit() ...@@ -838,6 +844,7 @@ mdcommit()
} }
return SM_SUCCESS; return SM_SUCCESS;
#endif /* XLOG */
} }
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.49 1999/09/24 00:24:58 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/init/postinit.c,v 1.50 1999/09/28 11:41:09 vadim Exp $
* *
* NOTES * NOTES
* InitPostgres() is the function called from PostgresMain * InitPostgres() is the function called from PostgresMain
...@@ -541,8 +541,10 @@ InitPostgres(char *name) /* database name */ ...@@ -541,8 +541,10 @@ InitPostgres(char *name) /* database name */
*/ */
InitLocalBuffer(); InitLocalBuffer();
#ifndef XLOG
if (!TransactionFlushEnabled()) if (!TransactionFlushEnabled())
on_shmem_exit(FlushBufferPool, (caddr_t) NULL); on_shmem_exit(FlushBufferPool, (caddr_t) NULL);
#endif
/* ---------------- /* ----------------
* initialize the database id used for system caches and lock tables * initialize the database id used for system caches and lock tables
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: bufmgr.h,v 1.31 1999/09/24 00:25:27 tgl Exp $ * $Id: bufmgr.h,v 1.32 1999/09/28 11:40:53 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -170,7 +170,7 @@ extern void PrintBufferUsage(FILE *statfp); ...@@ -170,7 +170,7 @@ extern void PrintBufferUsage(FILE *statfp);
extern void ResetBufferUsage(void); extern void ResetBufferUsage(void);
extern void ResetBufferPool(void); extern void ResetBufferPool(void);
extern int BufferPoolCheckLeak(void); extern int BufferPoolCheckLeak(void);
extern void FlushBufferPool(int StableMainMemoryFlag); extern void FlushBufferPool(void);
extern BlockNumber BufferGetBlockNumber(Buffer buffer); extern BlockNumber BufferGetBlockNumber(Buffer buffer);
extern BlockNumber RelationGetNumberOfBlocks(Relation relation); extern BlockNumber RelationGetNumberOfBlocks(Relation relation);
extern int FlushRelationBuffers(Relation rel, BlockNumber block, extern int FlushRelationBuffers(Relation rel, BlockNumber block,
......
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