Skip to content

Commit d9e1ea4

Browse files
committed
Revert back-branch changes in behavior of age(xid).
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 5829387 and follow-on commits in the back branches only.
1 parent fcd7fe5 commit d9e1ea4

File tree

3 files changed

+2
-27
lines changed

3 files changed

+2
-27
lines changed

src/backend/access/transam/xact.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -386,30 +386,6 @@ GetCurrentTransactionIdIfAny(void)
386386
return CurrentTransactionState->transactionId;
387387
}
388388

389-
/*
390-
* GetStableLatestTransactionId
391-
*
392-
* Get the XID once and then return same value for rest of transaction.
393-
* Acts as a useful reference point for maintenance tasks.
394-
*/
395-
TransactionId
396-
GetStableLatestTransactionId(void)
397-
{
398-
static LocalTransactionId lxid = InvalidLocalTransactionId;
399-
static TransactionId stablexid = InvalidTransactionId;
400-
401-
if (lxid != MyProc->lxid)
402-
{
403-
lxid = MyProc->lxid;
404-
stablexid = GetTopTransactionIdIfAny();
405-
if (!TransactionIdIsValid(stablexid))
406-
stablexid = ReadNewTransactionId();
407-
}
408-
409-
Assert(TransactionIdIsValid(stablexid));
410-
411-
return stablexid;
412-
}
413389

414390
/*
415391
* AssignTransactionId

src/backend/utils/adt/xid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ xideq(PG_FUNCTION_ARGS)
8787
}
8888

8989
/*
90-
* xid_age - compute age of an XID (relative to latest stable xid)
90+
* xid_age - compute age of an XID (relative to current xact)
9191
*/
9292
Datum
9393
xid_age(PG_FUNCTION_ARGS)
9494
{
9595
TransactionId xid = PG_GETARG_TRANSACTIONID(0);
96-
TransactionId now = GetStableLatestTransactionId();
96+
TransactionId now = GetTopTransactionId();
9797

9898
/* Permanent XIDs are always infinitely old */
9999
if (!TransactionIdIsNormal(xid))

src/include/access/xact.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ extern TransactionId GetTopTransactionId(void);
177177
extern TransactionId GetTopTransactionIdIfAny(void);
178178
extern TransactionId GetCurrentTransactionId(void);
179179
extern TransactionId GetCurrentTransactionIdIfAny(void);
180-
extern TransactionId GetStableLatestTransactionId(void);
181180
extern SubTransactionId GetCurrentSubTransactionId(void);
182181
extern CommandId GetCurrentCommandId(bool used);
183182
extern TimestampTz GetCurrentTransactionStartTimestamp(void);

0 commit comments

Comments
 (0)