]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Revert back-branch changes in behavior of age(xid).
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 31 May 2012 15:12:26 +0000 (11:12 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 31 May 2012 15:12:26 +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 184fe28f5c53c602f35a52e1d680254cb50e9644..a38fed18fb69158995c88cf438df00965c6b9f64 100644 (file)
@@ -392,30 +392,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 0613bd09286d9e83341a29b7055673324f483a4c..76d29ff2a379de01d0e895ccd3fc2601cfcadd13 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 29ef4a1bce388e90304b3ccaee06169d8b27cb14..cb440d41f1401f69698481e2c175eb903f879fed 100644 (file)
@@ -198,7 +198,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);