diff options
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/heap/heapam.c | 29 | ||||
-rw-r--r-- | src/backend/access/transam/transam.c | 21 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 5 |
3 files changed, 32 insertions, 23 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 1ea78ec8633..39f6d223ebd 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.43 1999/05/25 16:07:04 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.44 1999/06/10 14:17:05 vadim Exp $ * * * INTERFACE ROUTINES @@ -1152,8 +1152,13 @@ l1: LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); if (TransactionIdDidAbort(xwait)) goto l1; - /* concurrent xact committed */ - Assert(tp.t_data->t_xmax == xwait); + /* + * xwait is committed but if xwait had just marked + * the tuple for update then some other xaction could + * update this tuple before we got to this point. + */ + if (tp.t_data->t_xmax != xwait) + goto l1; if (!(tp.t_data->t_infomask & HEAP_XMAX_COMMITTED)) { tp.t_data->t_infomask |= HEAP_XMAX_COMMITTED; @@ -1242,8 +1247,13 @@ l2: LockBuffer(buffer, BUFFER_LOCK_EXCLUSIVE); if (TransactionIdDidAbort(xwait)) goto l2; - /* concurrent xact committed */ - Assert(oldtup.t_data->t_xmax == xwait); + /* + * xwait is committed but if xwait had just marked + * the tuple for update then some other xaction could + * update this tuple before we got to this point. + */ + if (oldtup.t_data->t_xmax != xwait) + goto l2; if (!(oldtup.t_data->t_infomask & HEAP_XMAX_COMMITTED)) { oldtup.t_data->t_infomask |= HEAP_XMAX_COMMITTED; @@ -1359,8 +1369,13 @@ l3: LockBuffer(*buffer, BUFFER_LOCK_EXCLUSIVE); if (TransactionIdDidAbort(xwait)) goto l3; - /* concurrent xact committed */ - Assert(tuple->t_data->t_xmax == xwait); + /* + * xwait is committed but if xwait had just marked + * the tuple for update then some other xaction could + * update this tuple before we got to this point. + */ + if (tuple->t_data->t_xmax != xwait) + goto l3; if (!(tuple->t_data->t_infomask & HEAP_XMAX_COMMITTED)) { tuple->t_data->t_infomask |= HEAP_XMAX_COMMITTED; diff --git a/src/backend/access/transam/transam.c b/src/backend/access/transam/transam.c index fe1d57d769c..03bb786f4b0 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.26 1999/05/25 16:07:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.27 1999/06/10 14:17:06 vadim Exp $ * * NOTES * This file contains the high level access-method interface to the @@ -172,8 +172,14 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */ if (!fail) { - TransactionIdStore(transactionId, &cachedTestXid); - cachedTestXidStatus = xidstatus; + /* + * DO NOT cache status for transactions in unknown state !!! + */ + if (xidstatus == XID_COMMIT || xidstatus == XID_ABORT) + { + TransactionIdStore(transactionId, &cachedTestXid); + cachedTestXidStatus = xidstatus; + } return (bool) (status == xidstatus); } @@ -576,12 +582,3 @@ TransactionIdAbort(TransactionId transactionId) TransactionLogUpdate(transactionId, XID_ABORT); } - -void -TransactionIdFlushCache() -{ - - TransactionIdStore(AmiTransactionId, &cachedTestXid); - cachedTestXidStatus = XID_COMMIT; - -} diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index d03136b5085..4689a2f82ea 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.40 1999/06/06 20:19:34 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.41 1999/06/10 14:17:06 vadim Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -514,8 +514,6 @@ CommandCounterIncrement() AtCommit_Cache(); AtStart_Cache(); - TransactionIdFlushCache(); - } void @@ -822,7 +820,6 @@ StartTransaction() { TransactionState s = CurrentTransactionState; - TransactionIdFlushCache(); FreeXactSnapshot(); XactIsoLevel = DefaultXactIsoLevel; |