]> granicus.if.org Git - postgresql/commitdiff
Revert back-branch changes in behavior of age(xid).
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 31 May 2012 15:12:33 +0000 (11:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 31 May 2012 15:12:33 +0000 (11:12 -0400)
Per discussion, it does not seem like a good idea to change the behavior of
age(xid) in a minor release, even though the old definition causes the
function to fail on hot standby slaves.  Therefore, revert commit
5829387381d2e4edf84652bb5a712f6185860670 and follow-on commits in the back
branches only.

src/backend/access/transam/xact.c
src/backend/utils/adt/xid.c
src/include/access/xact.h

index 511e17c2e455b3763e6ae43624b4d193c8d8b82e..33431585d865c0345a458018c72fa2ae9c820e73 100644 (file)
@@ -386,30 +386,6 @@ GetCurrentTransactionIdIfAny(void)
        return CurrentTransactionState->transactionId;
 }
 
-/*
- *     GetStableLatestTransactionId
- *
- * Get the XID once and then return same value for rest of transaction.
- * Acts as a useful reference point for maintenance tasks.
- */
-TransactionId
-GetStableLatestTransactionId(void)
-{
-       static LocalTransactionId lxid = InvalidLocalTransactionId;
-       static TransactionId stablexid = InvalidTransactionId;
-
-       if (lxid != MyProc->lxid)
-       {
-               lxid = MyProc->lxid;
-               stablexid = GetTopTransactionIdIfAny();
-               if (!TransactionIdIsValid(stablexid))
-                       stablexid = ReadNewTransactionId();
-       }
-
-       Assert(TransactionIdIsValid(stablexid));
-
-       return stablexid;
-}
 
 /*
  * AssignTransactionId
index f370c7f162a3c09df2584be2c99c655a71630c6e..fcde92cb8a8f83958e175f10d223e291b3365a43 100644 (file)
@@ -87,13 +87,13 @@ xideq(PG_FUNCTION_ARGS)
 }
 
 /*
- *             xid_age                 - compute age of an XID (relative to latest stable xid)
+ *             xid_age                 - compute age of an XID (relative to current xact)
  */
 Datum
 xid_age(PG_FUNCTION_ARGS)
 {
        TransactionId xid = PG_GETARG_TRANSACTIONID(0);
-       TransactionId now = GetStableLatestTransactionId();
+       TransactionId now = GetTopTransactionId();
 
        /* Permanent XIDs are always infinitely old */
        if (!TransactionIdIsNormal(xid))
index daa42d9243551779c9d5e6825ba3d7313c23751a..12ec693f4431f805aa105086928e32d4bedf61ae 100644 (file)
@@ -177,7 +177,6 @@ extern TransactionId GetTopTransactionId(void);
 extern TransactionId GetTopTransactionIdIfAny(void);
 extern TransactionId GetCurrentTransactionId(void);
 extern TransactionId GetCurrentTransactionIdIfAny(void);
-extern TransactionId GetStableLatestTransactionId(void);
 extern SubTransactionId GetCurrentSubTransactionId(void);
 extern CommandId GetCurrentCommandId(bool used);
 extern TimestampTz GetCurrentTransactionStartTimestamp(void);