Refactors ExtendedTaskList methods (#7372)

ExecuteTaskListIntoTupleDestWithParam and ExecuteTaskListIntoTupleDest
are nearly the same. I parameterized and a made a reusable structure
here

---------

Co-authored-by: Onur Tirtir <onurcantirtir@gmail.com>
pull/7447/head
Gürkan İndibay 2024-01-24 09:00:19 +03:00 committed by GitHub
parent 11d7c27352
commit 863713e9b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 35 additions and 18 deletions

View File

@ -727,6 +727,11 @@ static uint64 MicrosecondsBetweenTimestamps(instr_time startTime, instr_time end
static int WorkerPoolCompare(const void *lhsKey, const void *rhsKey); static int WorkerPoolCompare(const void *lhsKey, const void *rhsKey);
static void SetAttributeInputMetadata(DistributedExecution *execution, static void SetAttributeInputMetadata(DistributedExecution *execution,
ShardCommandExecution *shardCommandExecution); ShardCommandExecution *shardCommandExecution);
static ExecutionParams * CreateDefaultExecutionParams(RowModifyLevel modLevel,
List *taskList,
TupleDestination *tupleDest,
bool expectResults,
ParamListInfo paramListInfo);
/* /*
@ -1013,11 +1018,11 @@ ExecuteTaskListOutsideTransaction(RowModifyLevel modLevel, List *taskList,
/* /*
* ExecuteTaskListIntoTupleDestWithParam is a proxy to ExecuteTaskListExtended() which uses * CreateDefaultExecutionParams returns execution params based on given (possibly null)
* bind params from executor state, and with defaults for some of the arguments. * bind params (presumably from executor state) with defaults for some of the arguments.
*/ */
uint64 static ExecutionParams *
ExecuteTaskListIntoTupleDestWithParam(RowModifyLevel modLevel, List *taskList, CreateDefaultExecutionParams(RowModifyLevel modLevel, List *taskList,
TupleDestination *tupleDest, TupleDestination *tupleDest,
bool expectResults, bool expectResults,
ParamListInfo paramListInfo) ParamListInfo paramListInfo)
@ -1034,6 +1039,24 @@ ExecuteTaskListIntoTupleDestWithParam(RowModifyLevel modLevel, List *taskList,
executionParams->tupleDestination = tupleDest; executionParams->tupleDestination = tupleDest;
executionParams->paramListInfo = paramListInfo; executionParams->paramListInfo = paramListInfo;
return executionParams;
}
/*
* ExecuteTaskListIntoTupleDestWithParam is a proxy to ExecuteTaskListExtended() which uses
* bind params from executor state, and with defaults for some of the arguments.
*/
uint64
ExecuteTaskListIntoTupleDestWithParam(RowModifyLevel modLevel, List *taskList,
TupleDestination *tupleDest,
bool expectResults,
ParamListInfo paramListInfo)
{
ExecutionParams *executionParams = CreateDefaultExecutionParams(modLevel, taskList,
tupleDest,
expectResults,
paramListInfo);
return ExecuteTaskListExtended(executionParams); return ExecuteTaskListExtended(executionParams);
} }
@ -1047,17 +1070,11 @@ ExecuteTaskListIntoTupleDest(RowModifyLevel modLevel, List *taskList,
TupleDestination *tupleDest, TupleDestination *tupleDest,
bool expectResults) bool expectResults)
{ {
int targetPoolSize = MaxAdaptiveExecutorPoolSize; ParamListInfo paramListInfo = NULL;
bool localExecutionSupported = true; ExecutionParams *executionParams = CreateDefaultExecutionParams(modLevel, taskList,
ExecutionParams *executionParams = CreateBasicExecutionParams( tupleDest,
modLevel, taskList, targetPoolSize, localExecutionSupported expectResults,
); paramListInfo);
executionParams->xactProperties = DecideTransactionPropertiesForTaskList(
modLevel, taskList, false);
executionParams->expectResults = expectResults;
executionParams->tupleDestination = tupleDest;
return ExecuteTaskListExtended(executionParams); return ExecuteTaskListExtended(executionParams);
} }