From 39fc1fb07ad237b1f5cc5516f75969dbcbfaec82 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 13 Jan 2006 21:32:12 +0000 Subject: [PATCH] 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. --- src/backend/storage/lmgr/lmgr.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/backend/storage/lmgr/lmgr.c b/src/backend/storage/lmgr/lmgr.c index 60e374959b..9e3ff591e4 100644 --- a/src/backend/storage/lmgr/lmgr.c +++ b/src/backend/storage/lmgr/lmgr.c @@ -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; } -- 2.40.0