Use macro wrapper to access PGPROC data, which allow to improve compa… (#7607)

DESCRIPTION: Use macro wrapper to access PGPROC data, to improve compatibility with PostgreSQL forks.
pull/7841/head
Evgeny Nechayev 2024-05-28 03:39:13 +03:00 committed by naisila
parent ef946e44af
commit 5eb037ac50
3 changed files with 5 additions and 5 deletions

View File

@ -395,7 +395,7 @@ StoreAllActiveTransactions(Tuplestorestate *tupleStore, TupleDesc tupleDescripto
bool showCurrentBackendDetails = showAllBackends;
BackendData *currentBackend =
&backendManagementShmemData->backends[backendIndex];
PGPROC *currentProc = &ProcGlobal->allProcs[backendIndex];
PGPROC *currentProc = GetPGProcByNumber(backendIndex);
/* to work on data after releasing g spinlock to protect against errors */
uint64 transactionNumber = 0;
@ -420,7 +420,7 @@ StoreAllActiveTransactions(Tuplestorestate *tupleStore, TupleDesc tupleDescripto
}
Oid databaseId = currentBackend->databaseId;
int backendPid = ProcGlobal->allProcs[backendIndex].pid;
int backendPid = GetPGProcByNumber(backendIndex)->pid;
/*
* We prefer to use worker_query instead of distributedCommandOriginator in
@ -1280,7 +1280,7 @@ ActiveDistributedTransactionNumbers(void)
/* build list of starting procs */
for (int curBackend = 0; curBackend < MaxBackends; curBackend++)
{
PGPROC *currentProc = &ProcGlobal->allProcs[curBackend];
PGPROC *currentProc = GetPGProcByNumber(curBackend);
BackendData currentBackendData;
if (currentProc->pid == 0)

View File

@ -375,7 +375,7 @@ AssociateDistributedTransactionWithBackendProc(TransactionNode *transactionNode)
for (int backendIndex = 0; backendIndex < MaxBackends; ++backendIndex)
{
PGPROC *currentProc = &ProcGlobal->allProcs[backendIndex];
PGPROC *currentProc = GetPGProcByNumber(backendIndex);
BackendData currentBackendData;
/* we're not interested in processes that are not active or waiting on a lock */

View File

@ -561,7 +561,7 @@ BuildLocalWaitGraph(bool onlyDistributedTx)
/* build list of starting procs */
for (int curBackend = 0; curBackend < totalProcs; curBackend++)
{
PGPROC *currentProc = &ProcGlobal->allProcs[curBackend];
PGPROC *currentProc = GetPGProcByNumber(curBackend);
BackendData currentBackendData;
if (currentProc->pid == 0)