IMPALA-4412: Per operator timing in profile summary is incorrect when mt_dop > 0
With mt_dop > 0, we may incorrectly populate the per_fragment_instance_idx for each FInstanceExecParams in SimpleScheduler::CreateScanInstances(). This causes the averages in the exec summary to be wrong resulting in misleading Runtime Profiles. This patch makes sure that each FInstanceExecParams has the correct instance index associated with it, thereby fixing the exec summaries in the runtime profiles. Change-Id: Id8634acba05698281e698ab8ddf92db4ae38af88 Reviewed-on: http://gerrit.cloudera.org:8080/4933 Reviewed-by: Sailesh Mukil <[email protected]> Tested-by: Internal Jenkins Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/1af0aa4a Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/1af0aa4a Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/1af0aa4a Branch: refs/heads/master Commit: 1af0aa4ad16b90bbec7c59fc75abe95d83b99c8d Parents: 9af59bf Author: Sailesh Mukil <[email protected]> Authored: Tue Nov 1 23:20:14 2016 -0700 Committer: Internal Jenkins <[email protected]> Committed: Thu Nov 3 23:47:53 2016 +0000 ---------------------------------------------------------------------- be/src/scheduling/simple-scheduler.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/1af0aa4a/be/src/scheduling/simple-scheduler.cc ---------------------------------------------------------------------- diff --git a/be/src/scheduling/simple-scheduler.cc b/be/src/scheduling/simple-scheduler.cc index 973e88b..020c67c 100644 --- a/be/src/scheduling/simple-scheduler.cc +++ b/be/src/scheduling/simple-scheduler.cc @@ -478,6 +478,7 @@ void SimpleScheduler::CreateScanInstances( return; } + int per_fragment_instance_idx = 0; for (const auto& assignment_entry: fragment_params->scan_range_assignment) { // evenly divide up the scan ranges of the leftmost scan between at most // <dop> instances @@ -507,8 +508,8 @@ void SimpleScheduler::CreateScanInstances( int64_t total_assigned_bytes = 0; int params_idx = 0; // into params_list for (int i = 0; i < num_instances; ++i) { - fragment_params->instance_exec_params.emplace_back( - schedule->GetNextInstanceId(), host, i, *fragment_params); + fragment_params->instance_exec_params.emplace_back(schedule->GetNextInstanceId(), + host, per_fragment_instance_idx++, *fragment_params); FInstanceExecParams& instance_params = fragment_params->instance_exec_params.back(); // Threshold beyond which we want to assign to the next instance.
