Skip to content

Commit

Permalink
Use macro wrapper to access PGPROC data, which allow to improve compa…
Browse files Browse the repository at this point in the history
…tibility with PostgreSQL forks.
  • Loading branch information
EvgenyNechayev committed May 24, 2024
1 parent 553d5ba commit 3170caa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/backend/distributed/transaction/backend_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -1279,7 +1279,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/backend/distributed/transaction/lock_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,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)
Expand Down

0 comments on commit 3170caa

Please sign in to comment.