@@ -367,9 +367,6 @@ static inline void ProcArrayEndTransactionInternal(PGPROC *proc, TransactionId l
367
367
static void ProcArrayGroupClearXid (PGPROC * proc , TransactionId latestXid );
368
368
static void MaintainLatestCompletedXid (TransactionId latestXid );
369
369
static void MaintainLatestCompletedXidRecovery (TransactionId latestXid );
370
- static void TransactionIdRetreatSafely (TransactionId * xid ,
371
- int retreat_by ,
372
- FullTransactionId rel );
373
370
374
371
static inline FullTransactionId FullXidRelativeTo (FullTransactionId rel ,
375
372
TransactionId xid );
@@ -1709,10 +1706,7 @@ TransactionIdIsActive(TransactionId xid)
1709
1706
* do about that --- data is only protected if the walsender runs continuously
1710
1707
* while queries are executed on the standby. (The Hot Standby code deals
1711
1708
* with such cases by failing standby queries that needed to access
1712
- * already-removed data, so there's no integrity bug.) The computed values
1713
- * are also adjusted with vacuum_defer_cleanup_age, so increasing that setting
1714
- * on the fly is another easy way to make horizons move backwards, with no
1715
- * consequences for data integrity.
1709
+ * already-removed data, so there's no integrity bug.)
1716
1710
*
1717
1711
* Note: the approximate horizons (see definition of GlobalVisState) are
1718
1712
* updated by the computations done here. That's currently required for
@@ -1877,50 +1871,11 @@ ComputeXidHorizons(ComputeXidHorizonsResult *h)
1877
1871
TransactionIdOlder (h -> data_oldest_nonremovable , kaxmin );
1878
1872
/* temp relations cannot be accessed in recovery */
1879
1873
}
1880
- else
1881
- {
1882
- /*
1883
- * Compute the cutoff XID by subtracting vacuum_defer_cleanup_age.
1884
- *
1885
- * vacuum_defer_cleanup_age provides some additional "slop" for the
1886
- * benefit of hot standby queries on standby servers. This is quick
1887
- * and dirty, and perhaps not all that useful unless the primary has a
1888
- * predictable transaction rate, but it offers some protection when
1889
- * there's no walsender connection. Note that we are assuming
1890
- * vacuum_defer_cleanup_age isn't large enough to cause wraparound ---
1891
- * so guc.c should limit it to no more than the xidStopLimit threshold
1892
- * in varsup.c. Also note that we intentionally don't apply
1893
- * vacuum_defer_cleanup_age on standby servers.
1894
- *
1895
- * Need to use TransactionIdRetreatSafely() instead of open-coding the
1896
- * subtraction, to prevent creating an xid before
1897
- * FirstNormalTransactionId.
1898
- */
1899
- Assert (TransactionIdPrecedesOrEquals (h -> oldest_considered_running ,
1900
- h -> shared_oldest_nonremovable ));
1901
- Assert (TransactionIdPrecedesOrEquals (h -> shared_oldest_nonremovable ,
1902
- h -> data_oldest_nonremovable ));
1903
1874
1904
- if (vacuum_defer_cleanup_age > 0 )
1905
- {
1906
- TransactionIdRetreatSafely (& h -> oldest_considered_running ,
1907
- vacuum_defer_cleanup_age ,
1908
- h -> latest_completed );
1909
- TransactionIdRetreatSafely (& h -> shared_oldest_nonremovable ,
1910
- vacuum_defer_cleanup_age ,
1911
- h -> latest_completed );
1912
- TransactionIdRetreatSafely (& h -> data_oldest_nonremovable ,
1913
- vacuum_defer_cleanup_age ,
1914
- h -> latest_completed );
1915
- /* defer doesn't apply to temp relations */
1916
-
1917
-
1918
- Assert (TransactionIdPrecedesOrEquals (h -> oldest_considered_running ,
1919
- h -> shared_oldest_nonremovable ));
1920
- Assert (TransactionIdPrecedesOrEquals (h -> shared_oldest_nonremovable ,
1921
- h -> data_oldest_nonremovable ));
1922
- }
1923
- }
1875
+ Assert (TransactionIdPrecedesOrEquals (h -> oldest_considered_running ,
1876
+ h -> shared_oldest_nonremovable ));
1877
+ Assert (TransactionIdPrecedesOrEquals (h -> shared_oldest_nonremovable ,
1878
+ h -> data_oldest_nonremovable ));
1924
1879
1925
1880
/*
1926
1881
* Check whether there are replication slots requiring an older xmin.
@@ -1947,8 +1902,8 @@ ComputeXidHorizons(ComputeXidHorizonsResult *h)
1947
1902
h -> slot_catalog_xmin );
1948
1903
1949
1904
/*
1950
- * It's possible that slots / vacuum_defer_cleanup_age backed up the
1951
- * horizons further than oldest_considered_running. Fix.
1905
+ * It's possible that slots backed up the horizons further than
1906
+ * oldest_considered_running. Fix.
1952
1907
*/
1953
1908
h -> oldest_considered_running =
1954
1909
TransactionIdOlder (h -> oldest_considered_running ,
@@ -2490,15 +2445,9 @@ GetSnapshotData(Snapshot snapshot)
2490
2445
*/
2491
2446
oldestfxid = FullXidRelativeTo (latest_completed , oldestxid );
2492
2447
2493
- /* apply vacuum_defer_cleanup_age */
2494
- def_vis_xid_data = xmin ;
2495
- TransactionIdRetreatSafely (& def_vis_xid_data ,
2496
- vacuum_defer_cleanup_age ,
2497
- oldestfxid );
2498
-
2499
2448
/* Check whether there's a replication slot requiring an older xmin. */
2500
2449
def_vis_xid_data =
2501
- TransactionIdOlder (def_vis_xid_data , replication_slot_xmin );
2450
+ TransactionIdOlder (xmin , replication_slot_xmin );
2502
2451
2503
2452
/*
2504
2453
* Rows in non-shared, non-catalog tables possibly could be vacuumed
@@ -4320,44 +4269,6 @@ GlobalVisCheckRemovableXid(Relation rel, TransactionId xid)
4320
4269
return GlobalVisTestIsRemovableXid (state , xid );
4321
4270
}
4322
4271
4323
- /*
4324
- * Safely retract *xid by retreat_by, store the result in *xid.
4325
- *
4326
- * Need to be careful to prevent *xid from retreating below
4327
- * FirstNormalTransactionId during epoch 0. This is important to prevent
4328
- * generating xids that cannot be converted to a FullTransactionId without
4329
- * wrapping around.
4330
- *
4331
- * If retreat_by would lead to a too old xid, FirstNormalTransactionId is
4332
- * returned instead.
4333
- */
4334
- static void
4335
- TransactionIdRetreatSafely (TransactionId * xid , int retreat_by , FullTransactionId rel )
4336
- {
4337
- TransactionId original_xid = * xid ;
4338
- FullTransactionId fxid ;
4339
- uint64 fxid_i ;
4340
-
4341
- Assert (TransactionIdIsNormal (original_xid ));
4342
- Assert (retreat_by >= 0 ); /* relevant GUCs are stored as ints */
4343
- AssertTransactionIdInAllowableRange (original_xid );
4344
-
4345
- if (retreat_by == 0 )
4346
- return ;
4347
-
4348
- fxid = FullXidRelativeTo (rel , original_xid );
4349
- fxid_i = U64FromFullTransactionId (fxid );
4350
-
4351
- if ((fxid_i - FirstNormalTransactionId ) <= retreat_by )
4352
- * xid = FirstNormalTransactionId ;
4353
- else
4354
- {
4355
- * xid = TransactionIdRetreatedBy (original_xid , retreat_by );
4356
- Assert (TransactionIdIsNormal (* xid ));
4357
- Assert (NormalTransactionIdPrecedes (* xid , original_xid ));
4358
- }
4359
- }
4360
-
4361
4272
/*
4362
4273
* Convert a 32 bit transaction id into 64 bit transaction id, by assuming it
4363
4274
* is within MaxTransactionId / 2 of XidFromFullTransactionId(rel).
0 commit comments