mirror of
https://github.com/postgres/postgres.git
synced 2025-04-25 21:42:33 +03:00
1. MyProc->xid assignment is moved to GetNewTransactionId so newer
transactions will not assume that MyProc transaction was committed before snapshot calculations. With old MyProc->xid assignment (in xact.c:StartTransaction()) there was ability to see the same row twice (I used gdb for this)!... 2. Assignments of InvalidTransactionId to MyProc->xid and MyProc->xmin are moved from xact.c:CommitTransaction() to xact.c:RecordTransactionCommit() - this invalidation must be done before releasing transaction locks or bad (too high) XmaxRecent value might be used by vacuum ("ERROR: Child itemid marked as unused" reported by "Hiroshi Inoue" <Inoue@tpf.co.jp>; once again, gdb allowed me reproduce this error).
This commit is contained in:
parent
f3d2b2e0c7
commit
9680a71205
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.20 1999/05/25 16:07:48 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.21 1999/06/03 04:41:40 vadim Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -19,6 +19,7 @@
|
|||||||
#include <access/xact.h>
|
#include <access/xact.h>
|
||||||
#include <access/heapam.h>
|
#include <access/heapam.h>
|
||||||
#include <catalog/catname.h>
|
#include <catalog/catname.h>
|
||||||
|
#include <storage/proc.h>
|
||||||
|
|
||||||
static void GetNewObjectIdBlock(Oid *oid_return, int oid_block_size);
|
static void GetNewObjectIdBlock(Oid *oid_return, int oid_block_size);
|
||||||
static void VariableRelationGetNextOid(Oid *oid_return);
|
static void VariableRelationGetNextOid(Oid *oid_return);
|
||||||
@ -308,6 +309,9 @@ GetNewTransactionId(TransactionId *xid)
|
|||||||
TransactionIdAdd(&(ShmemVariableCache->nextXid), 1);
|
TransactionIdAdd(&(ShmemVariableCache->nextXid), 1);
|
||||||
(ShmemVariableCache->xid_count)--;
|
(ShmemVariableCache->xid_count)--;
|
||||||
|
|
||||||
|
if (MyProc != (PROC *) NULL)
|
||||||
|
MyProc->xid = *xid;
|
||||||
|
|
||||||
SpinRelease(OidGenLockId);
|
SpinRelease(OidGenLockId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.37 1999/05/31 22:53:59 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.38 1999/06/03 04:41:41 vadim Exp $
|
||||||
*
|
*
|
||||||
* NOTES
|
* NOTES
|
||||||
* Transaction aborts can now occur two ways:
|
* Transaction aborts can now occur two ways:
|
||||||
@ -646,6 +646,18 @@ RecordTransactionCommit()
|
|||||||
FlushBufferPool(!TransactionFlushEnabled());
|
FlushBufferPool(!TransactionFlushEnabled());
|
||||||
if (leak)
|
if (leak)
|
||||||
ResetBufferPool();
|
ResetBufferPool();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Let others know about no transaction in progress.
|
||||||
|
* Note that this must be done _before_ releasing locks
|
||||||
|
* we hold or bad (too high) XmaxRecent value might be
|
||||||
|
* used by vacuum.
|
||||||
|
*/
|
||||||
|
if (MyProc != (PROC *) NULL)
|
||||||
|
{
|
||||||
|
MyProc->xid = InvalidTransactionId;
|
||||||
|
MyProc->xmin = InvalidTransactionId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -884,13 +896,6 @@ StartTransaction()
|
|||||||
*/
|
*/
|
||||||
s->state = TRANS_INPROGRESS;
|
s->state = TRANS_INPROGRESS;
|
||||||
|
|
||||||
/*
|
|
||||||
* Let others to know about current transaction is in progress - vadim
|
|
||||||
* 11/26/96
|
|
||||||
*/
|
|
||||||
if (MyProc != (PROC *) NULL)
|
|
||||||
MyProc->xid = s->transactionIdData;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------
|
/* ---------------
|
||||||
@ -958,15 +963,6 @@ CommitTransaction()
|
|||||||
*/
|
*/
|
||||||
s->state = TRANS_DEFAULT;
|
s->state = TRANS_DEFAULT;
|
||||||
|
|
||||||
/*
|
|
||||||
* Let others to know about no transaction in progress - vadim
|
|
||||||
* 11/26/96
|
|
||||||
*/
|
|
||||||
if (MyProc != (PROC *) NULL)
|
|
||||||
{
|
|
||||||
MyProc->xid = InvalidTransactionId;
|
|
||||||
MyProc->xmin = InvalidTransactionId;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------
|
/* --------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user