1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

1. Additional fix against ERROR: Child itemid marked as unused

in CommitTransaction().
2. Changes in GetSnapshotData().
This commit is contained in:
Vadim B. Mikheev
1999-06-03 13:33:13 +00:00
parent f103501286
commit 5541abee0d
2 changed files with 49 additions and 25 deletions

View File

@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.38 1999/06/03 04:41:41 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.39 1999/06/03 13:33:12 vadim Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
@ -646,18 +646,6 @@ RecordTransactionCommit()
FlushBufferPool(!TransactionFlushEnabled());
if (leak)
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;
}
}
@ -950,6 +938,28 @@ CommitTransaction()
DestroyNoNameRels();
AtEOXact_portals();
RecordTransactionCommit();
/*
* Let others know about no transaction in progress by me.
* Note that this must be done _before_ releasing locks we hold
* and SpinAcquire(ShmemIndexLock) is required - or bad (too high)
* XmaxRecent value might be used by vacuum: UPDATE with xid 0 is
* blocked by xid 1' UPDATE, xid 1 is doing commit while xid 2
* gets snapshot - if xid 2' GetSnapshotData sees xid 1 as running
* then it must see xid 0 as running as well or XmaxRecent = 1
* might be used by concurrent vacuum causing
* ERROR: Child itemid marked as unused
* This bug was reported by Hiroshi Inoue and I was able to reproduce
* it with 3 sessions and gdb. - vadim 06/03/99
*/
if (MyProc != (PROC *) NULL)
{
SpinAcquire(ShmemIndexLock);
MyProc->xid = InvalidTransactionId;
MyProc->xmin = InvalidTransactionId;
SpinRelease(ShmemIndexLock);
}
RelationPurgeLocalRelation(true);
AtCommit_Cache();
AtCommit_Locks();