aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>2000-10-28 16:21:00 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>2000-10-28 16:21:00 +0000
commit5b0740d3fcd55f6e545e8bd577fe8ccba2be4987 (patch)
tree06cf3807f89c23d365322e08f594e6bbaaa95a3c /src/include
parent2f4c9d39febec0c092388b124bf3de2d857eb5a9 (diff)
downloadpostgresql-5b0740d3fcd55f6e545e8bd577fe8ccba2be4987.tar.gz
postgresql-5b0740d3fcd55f6e545e8bd577fe8ccba2be4987.zip
WAL
Diffstat (limited to 'src/include')
-rw-r--r--src/include/access/transam.h13
-rw-r--r--src/include/access/xact.h4
-rw-r--r--src/include/access/xlog.h14
-rw-r--r--src/include/access/xlogdefs.h24
-rw-r--r--src/include/access/xlogutils.h4
-rw-r--r--src/include/storage/buf_internals.h6
-rw-r--r--src/include/storage/bufmgr.h9
-rw-r--r--src/include/storage/bufpage.h5
-rw-r--r--src/include/storage/smgr.h27
9 files changed, 67 insertions, 39 deletions
diff --git a/src/include/access/transam.h b/src/include/access/transam.h
index 752682ca969..415ad56b959 100644
--- a/src/include/access/transam.h
+++ b/src/include/access/transam.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: transam.h,v 1.24 2000/01/26 05:57:51 momjian Exp $
+ * $Id: transam.h,v 1.25 2000/10/28 16:20:59 vadim Exp $
*
* NOTES
* Transaction System Version 101 now support proper oid
@@ -67,7 +67,11 @@ typedef unsigned char XidStatus;/* (2 bits) */
* transaction page definitions
* ----------------
*/
+#ifdef XLOG
+#define TP_DataSize (BLCKSZ - sizeof(XLogRecPtr))
+#else
#define TP_DataSize BLCKSZ
+#endif
#define TP_NumXidStatusPerBlock (TP_DataSize * 4)
/* ----------------
@@ -84,6 +88,10 @@ typedef unsigned char XidStatus;/* (2 bits) */
*/
typedef struct LogRelationContentsData
{
+#ifdef XLOG
+ XLogRecPtr LSN; /* temp hack: LSN is member of any block */
+ /* so should be described in bufmgr */
+#endif
int TransSystemVersion;
} LogRelationContentsData;
@@ -107,6 +115,9 @@ typedef LogRelationContentsData *LogRelationContents;
*/
typedef struct VariableRelationContentsData
{
+#ifdef XLOG
+ XLogRecPtr LSN;
+#endif
int TransSystemVersion;
TransactionId nextXidData;
TransactionId lastXidData; /* unused */
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
index 712e88b6005..18ca96f3d83 100644
--- a/src/include/access/xact.h
+++ b/src/include/access/xact.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: xact.h,v 1.28 2000/10/20 11:01:14 vadim Exp $
+ * $Id: xact.h,v 1.29 2000/10/28 16:20:59 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -135,6 +135,8 @@ extern bool IsTransactionBlock(void);
extern void UserAbortTransactionBlock(void);
extern void AbortOutOfAnyTransaction(void);
+extern void RecordTransactionCommit(void);
+
extern TransactionId DisabledTransactionId;
extern void XactPushRollback(void (*func) (void *), void* data);
diff --git a/src/include/access/xlog.h b/src/include/access/xlog.h
index c77c1cac02a..02998755c32 100644
--- a/src/include/access/xlog.h
+++ b/src/include/access/xlog.h
@@ -10,12 +10,7 @@
#include "access/rmgr.h"
#include "access/transam.h"
-
-typedef struct XLogRecPtr
-{
- uint32 xlogid; /* log file #, 0 based */
- uint32 xrecoff; /* offset of record in log file */
-} XLogRecPtr;
+#include "access/xlogdefs.h"
typedef struct XLogRecord
{
@@ -83,12 +78,7 @@ typedef XLogPageHeaderData *XLogPageHeader;
#define XLByteEQ(left, right) \
(right.xlogid == left.xlogid && right.xrecoff == left.xrecoff)
-/*
- * StartUpID (SUI) - system startups counter.
- * It's to allow removing pg_log after shutdown.
- */
-typedef uint32 StartUpID;
-extern StartUpID ThisStartUpID;
+extern StartUpID ThisStartUpID; /* current SUI */
extern bool InRecovery;
extern XLogRecPtr MyLastRecPtr;
diff --git a/src/include/access/xlogdefs.h b/src/include/access/xlogdefs.h
new file mode 100644
index 00000000000..ce1b3ef8cf6
--- /dev/null
+++ b/src/include/access/xlogdefs.h
@@ -0,0 +1,24 @@
+/*
+ *
+ * xlogdefs.h
+ *
+ * Postgres transaction log manager record pointer and
+ * system stratup number definitions
+ *
+ */
+#ifndef XLOG_DEFS_H
+#define XLOG_DEFS_H
+
+typedef struct XLogRecPtr
+{
+ uint32 xlogid; /* log file #, 0 based */
+ uint32 xrecoff; /* offset of record in log file */
+} XLogRecPtr;
+
+/*
+ * StartUpID (SUI) - system startups counter. It's to allow removing
+ * pg_log after shutdown, in future.
+ */
+typedef uint32 StartUpID;
+
+#endif /* XLOG_DEFS_H */
diff --git a/src/include/access/xlogutils.h b/src/include/access/xlogutils.h
index f62f726d831..b8fa3549f42 100644
--- a/src/include/access/xlogutils.h
+++ b/src/include/access/xlogutils.h
@@ -9,8 +9,10 @@ extern bool XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr);
extern void XLogOpenLogRelation(void);
-extern Buffer XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno);
+extern void XLogInitRelationCache(void);
extern void XLogCloseRelationCache(void);
+
extern Relation XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode);
+extern Buffer XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno);
#endif
diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h
index 65abe9b8ceb..80aca7c57e9 100644
--- a/src/include/storage/buf_internals.h
+++ b/src/include/storage/buf_internals.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: buf_internals.h,v 1.41 2000/10/23 04:10:14 vadim Exp $
+ * $Id: buf_internals.h,v 1.42 2000/10/28 16:21:00 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -109,6 +109,10 @@ typedef struct sbufdesc
bool ri_lock; /* read-intent lock */
bool w_lock; /* context exclusively locked */
+#ifdef XLOG
+ bool cntxDirty; /* new way to mark block as dirty */
+#endif
+
BufferBlindId blind; /* was used to support blind write */
/*
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 551f98e75f9..0ed4837305d 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufmgr.h,v 1.41 2000/10/20 11:01:21 vadim Exp $
+ * $Id: bufmgr.h,v 1.42 2000/10/28 16:21:00 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#define BUFMGR_H
#include "storage/buf_internals.h"
-
+#include "access/xlogdefs.h"
typedef void *Block;
@@ -177,4 +177,9 @@ extern void AbortBufferIO(void);
extern bool BufferIsUpdatable(Buffer buffer);
extern void MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc)(Buffer));
+#ifdef XLOG
+extern void BufmgrCommit(void);
+extern void BufferSync(void);
+#endif
+
#endif
diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h
index d547f71b736..78b22f392cf 100644
--- a/src/include/storage/bufpage.h
+++ b/src/include/storage/bufpage.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: bufpage.h,v 1.34 2000/10/21 15:43:36 vadim Exp $
+ * $Id: bufpage.h,v 1.35 2000/10/28 16:21:00 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -118,7 +118,8 @@ typedef OpaqueData *Opaque;
*/
typedef struct PageHeaderData
{
-#ifdef XLOG
+#ifdef XLOG /* XXX LSN is member of *any* block, not */
+ /* only page-organized - 'll change later */
XLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog */
/* record for last change of this page */
StartUpID pd_sui; /* SUI of last changes (currently it's */
diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h
index 7caac813e9a..49a2e3e5e92 100644
--- a/src/include/storage/smgr.h
+++ b/src/include/storage/smgr.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: smgr.h,v 1.22 2000/10/16 14:52:28 vadim Exp $
+ * $Id: smgr.h,v 1.23 2000/10/28 16:21:00 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -36,26 +36,19 @@ extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum,
char *buffer);
extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum,
char *buffer);
-#ifdef OLD_FILE_NAMING
-extern int smgrblindwrt(int16 which, char *dbname, char *relname,
- Oid dbid, Oid relid,
- BlockNumber blkno, char *buffer,
- bool dofsync);
-extern int smgrblindmarkdirty(int16 which, char *dbname, char *relname,
- Oid dbid, Oid relid,
- BlockNumber blkno);
-#else
extern int smgrblindwrt(int16 which, RelFileNode rnode,
BlockNumber blkno, char *buffer, bool dofsync);
extern int smgrblindmarkdirty(int16 which, RelFileNode rnode,
BlockNumber blkno);
-#endif
extern int smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno);
extern int smgrnblocks(int16 which, Relation reln);
extern int smgrtruncate(int16 which, Relation reln, int nblocks);
extern int smgrcommit(void);
extern int smgrabort(void);
+#ifdef XLOG
+extern int smgrsync(void);
+#endif
/* internals: move me elsewhere -- ay 7/94 */
@@ -71,22 +64,18 @@ extern int mdread(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdwrite(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdflush(Relation reln, BlockNumber blocknum, char *buffer);
extern int mdmarkdirty(Relation reln, BlockNumber blkno);
-#ifdef OLD_FILE_NAMING
-extern int mdblindwrt(char *dbname, char *relname, Oid dbid, Oid relid,
- BlockNumber blkno, char *buffer,
- bool dofsync);
-extern int mdblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid,
- BlockNumber blkno);
-#else
extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno,
char *buffer, bool dofsync);
extern int mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno);
-#endif
extern int mdnblocks(Relation reln);
extern int mdtruncate(Relation reln, int nblocks);
extern int mdcommit(void);
extern int mdabort(void);
+#ifdef XLOG
+extern int mdsync(void);
+#endif
+
/* mm.c */
extern SPINLOCK MMCacheLock;