diff options
Diffstat (limited to 'src/backend/access/transam')
-rw-r--r-- | src/backend/access/transam/transam.c | 21 | ||||
-rw-r--r-- | src/backend/access/transam/transsup.c | 33 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 7 |
3 files changed, 25 insertions, 36 deletions
diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index 5bcce3c2d70..b68b6ab6691 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.19 1998/09/01 04:27:15 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.20 1998/12/15 12:45:30 vadim Exp $ * * NOTES * This file contains the high level access-method interface to the @@ -172,8 +172,12 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */ if (!fail) { - TransactionIdStore(transactionId, &cachedTestXid); - cachedTestXidStatus = xidstatus; + /* must not cache status of running xaction !!! */ + if (xidstatus != XID_INPROGRESS) + { + TransactionIdStore(transactionId, &cachedTestXid); + cachedTestXidStatus = xidstatus; + } return (bool) (status == xidstatus); } @@ -219,11 +223,14 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */ status, &fail); - /* ---------------- - * update (invalidate) our single item TransactionLogTest cache. - * ---------------- - */ + /* + * update (invalidate) our single item TransactionLogTest cache. + * if (status != XID_COMMIT) + * + * What's the hell ?! Why != XID_COMMIT ?! + */ + if (status != XID_INPROGRESS) { TransactionIdStore(transactionId, &cachedTestXid); cachedTestXidStatus = status; diff --git a/src/backend/access/transam/transsup.c b/src/backend/access/transam/transsup.c index 6f1b09b5774..edf953384f9 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.17 1998/09/01 04:27:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.18 1998/12/15 12:45:33 vadim Exp $ * * NOTES * This file contains support functions for the high @@ -290,17 +290,11 @@ TransBlockNumberGetXidStatus(Relation relation, bool localfail; /* bool used if failP = NULL */ /* ---------------- - * SOMEDAY place a read lock on the log relation - * That someday is today 5 Aug 1991 -mer - * ---------------- - */ - RelationSetLockForRead(relation); - - /* ---------------- * get the page containing the transaction information * ---------------- */ buffer = ReadBuffer(relation, blockNumber); + LockBuffer(buffer, BUFFER_LOCK_SHARE); block = BufferGetBlock(buffer); /* ---------------- @@ -318,14 +312,9 @@ TransBlockNumberGetXidStatus(Relation relation, * release the buffer and return the status * ---------------- */ + LockBuffer(buffer, BUFFER_LOCK_UNLOCK); ReleaseBuffer(buffer); - /* ---------------- - * SOMEDAY release our lock on the log relation - * ---------------- - */ - RelationUnsetLockForRead(relation); - return xstatus; } @@ -346,18 +335,11 @@ TransBlockNumberSetXidStatus(Relation relation, bool localfail; /* bool used if failP = NULL */ /* ---------------- - * SOMEDAY gain exclusive access to the log relation - * - * That someday is today 5 Aug 1991 -mer - * ---------------- - */ - RelationSetLockForWrite(relation); - - /* ---------------- * get the block containing the transaction status * ---------------- */ buffer = ReadBuffer(relation, blockNumber); + LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); block = BufferGetBlock(buffer); /* ---------------- @@ -372,16 +354,11 @@ TransBlockNumberSetXidStatus(Relation relation, TransBlockSetXidStatus(block, xid, xstatus); + LockBuffer(buffer, BUFFER_LOCK_UNLOCK); if ((*failP) == false) WriteBuffer(buffer); else ReleaseBuffer(buffer); - - /* ---------------- - * SOMEDAY release our lock on the log relation - * ---------------- - */ - RelationUnsetLockForWrite(relation); } /* -------------------------------- diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 35bcbfed6a4..002b43cd040 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.25 1998/10/08 18:29:15 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.26 1998/12/15 12:45:35 vadim Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -194,6 +194,8 @@ TransactionStateData CurrentTransactionStateData = { TransactionState CurrentTransactionState = &CurrentTransactionStateData; +int XactIsoLevel = XACT_SERIALIZED; + /* ---------------- * info returned when the system is disabled * @@ -816,6 +818,8 @@ StartTransaction() */ GetNewTransactionId(&(s->transactionIdData)); + XactLockTableInsert(s->transactionIdData); + /* ---------------- * initialize current transaction state fields * ---------------- @@ -966,6 +970,7 @@ AbortTransaction() * do abort processing * ---------------- */ + UnlockBuffers(); AtAbort_Notify(); CloseSequences(); AtEOXact_portals(); |