This is an automated email from the ASF dual-hosted git repository. tanxinyu pushed a commit to branch fix_metric_local_scheduler in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit e88c6b0fe2323112e20a46d49a2af71c07865b0b Author: OneSizeFitQuorum <[email protected]> AuthorDate: Thu Apr 6 16:47:15 2023 +0800 fix Signed-off-by: OneSizeFitQuorum <[email protected]> --- .../scheduler/FragmentInstanceDispatcherImpl.java | 30 ++++++++++++---------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java index b990e0e4fb..a471e9256a 100644 --- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java +++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java @@ -182,22 +182,24 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher { List<TSStatus> dataNodeFailureList = new ArrayList<>(); - // sync dispatch to local - long localScheduleStartTime = System.nanoTime(); - for (FragmentInstance localInstance : localInstances) { - try (SetThreadName threadName = new SetThreadName(localInstance.getId().getFullId())) { - dispatchOneInstance(localInstance); - } catch (FragmentInstanceDispatchException e) { - dataNodeFailureList.add(e.getFailureStatus()); - } catch (Throwable t) { - logger.warn("[DispatchFailed]", t); - dataNodeFailureList.add( - RpcUtils.getStatus( - TSStatusCode.INTERNAL_SERVER_ERROR, "Unexpected errors: " + t.getMessage())); + if (!localInstances.isEmpty()) { + // sync dispatch to local + long localScheduleStartTime = System.nanoTime(); + for (FragmentInstance localInstance : localInstances) { + try (SetThreadName threadName = new SetThreadName(localInstance.getId().getFullId())) { + dispatchOneInstance(localInstance); + } catch (FragmentInstanceDispatchException e) { + dataNodeFailureList.add(e.getFailureStatus()); + } catch (Throwable t) { + logger.warn("[DispatchFailed]", t); + dataNodeFailureList.add( + RpcUtils.getStatus( + TSStatusCode.INTERNAL_SERVER_ERROR, "Unexpected errors: " + t.getMessage())); + } } + PERFORMANCE_OVERVIEW_METRICS.recordScheduleLocalCost( + System.nanoTime() - localScheduleStartTime); } - PERFORMANCE_OVERVIEW_METRICS.recordScheduleLocalCost( - System.nanoTime() - localScheduleStartTime); // wait until remote dispatch done try { asyncPlanNodeSender.waitUntilCompleted();
