mirror of https://github.com/citusdata/citus.git
use a utility method to get event size
parent
71f1aa48a3
commit
a7e735a648
|
@ -618,6 +618,7 @@ static bool HasDependentJobs(Job *mainJob);
|
||||||
static void ExtractParametersForRemoteExecution(ParamListInfo paramListInfo,
|
static void ExtractParametersForRemoteExecution(ParamListInfo paramListInfo,
|
||||||
Oid **parameterTypes,
|
Oid **parameterTypes,
|
||||||
const char ***parameterValues);
|
const char ***parameterValues);
|
||||||
|
static int GetEventSetSize(List *sessionList);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AdaptiveExecutor is called via CitusExecScan on the
|
* AdaptiveExecutor is called via CitusExecScan on the
|
||||||
|
@ -2007,8 +2008,7 @@ RunDistributedExecution(DistributedExecution *execution)
|
||||||
{
|
{
|
||||||
bool cancellationReceived = false;
|
bool cancellationReceived = false;
|
||||||
|
|
||||||
/* additional 2 is for postmaster and latch */
|
int eventSetSize = GetEventSetSize(execution->sessionList);
|
||||||
int eventSetSize = list_length(execution->sessionList) + 2;
|
|
||||||
|
|
||||||
/* always (re)build the wait event set the first time */
|
/* always (re)build the wait event set the first time */
|
||||||
execution->connectionSetChanged = true;
|
execution->connectionSetChanged = true;
|
||||||
|
@ -2045,7 +2045,7 @@ RunDistributedExecution(DistributedExecution *execution)
|
||||||
execution->waitEventSet = BuildWaitEventSet(execution->sessionList);
|
execution->waitEventSet = BuildWaitEventSet(execution->sessionList);
|
||||||
|
|
||||||
/* recalculate (and allocate) since the sessions have changed */
|
/* recalculate (and allocate) since the sessions have changed */
|
||||||
eventSetSize = list_length(execution->sessionList) + 2;
|
eventSetSize = GetEventSetSize(execution->sessionList);
|
||||||
|
|
||||||
events = palloc0(eventSetSize * sizeof(WaitEvent));
|
events = palloc0(eventSetSize * sizeof(WaitEvent));
|
||||||
|
|
||||||
|
@ -3766,7 +3766,7 @@ static WaitEventSet *
|
||||||
BuildWaitEventSet(List *sessionList)
|
BuildWaitEventSet(List *sessionList)
|
||||||
{
|
{
|
||||||
/* additional 2 is for postmaster and latch */
|
/* additional 2 is for postmaster and latch */
|
||||||
int eventSetSize = list_length(sessionList) + 2;
|
int eventSetSize = GetEventSetSize(sessionList);
|
||||||
|
|
||||||
WaitEventSet *waitEventSet =
|
WaitEventSet *waitEventSet =
|
||||||
CreateWaitEventSet(CurrentMemoryContext, eventSetSize);
|
CreateWaitEventSet(CurrentMemoryContext, eventSetSize);
|
||||||
|
@ -3807,6 +3807,17 @@ BuildWaitEventSet(List *sessionList)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GetEventSetSize returns the event set size.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
GetEventSetSize(List *sessionList)
|
||||||
|
{
|
||||||
|
/* additional 2 is for postmaster and latch */
|
||||||
|
return list_length(sessionList) + 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* UpdateWaitEventSetFlags modifies the given waitEventSet with the wait flags
|
* UpdateWaitEventSetFlags modifies the given waitEventSet with the wait flags
|
||||||
* for connections in the sessionList.
|
* for connections in the sessionList.
|
||||||
|
|
Loading…
Reference in New Issue