Commit 32ac7a11 authored by Simon Riggs's avatar Simon Riggs

Exclude VACUUMs from RunningXactData

GetRunningTransactionData() should ignore VACUUM procs because in some
cases they are assigned xids. This could lead to holding back xmin via
the route of passing the xid to standby and then having that hold back
xmin on master via feedback.

Backpatch to 9.1 needed, but will only do so on supported versions.
Backpatch once proven on the buildfarm.

Reported-by: Greg Stark
Author: Simon Riggs
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/CANP8+jJBYt=4PpTfiPb0UrH1_iPhzsxKH5Op_Wec634F0ohnAw@mail.gmail.com
parent 848b1f3e
...@@ -1907,7 +1907,7 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc) ...@@ -1907,7 +1907,7 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
* GetRunningTransactionData -- returns information about running transactions. * GetRunningTransactionData -- returns information about running transactions.
* *
* Similar to GetSnapshotData but returns more information. We include * Similar to GetSnapshotData but returns more information. We include
* all PGXACTs with an assigned TransactionId, even VACUUM processes. * all PGXACTs with an assigned TransactionId, but not VACUUM processes.
* *
* We acquire XidGenLock and ProcArrayLock, but the caller is responsible for * We acquire XidGenLock and ProcArrayLock, but the caller is responsible for
* releasing them. Acquiring XidGenLock ensures that no new XIDs enter the proc * releasing them. Acquiring XidGenLock ensures that no new XIDs enter the proc
...@@ -1995,6 +1995,10 @@ GetRunningTransactionData(void) ...@@ -1995,6 +1995,10 @@ GetRunningTransactionData(void)
volatile PGXACT *pgxact = &allPgXact[pgprocno]; volatile PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId xid; TransactionId xid;
/* Ignore procs running LAZY VACUUM */
if (pgxact->vacuumFlags & PROC_IN_VACUUM)
continue;
/* Fetch xid just once - see GetNewTransactionId */ /* Fetch xid just once - see GetNewTransactionId */
xid = pgxact->xid; xid = pgxact->xid;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment