mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Refactor GetOldestXmin() to use flags
Replace ignoreVacuum parameter with more flexible flags. Author: Eiji Seki Review: Haribabu Kommi
This commit is contained in:
@@ -1260,8 +1260,9 @@ TransactionIdIsActive(TransactionId xid)
|
||||
* If rel is NULL or a shared relation, all backends are considered, otherwise
|
||||
* only backends running in this database are considered.
|
||||
*
|
||||
* If ignoreVacuum is TRUE then backends with the PROC_IN_VACUUM flag set are
|
||||
* ignored.
|
||||
* The flags are used to ignore the backends in calculation when any of the
|
||||
* corresponding flags is set. Typically, if you want to ignore ones with
|
||||
* PROC_IN_VACUUM flag, you can use PROCARRAY_FLAGS_VACUUM.
|
||||
*
|
||||
* This is used by VACUUM to decide which deleted tuples must be preserved in
|
||||
* the passed in table. For shared relations backends in all databases must be
|
||||
@@ -1302,7 +1303,7 @@ TransactionIdIsActive(TransactionId xid)
|
||||
* GetOldestXmin() move backwards, with no consequences for data integrity.
|
||||
*/
|
||||
TransactionId
|
||||
GetOldestXmin(Relation rel, bool ignoreVacuum)
|
||||
GetOldestXmin(Relation rel, int flags)
|
||||
{
|
||||
ProcArrayStruct *arrayP = procArray;
|
||||
TransactionId result;
|
||||
@@ -1340,14 +1341,7 @@ GetOldestXmin(Relation rel, bool ignoreVacuum)
|
||||
volatile PGPROC *proc = &allProcs[pgprocno];
|
||||
volatile PGXACT *pgxact = &allPgXact[pgprocno];
|
||||
|
||||
/*
|
||||
* Backend is doing logical decoding which manages xmin separately,
|
||||
* check below.
|
||||
*/
|
||||
if (pgxact->vacuumFlags & PROC_IN_LOGICAL_DECODING)
|
||||
continue;
|
||||
|
||||
if (ignoreVacuum && (pgxact->vacuumFlags & PROC_IN_VACUUM))
|
||||
if (pgxact->vacuumFlags & flags)
|
||||
continue;
|
||||
|
||||
if (allDbs ||
|
||||
|
||||
Reference in New Issue
Block a user