summaryrefslogtreecommitdiff
path: root/src/backend/access/transam
diff options
context:
space:
mode:
authorVadim B. Mikheev2000-11-30 01:47:33 +0000
committerVadim B. Mikheev2000-11-30 01:47:33 +0000
commit741510521caea7e1ca12b4db0701bbc2db346a5f (patch)
treed26b28fc9215dd82b038f9c3d51925a6e7e65e1f /src/backend/access/transam
parent680b7357ce850c28d06997be793aee18f72434ba (diff)
XLOG stuff for sequences.
CommitDelay in guc.c
Diffstat (limited to 'src/backend/access/transam')
-rw-r--r--src/backend/access/transam/rmgr.c15
-rw-r--r--src/backend/access/transam/xact.c4
-rw-r--r--src/backend/access/transam/xlog.c40
3 files changed, 30 insertions, 29 deletions
diff --git a/src/backend/access/transam/rmgr.c b/src/backend/access/transam/rmgr.c
index 31a9a1a39d7..ca8b77de573 100644
--- a/src/backend/access/transam/rmgr.c
+++ b/src/backend/access/transam/rmgr.c
@@ -7,8 +7,7 @@
#include "access/xact.h"
#include "access/xlog.h"
#include "storage/smgr.h"
-
-#ifdef XLOG
+#include "commands/sequence.h"
RmgrData RmgrTable[] = {
{"XLOG", xlog_redo, xlog_undo, xlog_desc},
@@ -25,15 +24,7 @@ RmgrData RmgrTable[] = {
{"Btree", btree_redo, btree_undo, btree_desc},
{"Hash", hash_redo, hash_undo, hash_desc},
{"Rtree", rtree_redo, rtree_undo, rtree_desc},
-{"Gist", gist_redo, gist_undo, gist_desc}
+{"Gist", gist_redo, gist_undo, gist_desc},
+{"Sequence", seq_redo, seq_undo, seq_desc}
};
-#else /* not XLOG */
-
-/*
- * This is a dummy, but don't write RmgrTable[] = {} here,
- * that's not accepted by some compilers. -- petere
- */
-RmgrData RmgrTable[1];
-
-#endif /* not XLOG */
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index f1d264f130d..df679d277de 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.84 2000/11/21 21:15:57 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.85 2000/11/30 01:47:31 vadim Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -222,7 +222,7 @@ int XactIsoLevel;
#ifdef XLOG
#include "access/xlogutils.h"
-int CommitDelay = 5; /* 1/200 sec */
+int CommitDelay = 5; /* 1/200000 sec */
static void (*_RollbackFunc)(void*) = NULL;
static void *_RollbackData = NULL;
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index c70dbc7b4fb..b96159b4144 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6,7 +6,7 @@
* 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.36 2000/11/28 23:27:54 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xlog.c,v 1.37 2000/11/30 01:47:31 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -240,17 +240,26 @@ static bool InRedo = false;
XLogRecPtr
XLogInsert(RmgrId rmid, uint8 info, char *hdr, uint32 hdrlen, char *buf, uint32 buflen)
{
- XLogCtlInsert *Insert = &XLogCtl->Insert;
- XLogRecord *record;
- XLogSubRecord *subrecord;
- XLogRecPtr RecPtr;
- uint32 len = hdrlen + buflen,
- freespace,
- wlen;
- uint16 curridx;
- bool updrqst = false;
+ XLogCtlInsert *Insert = &XLogCtl->Insert;
+ XLogRecord *record;
+ XLogSubRecord *subrecord;
+ XLogRecPtr RecPtr;
+ uint32 len = hdrlen + buflen,
+ freespace,
+ wlen;
+ uint16 curridx;
+ bool updrqst = false;
+ bool no_tran = (rmid == RM_XLOG_ID) ? true : false;
+
+ if (info & XLR_INFO_MASK)
+ {
+ if ((info & XLR_INFO_MASK) != XLOG_NO_TRAN)
+ elog(STOP, "XLogInsert: invalid info mask %02X",
+ (info & XLR_INFO_MASK));
+ no_tran = true;
+ info &= ~XLR_INFO_MASK;
+ }
- Assert(!(info & XLR_INFO_MASK));
if (len == 0 || len > MAXLOGRECSZ)
elog(STOP, "XLogInsert: invalid record len %u", len);
@@ -324,13 +333,14 @@ XLogInsert(RmgrId rmid, uint8 info, char *hdr, uint32 hdrlen, char *buf, uint32
freespace -= SizeOfXLogRecord;
record = (XLogRecord *) Insert->currpos;
record->xl_prev = Insert->PrevRecord;
- if (rmid != RM_XLOG_ID)
- record->xl_xact_prev = MyLastRecPtr;
- else
+ if (no_tran)
{
record->xl_xact_prev.xlogid = 0;
record->xl_xact_prev.xrecoff = 0;
}
+ else
+ record->xl_xact_prev = MyLastRecPtr;
+
record->xl_xid = GetCurrentTransactionId();
record->xl_len = (len > freespace) ? freespace : len;
record->xl_info = (len > freespace) ?
@@ -340,7 +350,7 @@ XLogInsert(RmgrId rmid, uint8 info, char *hdr, uint32 hdrlen, char *buf, uint32
RecPtr.xrecoff =
XLogCtl->xlblocks[curridx].xrecoff - BLCKSZ +
Insert->currpos - ((char *) Insert->currpage);
- if (MyLastRecPtr.xrecoff == 0 && rmid != RM_XLOG_ID)
+ if (MyLastRecPtr.xrecoff == 0 && !no_tran)
{
SpinAcquire(SInvalLock);
MyProc->logRec = RecPtr;