From 898d3bb8d3ef4fa2bf538b928300070aad7814a2 Mon Sep 17 00:00:00 2001 From: Halil Ozan Akgul Date: Tue, 17 Aug 2021 14:37:05 +0300 Subject: [PATCH] Introduces proc_statusflags_compat macro In two commits vacuumFlags in PGXACT is moved and then renamed to status flags This macro uses the appropriate version of the flag Relevant PG commits: 5788e258bb26495fab65ff3aa486268d1c50b123 cd9c1b3e197a9b53b840dcc87eb41b04d601a5f9 --- src/backend/distributed/transaction/lock_graph.c | 4 +--- src/include/distributed/version_compat.h | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/distributed/transaction/lock_graph.c b/src/backend/distributed/transaction/lock_graph.c index 9265bd320..30dec5d80 100644 --- a/src/backend/distributed/transaction/lock_graph.c +++ b/src/backend/distributed/transaction/lock_graph.c @@ -461,9 +461,7 @@ IsProcessWaitingForSafeOperations(PGPROC *proc) return false; } - /* get the transaction that the backend associated with */ - PGXACT *pgxact = &ProcGlobal->allPgXact[proc->pgprocno]; - if (pgxact->vacuumFlags & PROC_IS_AUTOVACUUM) + if (pgproc_statusflags_compat(proc) & PROC_IS_AUTOVACUUM) { return true; } diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index 29fa67c5f..1155488c4 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -57,6 +57,7 @@ #define COPY_FRONTEND_COMPAT COPY_FRONTEND #define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \ SetTuplestoreDestReceiverParams(a, b, c, d, e, f) +#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags) #else #define AlterTableStmtObjType(a) ((a)->relkind) #define F_NEXTVAL_COMPAT F_NEXTVAL_OID @@ -86,6 +87,8 @@ #define COPY_FRONTEND_COMPAT COPY_NEW_FE #define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \ SetTuplestoreDestReceiverParams(a, b, c, d) +#define pgproc_statusflags_compat(pgproc) \ + ((&ProcGlobal->allPgXact[(pgproc)->pgprocno])->vacuumFlags) #endif #if PG_VERSION_NUM >= PG_VERSION_13