From 924bf795cd8e3974f5c870bc1da1de107c9147a2 Mon Sep 17 00:00:00 2001 From: LJ1043041006 <1239497420@qq.com> Date: Wed, 2 May 2018 21:26:41 +0800 Subject: [PATCH 1/2] fix STORM-3048 --- .../strategies/scheduling/ConstraintSolverStrategy.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java b/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java index 12f89ca30a7..431cd704106 100644 --- a/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java +++ b/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java @@ -98,6 +98,7 @@ && checkConstraintsSatisfied(cluster, td) */ private static boolean checkConstraintsSatisfied(Cluster cluster, TopologyDetails topo) { LOG.info("Checking constraints..."); + assert(cluster.getAssignmentById(topo.getId())!=null); Map result = cluster.getAssignmentById(topo.getId()).getExecutorToSlot(); Map execToComp = topo.getExecutorToComponent(); //get topology constraints @@ -135,6 +136,7 @@ private static Map workerToNodes(Cluster cluster) { private static boolean checkSpreadSchedulingValid(Cluster cluster, TopologyDetails topo) { LOG.info("Checking for a valid scheduling..."); + assert(cluster.getAssignmentById(topo.getId())!=null); Map result = cluster.getAssignmentById(topo.getId()).getExecutorToSlot(); Map execToComp = topo.getExecutorToComponent(); Map> workerExecMap = new HashMap<>(); @@ -173,6 +175,7 @@ private static boolean checkSpreadSchedulingValid(Cluster cluster, TopologyDetai */ private static boolean checkResourcesCorrect(Cluster cluster, TopologyDetails topo) { LOG.info("Checking Resources..."); + assert(cluster.getAssignmentById(topo.getId())!=null); Map result = cluster.getAssignmentById(topo.getId()).getExecutorToSlot(); Map> nodeToExecs = new HashMap<>(); Map mergedExecToWorker = new HashMap<>(); From b5f89f9497f998018ea2bc12248de6fafcfa271c Mon Sep 17 00:00:00 2001 From: LJ1043041006 <1239497420@qq.com> Date: Sat, 5 May 2018 10:07:10 +0800 Subject: [PATCH 2/2] fix checkstyle errors --- .../strategies/scheduling/ConstraintSolverStrategy.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java b/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java index 431cd704106..1e5003386e2 100644 --- a/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java +++ b/storm-server/src/main/java/org/apache/storm/scheduler/resource/strategies/scheduling/ConstraintSolverStrategy.java @@ -98,7 +98,7 @@ && checkConstraintsSatisfied(cluster, td) */ private static boolean checkConstraintsSatisfied(Cluster cluster, TopologyDetails topo) { LOG.info("Checking constraints..."); - assert(cluster.getAssignmentById(topo.getId())!=null); + assert (cluster.getAssignmentById(topo.getId()) != null); Map result = cluster.getAssignmentById(topo.getId()).getExecutorToSlot(); Map execToComp = topo.getExecutorToComponent(); //get topology constraints @@ -136,7 +136,7 @@ private static Map workerToNodes(Cluster cluster) { private static boolean checkSpreadSchedulingValid(Cluster cluster, TopologyDetails topo) { LOG.info("Checking for a valid scheduling..."); - assert(cluster.getAssignmentById(topo.getId())!=null); + assert (cluster.getAssignmentById(topo.getId()) != null); Map result = cluster.getAssignmentById(topo.getId()).getExecutorToSlot(); Map execToComp = topo.getExecutorToComponent(); Map> workerExecMap = new HashMap<>(); @@ -175,7 +175,7 @@ private static boolean checkSpreadSchedulingValid(Cluster cluster, TopologyDetai */ private static boolean checkResourcesCorrect(Cluster cluster, TopologyDetails topo) { LOG.info("Checking Resources..."); - assert(cluster.getAssignmentById(topo.getId())!=null); + assert (cluster.getAssignmentById(topo.getId()) != null); Map result = cluster.getAssignmentById(topo.getId()).getExecutorToSlot(); Map> nodeToExecs = new HashMap<>(); Map mergedExecToWorker = new HashMap<>();