Remove logic in XactLockTableWait() that attempted to mark a crashed
authorTom Lane
Fri, 13 Jan 2006 21:32:12 +0000 (21:32 +0000)
committerTom Lane
Fri, 13 Jan 2006 21:32:12 +0000 (21:32 +0000)
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

index 60e374959b036a45bb462c93a3d8f2135b5f647c..9e3ff591e4ea9392e861e71830bde45d2fd0830b 100644 (file)
@@ -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;
 }