aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2018-06-07 20:38:12 +0100
committerSimon Riggs <simon@2ndQuadrant.com>2018-06-07 20:38:12 +0100
commit32ac7a118fc17f5baac1b370f50d759c30bee00a (patch)
treeb425f94549cb5fc9060c079d30bcfa807d122210
parent848b1f3e358f4a1bb98d8c4a07ff8ee5fd7ea9a0 (diff)
downloadpostgresql-32ac7a118fc17f5baac1b370f50d759c30bee00a.tar.gz
postgresql-32ac7a118fc17f5baac1b370f50d759c30bee00a.zip
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
-rw-r--r--src/backend/storage/ipc/procarray.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index afe1c03aa3c..9db184f8fed 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1907,7 +1907,7 @@ ProcArrayInstallRestoredXmin(TransactionId xmin, PGPROC *proc)
* GetRunningTransactionData -- returns information about running transactions.
*
* 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
* releasing them. Acquiring XidGenLock ensures that no new XIDs enter the proc
@@ -1995,6 +1995,10 @@ GetRunningTransactionData(void)
volatile PGXACT *pgxact = &allPgXact[pgprocno];
TransactionId xid;
+ /* Ignore procs running LAZY VACUUM */
+ if (pgxact->vacuumFlags & PROC_IN_VACUUM)
+ continue;
+
/* Fetch xid just once - see GetNewTransactionId */
xid = pgxact->xid;