Remove logic in XactLockTableWait() that attempted to mark a crashed
transaction as aborted. Since we only call XactLockTableWait on XIDs that we believe to be currently running, the odds of this code ever actually firing are minimal. It's certainly unnecessary, since a transaction that's not either running or committed will be presumed aborted anyway. What's more, it's not hard to imagine scenarios where this could result in corrupting pg_clog: for instance, if a bogus XID somehow got passed to XactLockTableWait. I think the code probably dates from the ancient era when we didn't have TransactionIdIsInProgress; back then it may have been necessary, but now I think it's a waste of cycles and potentially dangerous. Per discussion with Qingqing Zhou and Karsten Hilbert.
This commit is contained in:
parent
7d6d02b640
commit
39fc1fb07a
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lmgr.c,v 1.80 2005/12/09 01:22:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/lmgr/lmgr.c,v 1.81 2006/01/13 21:32:12 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -383,13 +383,6 @@ XactLockTableWait(TransactionId xid)
|
||||
break;
|
||||
xid = SubTransGetParent(xid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Transaction was committed/aborted/crashed - we have to update pg_clog
|
||||
* if transaction is still marked as running.
|
||||
*/
|
||||
if (!TransactionIdDidCommit(xid) && !TransactionIdDidAbort(xid))
|
||||
TransactionIdAbort(xid);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -421,13 +414,6 @@ ConditionalXactLockTableWait(TransactionId xid)
|
||||
xid = SubTransGetParent(xid);
|
||||
}
|
||||
|
||||
/*
|
||||
* Transaction was committed/aborted/crashed - we have to update pg_clog
|
||||
* if transaction is still marked as running.
|
||||
*/
|
||||
if (!TransactionIdDidCommit(xid) && !TransactionIdDidAbort(xid))
|
||||
TransactionIdAbort(xid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user