backend_data.c: include max_wal_senders in calculating maxBackend, matches changes in pg12's InitializeMaxBackends

pull/2912/head
Philip Dubé 2019-08-28 19:08:04 +00:00
parent cbecf97c84
commit 32ef459025
1 changed files with 14 additions and 6 deletions

View File

@ -28,6 +28,9 @@
#include "distributed/tuplestore.h" #include "distributed/tuplestore.h"
#include "nodes/execnodes.h" #include "nodes/execnodes.h"
#include "postmaster/autovacuum.h" /* to access autovacuum_max_workers */ #include "postmaster/autovacuum.h" /* to access autovacuum_max_workers */
#if PG_VERSION_NUM >= 120000
#include "replication/walsender.h"
#endif
#include "storage/ipc.h" #include "storage/ipc.h"
#include "storage/lmgr.h" #include "storage/lmgr.h"
#include "storage/lwlock.h" #include "storage/lwlock.h"
@ -518,9 +521,10 @@ BackendManagementShmemInit(void)
totalProcs = TotalProcCount(); totalProcs = TotalProcCount();
for (backendIndex = 0; backendIndex < totalProcs; ++backendIndex) for (backendIndex = 0; backendIndex < totalProcs; ++backendIndex)
{ {
backendManagementShmemData->backends[backendIndex].citusBackend. BackendData *backendData =
initiatorNodeIdentifier = -1; &backendManagementShmemData->backends[backendIndex];
SpinLockInit(&backendManagementShmemData->backends[backendIndex].mutex); backendData->citusBackend.initiatorNodeIdentifier = -1;
SpinLockInit(&backendData->mutex);
} }
} }
@ -587,12 +591,16 @@ TotalProcCount(void)
* We prefer to maintain space for auxiliary procs or preperad transactions in * We prefer to maintain space for auxiliary procs or preperad transactions in
* the backend space because they could be blocking processes and our current * the backend space because they could be blocking processes and our current
* implementation of distributed deadlock detection could process them * implementation of distributed deadlock detection could process them
* as a regular backend. In the future, we could consider chaning deadlock * as a regular backend. In the future, we could consider changing deadlock
* detection algorithm to ignore auxiliary procs or preperad transactions and * detection algorithm to ignore auxiliary procs or prepared transactions and
* save same space. * save some space.
*/ */
totalProcs = maxBackends + NUM_AUXILIARY_PROCS + max_prepared_xacts; totalProcs = maxBackends + NUM_AUXILIARY_PROCS + max_prepared_xacts;
#if PG_VERSION_NUM >= 120000
totalProcs += max_wal_senders;
#endif
return totalProcs; return totalProcs;
} }