return early in ExecuteTaskListExtended (#3738)

It is possible to return an error in ExecuteTaskListExtended after
performing local execution with the current structure. However there is
no point in execution the local tasks if we are going to return an error
later. So the local execution is moved after the error check.
pull/3737/head
SaitTalhaNisanci 2020-04-09 10:10:49 +03:00 committed by GitHub
parent 117233c1e0
commit 362d72853c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -961,11 +961,8 @@ ExecuteTaskListExtended(RowModifyLevel modLevel, List *taskList,
if (localExecutionSupported && ShouldExecuteTasksLocally(taskList))
{
bool readOnlyPlan = false;
/* set local (if any) & remote tasks */
ExtractLocalAndRemoteTasks(readOnlyPlan, taskList, &localTaskList,
&remoteTaskList);
locallyProcessedRows += ExecuteLocalTaskList(localTaskList, tupleStore);
}
else
{
@ -983,6 +980,8 @@ ExecuteTaskListExtended(RowModifyLevel modLevel, List *taskList,
ErrorIfTransactionAccessedPlacementsLocally();
}
locallyProcessedRows += ExecuteLocalTaskList(localTaskList, tupleStore);
if (MultiShardConnectionType == SEQUENTIAL_CONNECTION)
{
targetPoolSize = 1;

View File

@ -136,6 +136,10 @@ static void LocallyExecuteUdfTaskQuery(Query *localUdfCommandQuery);
uint64
ExecuteLocalTaskList(List *taskList, Tuplestorestate *tupleStoreState)
{
if (list_length(taskList) == 0)
{
return 0;
}
DistributedPlan *distributedPlan = NULL;
ParamListInfo paramListInfo = NULL;
return ExecuteLocalTaskListExtended(taskList, paramListInfo, distributedPlan,