aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access')
-rw-r--r--src/backend/access/common/heaptuple.c83
-rw-r--r--src/backend/access/common/indextuple.c4
-rw-r--r--src/backend/access/heap/heapam.c15
-rw-r--r--src/backend/access/transam/transam.c127
-rw-r--r--src/backend/access/transam/transsup.c225
-rw-r--r--src/backend/access/transam/varsup.c124
-rw-r--r--src/backend/access/transam/xact.c4
-rw-r--r--src/backend/access/transam/xid.c40
8 files changed, 37 insertions, 585 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index f124e564673..263f29cb68e 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.27 1997/09/24 17:44:24 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.28 1997/11/02 15:24:09 vadim Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -115,7 +115,7 @@ DataFill(char *data,
TupleDesc tupleDesc,
Datum value[],
char nulls[],
- char *infomask,
+ uint16 *infomask,
bits8 *bit)
{
bits8 *bitP = 0;
@@ -246,11 +246,6 @@ heap_attisnull(HeapTuple tup, int attnum)
case MinCommandIdAttributeNumber:
case MaxTransactionIdAttributeNumber:
case MaxCommandIdAttributeNumber:
- case ChainItemPointerAttributeNumber:
- case AnchorItemPointerAttributeNumber:
- case MinAbsoluteTimeAttributeNumber:
- case MaxAbsoluteTimeAttributeNumber:
- case VersionTypeAttributeNumber:
break;
case 0:
@@ -293,18 +288,6 @@ heap_sysattrlen(AttrNumber attno)
return sizeof f->t_xmax;
case MaxCommandIdAttributeNumber:
return sizeof f->t_cmax;
- case ChainItemPointerAttributeNumber:
- return sizeof f->t_chain;
- case MinAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmin;
- case MaxAbsoluteTimeAttributeNumber:
- return sizeof f->t_tmax;
- case VersionTypeAttributeNumber:
- return sizeof f->t_vtype;
-
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_sysattrlen: field t_anchor does not exist!");
- return 0;
default:
elog(WARN, "sysattrlen: System attribute number %d unknown.", attno);
@@ -343,21 +326,6 @@ heap_sysattrbyval(AttrNumber attno)
case MaxCommandIdAttributeNumber:
byval = true;
break;
- case ChainItemPointerAttributeNumber:
- byval = false;
- break;
- case AnchorItemPointerAttributeNumber:
- byval = false;
- break;
- case MinAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case MaxAbsoluteTimeAttributeNumber:
- byval = true;
- break;
- case VersionTypeAttributeNumber:
- byval = true;
- break;
default:
byval = true;
elog(WARN, "sysattrbyval: System attribute number %d unknown.",
@@ -377,7 +345,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
+ case SelfItemPointerAttributeNumber:
return ((Datum) &tup->t_ctid);
case ObjectIdAttributeNumber:
return ((Datum) (long) tup->t_oid);
@@ -389,38 +357,6 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
return ((Datum) (long) tup->t_xmax);
case MaxCommandIdAttributeNumber:
return ((Datum) (long) tup->t_cmax);
- case ChainItemPointerAttributeNumber:
- return ((Datum) &tup->t_chain);
- case AnchorItemPointerAttributeNumber:
- elog(WARN, "heap_getsysattr: t_anchor does not exist!");
- break;
-
- /*
- * For tmin and tmax, we need to do some extra work. These
- * don't get filled in until the vacuum cleaner runs (or we
- * manage to flush a page after setting the value correctly
- * below). If the vacuum cleaner hasn't run yet, then the
- * times stored in the tuple are wrong, and we need to look up
- * the commit time of the transaction. We cache this value in
- * the tuple to avoid doing the work more than once.
- */
-
- case MinAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyValid(tup->t_tmin) &&
- TransactionIdDidCommit(tup->t_xmin))
- tup->t_tmin = TransactionIdGetCommitTime(tup->t_xmin);
- return ((Datum) (long) tup->t_tmin);
- case MaxAbsoluteTimeAttributeNumber:
- if (!AbsoluteTimeIsBackwardCompatiblyReal(tup->t_tmax))
- {
- if (TransactionIdDidCommit(tup->t_xmax))
- tup->t_tmax = TransactionIdGetCommitTime(tup->t_xmax);
- else
- tup->t_tmax = CURRENT_ABSTIME;
- }
- return ((Datum) (long) tup->t_tmax);
- case VersionTypeAttributeNumber:
- return ((Datum) (long) tup->t_vtype);
default:
elog(WARN, "heap_getsysattr: undefined attnum %d", attnum);
}
@@ -858,8 +794,6 @@ heap_formtuple(TupleDesc tupleDescriptor,
tuple->t_len = len;
tuple->t_natts = numberOfAttributes;
tuple->t_hoff = hoff;
- tuple->t_tmin = INVALID_ABSTIME;
- tuple->t_tmax = CURRENT_ABSTIME;
DataFill((char *) tuple + tuple->t_hoff,
tupleDescriptor,
@@ -868,6 +802,8 @@ heap_formtuple(TupleDesc tupleDescriptor,
&tuple->t_infomask,
(hasnull ? tuple->t_bits : NULL));
+ tuple->t_infomask |= HEAP_XMAX_INVALID;
+
return (tuple);
}
@@ -970,9 +906,9 @@ heap_modifytuple(HeapTuple tuple,
* ----------------
*/
infomask = newTuple->t_infomask;
- memmove((char *) &newTuple->t_ctid, /* XXX */
- (char *) &tuple->t_ctid,
- ((char *) &tuple->t_hoff - (char *) &tuple->t_ctid)); /* XXX */
+ memmove((char *) &newTuple->t_oid, /* XXX */
+ (char *) &tuple->t_oid,
+ ((char *) &tuple->t_hoff - (char *) &tuple->t_oid)); /* XXX */
newTuple->t_infomask = infomask;
newTuple->t_natts = numberOfAttributes; /* fix t_natts just in
* case */
@@ -1013,10 +949,11 @@ heap_addheader(uint32 natts, /* max domain index */
tup = (HeapTuple) tp;
MemSet((char *) tup, 0, len);
- tup->t_len = (short) len; /* XXX */
+ tup->t_len = len;
tp += tup->t_hoff = hoff;
tup->t_natts = natts;
tup->t_infomask = 0;
+ tup->t_infomask |= HEAP_XMAX_INVALID;
memmove(tp, structure, structlen);
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index 8d3fba59094..273de3b4c45 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.19 1997/09/18 20:19:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.20 1997/11/02 15:24:11 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -52,7 +52,7 @@ index_formtuple(TupleDesc tupleDescriptor,
int i;
unsigned short infomask = 0;
bool hasnull = false;
- char tupmask = 0;
+ uint16 tupmask = 0;
int numberOfAttributes = tupleDescriptor->natts;
if (numberOfAttributes > MaxIndexAttributeNumber)
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 2537e7e777c..cc173f4fe8b 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.20 1997/09/18 14:19:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.21 1997/11/02 15:24:26 vadim Exp $
*
*
* INTERFACE ROUTINES
@@ -1174,8 +1174,8 @@ heap_insert(Relation relation, HeapTuple tup)
TransactionIdStore(GetCurrentTransactionId(), &(tup->t_xmin));
tup->t_cmin = GetCurrentCommandId();
StoreInvalidTransactionId(&(tup->t_xmax));
- tup->t_tmin = INVALID_ABSTIME;
- tup->t_tmax = CURRENT_ABSTIME;
+ tup->t_infomask &= ~(HEAP_XACT_MASK);
+ tup->t_infomask |= HEAP_XMAX_INVALID;
doinsert(relation, tup);
@@ -1281,7 +1281,7 @@ heap_delete(Relation relation, ItemPointer tid)
*/
TransactionIdStore(GetCurrentTransactionId(), &(tp->t_xmax));
tp->t_cmax = GetCurrentCommandId();
- ItemPointerSetInvalid(&tp->t_chain);
+ tp->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID);
/* ----------------
* invalidate caches
@@ -1410,9 +1410,8 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
TransactionIdStore(GetCurrentTransactionId(), &(tup->t_xmin));
tup->t_cmin = GetCurrentCommandId();
StoreInvalidTransactionId(&(tup->t_xmax));
- tup->t_tmin = INVALID_ABSTIME;
- tup->t_tmax = CURRENT_ABSTIME;
- ItemPointerSetInvalid(&tup->t_chain);
+ tup->t_infomask &= ~(HEAP_XACT_MASK);
+ tup->t_infomask |= HEAP_XMAX_INVALID;
/* ----------------
* insert new item
@@ -1438,7 +1437,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
*/
TransactionIdStore(GetCurrentTransactionId(), &(tp->t_xmax));
tp->t_cmax = GetCurrentCommandId();
- tp->t_chain = tup->t_ctid;
+ tp->t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID);
/* ----------------
* invalidate caches
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c
index 91c7ec8a3d2..02b7fa97693 100644
--- a/src/backend/access/transam/transam.c
+++ b/src/backend/access/transam/transam.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.13 1997/09/08 21:41:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.14 1997/11/02 15:24:42 vadim Exp $
*
* NOTES
* This file contains the high level access-method interface to the
@@ -41,17 +41,14 @@ TransactionLogUpdate(TransactionId transactionId,
*/
Relation LogRelation = (Relation) NULL;
-Relation TimeRelation = (Relation) NULL;
Relation VariableRelation = (Relation) NULL;
/* ----------------
* global variables holding cached transaction id's and statuses.
* ----------------
*/
-TransactionId cachedGetCommitTimeXid;
-AbsoluteTime cachedGetCommitTime;
-TransactionId cachedTestXid;
-XidStatus cachedTestXidStatus;
+TransactionId cachedTestXid;
+XidStatus cachedTestXidStatus;
/* ----------------
* transaction system constants
@@ -118,7 +115,7 @@ SetRecoveryCheckingEnabled(bool state)
#endif
/* ----------------------------------------------------------------
- * postgres log/time access method interface
+ * postgres log access method interface
*
* TransactionLogTest
* TransactionLogUpdate
@@ -204,7 +201,6 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
{
BlockNumber blockNumber;
bool fail = false; /* success/failure */
- AbsoluteTime currentTime; /* time of this transaction */
/* ----------------
* during initialization we don't record any updates.
@@ -214,12 +210,6 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
return;
/* ----------------
- * get the transaction commit time
- * ----------------
- */
- currentTime = getSystemTime();
-
- /* ----------------
* update the log relation
* ----------------
*/
@@ -234,91 +224,12 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
* update (invalidate) our single item TransactionLogTest cache.
* ----------------
*/
- TransactionIdStore(transactionId, &cachedTestXid);
- cachedTestXidStatus = status;
-
- /* ----------------
- * now we update the time relation, if necessary
- * (we only record commit times)
- * ----------------
- */
- if (RelationIsValid(TimeRelation) && status == XID_COMMIT)
+ if (status != XID_COMMIT)
{
- TransComputeBlockNumber(TimeRelation, transactionId, &blockNumber);
- TransBlockNumberSetCommitTime(TimeRelation,
- blockNumber,
- transactionId,
- currentTime,
- &fail);
- /* ----------------
- * update (invalidate) our single item GetCommitTime cache.
- * ----------------
- */
- TransactionIdStore(transactionId, &cachedGetCommitTimeXid);
- cachedGetCommitTime = currentTime;
+ TransactionIdStore(transactionId, &cachedTestXid);
+ cachedTestXidStatus = status;
}
- /* ----------------
- * now we update the "last committed transaction" field
- * in the variable relation if we are recording a commit.
- * ----------------
- */
- if (RelationIsValid(VariableRelation) && status == XID_COMMIT)
- UpdateLastCommittedXid(transactionId);
-}
-
-/* --------------------------------
- * TransactionIdGetCommitTime
- * --------------------------------
- */
-
-AbsoluteTime /* commit time of transaction id */
-TransactionIdGetCommitTime(TransactionId transactionId) /* transaction id to
- * test */
-{
- BlockNumber blockNumber;
- AbsoluteTime commitTime; /* commit time */
- bool fail = false; /* success/failure */
-
- /* ----------------
- * return invalid if we aren't running yet...
- * ----------------
- */
- if (!RelationIsValid(TimeRelation))
- return INVALID_ABSTIME;
-
- /* ----------------
- * before going to the buffer manager, check our single
- * item cache to see if we didn't just get the commit time
- * a moment ago.
- * ----------------
- */
- if (TransactionIdEquals(transactionId, cachedGetCommitTimeXid))
- return cachedGetCommitTime;
-
- /* ----------------
- * compute the item pointer corresponding to the
- * page containing our transaction commit time
- * ----------------
- */
- TransComputeBlockNumber(TimeRelation, transactionId, &blockNumber);
- commitTime = TransBlockNumberGetCommitTime(TimeRelation,
- blockNumber,
- transactionId,
- &fail);
-
- /* ----------------
- * update our cache and return the transaction commit time
- * ----------------
- */
- if (!fail)
- {
- TransactionIdStore(transactionId, &cachedGetCommitTimeXid);
- cachedGetCommitTime = commitTime;
- return commitTime;
- }
- else
- return INVALID_ABSTIME;
}
/* ----------------------------------------------------------------
@@ -472,7 +383,6 @@ void
InitializeTransactionLog(void)
{
Relation logRelation;
- Relation timeRelation;
MemoryContext oldContext;
/* ----------------
@@ -503,20 +413,17 @@ InitializeTransactionLog(void)
* ----------------
*/
logRelation = heap_openr(LogRelationName);
- timeRelation = heap_openr(TimeRelationName);
VariableRelation = heap_openr(VariableRelationName);
/* ----------------
* XXX TransactionLogUpdate requires that LogRelation
- * and TimeRelation are valid so we temporarily set
- * them so we can initialize things properly.
- * This could be done cleaner.
+ * is valid so we temporarily set it so we can initialize
+ * things properly. This could be done cleaner.
* ----------------
*/
LogRelation = logRelation;
- TimeRelation = timeRelation;
/* ----------------
- * if we have a virgin database, we initialize the log and time
+ * if we have a virgin database, we initialize the log
* relation by committing the AmiTransactionId (id 512) and we
* initialize the variable relation by setting the next available
* transaction id to FirstTransactionId (id 514). OID initialization
@@ -529,10 +436,12 @@ InitializeTransactionLog(void)
/* ----------------
* SOMEDAY initialize the information stored in
- * the headers of the log/time/variable relations.
+ * the headers of the log/variable relations.
* ----------------
*/
TransactionLogUpdate(AmiTransactionId, XID_COMMIT);
+ TransactionIdStore(AmiTransactionId, &cachedTestXid);
+ cachedTestXidStatus = XID_COMMIT;
VariableRelationPutNextXid(FirstTransactionId);
}
@@ -547,7 +456,6 @@ InitializeTransactionLog(void)
TransRecover(logRelation);
}
LogRelation = (Relation) NULL;
- TimeRelation = (Relation) NULL;
SpinRelease(OidGenLockId);
/* ----------------
@@ -561,7 +469,6 @@ InitializeTransactionLog(void)
* ----------------
*/
LogRelation = logRelation;
- TimeRelation = timeRelation;
/* ----------------
* restore the memory context to the previous context
@@ -651,15 +558,7 @@ TransactionIdCommit(TransactionId transactionId)
if (AMI_OVERRIDE)
return;
- /*
- * Within TransactionLogUpdate we call UpdateLastCommited() which
- * assumes we have exclusive access to pg_variable. Therefore we need
- * to get exclusive access before calling TransactionLogUpdate. -mer
- * 18 Aug 1992
- */
- SpinAcquire(OidGenLockId);
TransactionLogUpdate(transactionId, XID_COMMIT);
- SpinRelease(OidGenLockId);
}
/*
diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c
index 227c47ef546..a80b769982a 100644
--- a/src/backend/access/transam/transsup.c
+++ b/src/backend/access/transam/transsup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.13 1997/09/08 21:41:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.14 1997/11/02 15:24:44 vadim Exp $
*
* NOTES
* This file contains support functions for the high
@@ -23,16 +23,10 @@
#include <access/xact.h>
#include <storage/lmgr.h>
-static AbsoluteTime
-TransBlockGetCommitTime(Block tblock,
- TransactionId transactionId);
static XidStatus
TransBlockGetXidStatus(Block tblock,
TransactionId transactionId);
static void
-TransBlockSetCommitTime(Block tblock,
- TransactionId transactionId, AbsoluteTime commitTime);
-static void
TransBlockSetXidStatus(Block tblock,
TransactionId transactionId, XidStatus xstatus);
@@ -73,8 +67,6 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
*/
if (relation == LogRelation)
itemsPerBlock = TP_NumXidStatusPerBlock;
- else if (relation == TimeRelation)
- itemsPerBlock = TP_NumTimePerBlock;
else
elog(WARN, "TransComputeBlockNumber: unknown relation");
@@ -198,15 +190,6 @@ TransBlockGetXidStatus(Block tblock,
BitIndex offset;
/* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- {
- return XID_INVALID;
- }
-
- /* ----------------
* calculate the index into the transaction data where
* our transaction status is located
*
@@ -249,13 +232,6 @@ TransBlockSetXidStatus(Block tblock,
BitIndex offset;
/* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- return;
-
- /* ----------------
* calculate the index into the transaction data where
* we sould store our transaction status.
*
@@ -295,90 +271,6 @@ TransBlockSetXidStatus(Block tblock,
}
}
-/* --------------------------------
- * TransBlockGetCommitTime
- *
- * This returns the transaction commit time for the
- * specified transaction id in the trans block.
- * --------------------------------
- */
-static AbsoluteTime
-TransBlockGetCommitTime(Block tblock,
- TransactionId transactionId)
-{
- Index index;
- AbsoluteTime *timeArray;
-
- /* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- return INVALID_ABSTIME;
-
- /* ----------------
- * calculate the index into the transaction data where
- * our transaction commit time is located
- *
- * XXX this will be replaced soon when we move to the
- * new transaction id scheme -cim 3/23/90
- *
- * The new scheme is here. -mer 5/24/92
- * ----------------
- */
- index = transactionId % TP_NumTimePerBlock;
-
- /* ----------------
- * return the commit time to the caller
- * ----------------
- */
- timeArray = (AbsoluteTime *) tblock;
- return (AbsoluteTime)
- timeArray[index];
-}
-
-/* --------------------------------
- * TransBlockSetCommitTime
- *
- * This sets the commit time of the specified transaction
- * --------------------------------
- */
-static void
-TransBlockSetCommitTime(Block tblock,
- TransactionId transactionId,
- AbsoluteTime commitTime)
-{
- Index index;
- AbsoluteTime *timeArray;
-
- /* ----------------
- * sanity check
- * ----------------
- */
- if (tblock == NULL)
- return;
-
-
- /* ----------------
- * calculate the index into the transaction data where
- * we sould store our transaction status.
- *
- * XXX this will be replaced soon when we move to the
- * new transaction id scheme -cim 3/23/90
- *
- * The new scheme is here. -mer 5/24/92
- * ----------------
- */
- index = transactionId % TP_NumTimePerBlock;
-
- /* ----------------
- * store the transaction commit time at the specified index
- * ----------------
- */
- timeArray = (AbsoluteTime *) tblock;
- timeArray[index] = commitTime;
-}
-
/* ----------------------------------------------------------------
* transam i/o support routines
* ----------------------------------------------------------------
@@ -495,121 +387,6 @@ TransBlockNumberSetXidStatus(Relation relation,
}
/* --------------------------------
- * TransBlockNumberGetCommitTime
- * --------------------------------
- */
-AbsoluteTime
-TransBlockNumberGetCommitTime(Relation relation,
- BlockNumber blockNumber,
- TransactionId xid,
- bool *failP)
-{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
- AbsoluteTime xtime; /* commit time */
-
- /* ----------------
- * SOMEDAY place a read lock on the time relation
- *
- * That someday is today 5 Aug. 1991 -mer
- * ----------------
- */
- RelationSetLockForRead(relation);
-
- /* ----------------
- * get the block containing the transaction information
- * ----------------
- */
- buffer = ReadBuffer(relation, blockNumber);
- block = BufferGetBlock(buffer);
-
- /* ----------------
- * get the commit time from the block
- * note, for now we always return false in failP.
- * ----------------
- */
- if (failP == NULL)
- failP = &localfail;
- (*failP) = false;
-
- xtime = TransBlockGetCommitTime(block, xid);
-
- /* ----------------
- * release the buffer and return the commit time
- * ----------------
- */
- ReleaseBuffer(buffer);
-
- /* ----------------
- * SOMEDAY release our lock on the time relation
- * ----------------
- */
- RelationUnsetLockForRead(relation);
-
- if ((*failP) == false)
- return xtime;
- else
- return INVALID_ABSTIME;
-
-}
-
-/* --------------------------------
- * TransBlockNumberSetCommitTime
- * --------------------------------
- */
-void
-TransBlockNumberSetCommitTime(Relation relation,
- BlockNumber blockNumber,
- TransactionId xid,
- AbsoluteTime xtime,
- bool *failP)
-{
- Buffer buffer; /* buffer associated with block */
- Block block; /* block containing commit time */
- bool localfail; /* bool used if failP = NULL */
-
- /* ----------------
- * SOMEDAY gain exclusive access to the time relation
- *
- * That someday is today 5 Aug. 1991 -mer
- * ----------------
- */
- RelationSetLockForWrite(relation);
-
- /* ----------------
- * get the block containing our commit time
- * ----------------
- */
- buffer = ReadBuffer(relation, blockNumber);
- block = BufferGetBlock(buffer);
-
- /* ----------------
- * attempt to update the commit time of the transaction on the block.
- * if we are successful, write the block. otherwise release the buffer.
- * note, for now we always return false in failP.
- * ----------------
- */
- if (failP == NULL)
- failP = &localfail;
- (*failP) = false;
-
- TransBlockSetCommitTime(block, xid, xtime);
-
- if ((*failP) == false)
- WriteBuffer(buffer);
- else
- ReleaseBuffer(buffer);
-
- /* ----------------
- * SOMEDAY release our lock on the time relation
- * ----------------
- */
- RelationUnsetLockForWrite(relation);
-
-}
-
-/* --------------------------------
* TransGetLastRecordedTransaction
* --------------------------------
*/
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index 7fdbfd3bcc8..e082350cb66 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.12 1997/09/08 21:41:49 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.13 1997/11/02 15:24:45 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -23,9 +23,7 @@
static void GetNewObjectIdBlock(Oid *oid_return, int oid_block_size);
static void VariableRelationGetNextOid(Oid *oid_return);
static void VariableRelationGetNextXid(TransactionId *xidP);
-static void VariableRelationPutLastXid(TransactionId xid);
static void VariableRelationPutNextOid(Oid *oidP);
-static void VariableRelationGetLastXid(TransactionId *xidP);
/* ---------------------
* spin lock for oid generation
@@ -81,49 +79,6 @@ VariableRelationGetNextXid(TransactionId *xidP)
}
/* --------------------------------
- * VariableRelationGetLastXid
- * --------------------------------
- */
-static void
-VariableRelationGetLastXid(TransactionId *xidP)
-{
- Buffer buf;
- VariableRelationContents var;
-
- /* ----------------
- * We assume that a spinlock has been acquire to guarantee
- * exclusive access to the variable relation.
- * ----------------
- */
-
- /* ----------------
- * do nothing before things are initialized
- * ----------------
- */
- if (!RelationIsValid(VariableRelation))
- return;
-
- /* ----------------
- * read the variable page, get the the lastXid field and
- * release the buffer
- * ----------------
- */
- buf = ReadBuffer(VariableRelation, 0);
-
- if (!BufferIsValid(buf))
- {
- SpinRelease(OidGenLockId);
- elog(WARN, "VariableRelationGetNextXid: ReadBuffer failed");
- }
-
- var = (VariableRelationContents) BufferGetBlock(buf);
-
- TransactionIdStore(var->lastXidData, xidP);
-
- ReleaseBuffer(buf);
-}
-
-/* --------------------------------
* VariableRelationPutNextXid
* --------------------------------
*/
@@ -170,49 +125,6 @@ VariableRelationPutNextXid(TransactionId xid)
}
/* --------------------------------
- * VariableRelationPutLastXid
- * --------------------------------
- */
-static void
-VariableRelationPutLastXid(TransactionId xid)
-{
- Buffer buf;
- VariableRelationContents var;
-
- /* ----------------
- * We assume that a spinlock has been acquire to guarantee
- * exclusive access to the variable relation.
- * ----------------
- */
-
- /* ----------------
- * do nothing before things are initialized
- * ----------------
- */
- if (!RelationIsValid(VariableRelation))
- return;
-
- /* ----------------
- * read the variable page, update the lastXid field and
- * force the page back out to disk.
- * ----------------
- */
- buf = ReadBuffer(VariableRelation, 0);
-
- if (!BufferIsValid(buf))
- {
- SpinRelease(OidGenLockId);
- elog(WARN, "VariableRelationPutLastXid: ReadBuffer failed");
- }
-
- var = (VariableRelationContents) BufferGetBlock(buf);
-
- TransactionIdStore(xid, &(var->lastXidData));
-
- WriteBuffer(buf);
-}
-
-/* --------------------------------
* VariableRelationGetNextOid
* --------------------------------
*/
@@ -449,40 +361,6 @@ GetNewTransactionId(TransactionId *xid)
prefetched_xid_count--;
}
-/* ----------------
- * UpdateLastCommittedXid
- * ----------------
- */
-
-void
-UpdateLastCommittedXid(TransactionId xid)
-{
- TransactionId lastid;
-
-
- /*
- * we assume that spinlock OidGenLockId has been acquired prior to
- * entering this function
- */
-
- /* ----------------
- * get the "last committed" transaction id from
- * the variable relation page.
- * ----------------
- */
- VariableRelationGetLastXid(&lastid);
-
- /* ----------------
- * if the transaction id is greater than the last committed
- * transaction then we update the last committed transaction
- * in the variable relation.
- * ----------------
- */
- if (TransactionIdIsLessThan(lastid, xid))
- VariableRelationPutLastXid(xid);
-
-}
-
/* ----------------------------------------------------------------
* object id generation support
* ----------------------------------------------------------------
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index e5e1057bba2..ea5f1146d88 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.16 1997/09/08 21:41:52 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.17 1997/11/02 15:24:46 vadim Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@@ -497,7 +497,7 @@ CommandCounterIncrement()
if (CurrentTransactionStateData.commandId == FirstCommandId)
{
CommandIdCounterOverflowFlag = true;
- elog(WARN, "You may only have 65535 commands per transaction");
+ elog(WARN, "You may only have 2^32-1 commands per transaction");
}
CurrentTransactionStateData.scanCommandId =
diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c
index b60c6ba7ef3..4a0799ac2ca 100644
--- a/src/backend/access/transam/xid.c
+++ b/src/backend/access/transam/xid.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.10 1997/09/08 21:41:56 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.11 1997/11/02 15:24:47 vadim Exp $
*
* OLD COMMENTS
* XXX WARNING
@@ -30,18 +30,6 @@ extern TransactionId DisabledTransactionId;
extern TransactionId AmiTransactionId;
extern TransactionId FirstTransactionId;
-/* ----------------------------------------------------------------
- * TransactionIdIsValid
- *
- * Macro-ize me.
- * ----------------------------------------------------------------
- */
-bool
-TransactionIdIsValid(TransactionId transactionId)
-{
- return ((bool) (transactionId != NullTransactionId));
-}
-
/* XXX char16 name for catalogs */
TransactionId
xidin(char *representation)
@@ -66,32 +54,6 @@ xidout(TransactionId transactionId)
}
/* ----------------------------------------------------------------
- * StoreInvalidTransactionId
- *
- * Maybe do away with Pointer types in these routines.
- * Macro-ize this one.
- * ----------------------------------------------------------------
- */
-void
-StoreInvalidTransactionId(TransactionId *destination)
-{
- *destination = NullTransactionId;
-}
-
-/* ----------------------------------------------------------------
- * TransactionIdStore
- *
- * Macro-ize this one.
- * ----------------------------------------------------------------
- */
-void
-TransactionIdStore(TransactionId transactionId,
- TransactionId *destination)
-{
- *destination = transactionId;
-}
-
-/* ----------------------------------------------------------------
* TransactionIdEquals
* ----------------------------------------------------------------
*/