From d1a64758790c4db034cb0b18ac0486717dd32729 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Wed, 8 Jul 2020 11:20:48 +0200 Subject: [PATCH] Revert "Revert "Fix divide by zero error"" This reverts commit 7f1e621734da69fe0f17bee29c6b7ed9a9924781. --- src/backend/distributed/planner/multi_physical_planner.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/distributed/planner/multi_physical_planner.c b/src/backend/distributed/planner/multi_physical_planner.c index 955fca0b0..df8c4ec9b 100644 --- a/src/backend/distributed/planner/multi_physical_planner.c +++ b/src/backend/distributed/planner/multi_physical_planner.c @@ -2107,7 +2107,7 @@ BuildMapMergeJob(Query *jobQuery, List *dependentJobList, Var *partitionKey, static uint32 HashPartitionCount(void) { - uint32 groupCount = ActiveReadableWorkerNodeCount(); + uint32 groupCount = list_length(ActiveReadableNodeList()); double maxReduceTasksPerNode = MaxRunningTasksPerNode / 2.0; uint32 partitionCount = (uint32) rint(groupCount * maxReduceTasksPerNode); @@ -5717,7 +5717,7 @@ AssignDualHashTaskList(List *taskList) * if subsequent jobs have a small number of tasks, we won't allocate the * tasks to the same worker repeatedly. */ - List *workerNodeList = ActiveReadableWorkerNodeList(); + List *workerNodeList = ActiveReadableNodeList(); uint32 workerNodeCount = (uint32) list_length(workerNodeList); uint32 beginningNodeIndex = jobId % workerNodeCount;