Ethanlm commented on a change in pull request #3097: STORM-3475 Add 
ConstraintSolverStrategy Unit Test
URL: https://github.com/apache/storm/pull/3097#discussion_r311770077
 
 

 ##########
 File path: 
storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestConstraintSolverStrategy.java
 ##########
 @@ -202,6 +204,50 @@ protected SolverResult backtrackSearch(SearcherState 
state) {
         }
     }
 
+    /*
+     * Test scheduling large number of executors and constraints.
+     *
+     * Cluster has sufficient resources for scheduling to succeed but can fail 
due to StackOverflowError.
+     */
+    @ParameterizedTest
+    @ValueSource(ints = {5, 20})
+    public void testScheduleLargeExecutorConstraintCount(int 
parallelismMultiplier) {
+        // Add 1 topology with large number of executors and constraints. Too 
many can cause a java.lang.StackOverflowError
+        Config config = createCSSClusterConfig(10, 10, 0, null);
+        config.put(Config.TOPOLOGY_RAS_CONSTRAINT_MAX_STATE_SEARCH, 50000);
+
+        List<List<String>> constraints = new LinkedList<>();
+        addContraints("spout-0", "spout-0", constraints);
+        addContraints("bolt-1", "bolt-1", constraints);
+        addContraints("spout-0", "bolt-0", constraints);
+        addContraints("bolt-2", "spout-0", constraints);
+        addContraints("bolt-1", "bolt-2", constraints);
+        addContraints("bolt-1", "bolt-0", constraints);
+        addContraints("bolt-1", "spout-0", constraints);
+
+        config.put(Config.TOPOLOGY_RAS_CONSTRAINTS, constraints);
+        TopologyDetails topo = genTopology("testTopo-" + 
parallelismMultiplier, config, 10, 10, 30 * parallelismMultiplier, 30 * 
parallelismMultiplier, 31414, 0, "user");
+        Topologies topologies = new Topologies(topo);
+
+        Map<String, SupervisorDetails> supMap = genSupervisors(30 * 
parallelismMultiplier, 30, 3500, 35000);
+        Cluster cluster = makeCluster(topologies, supMap);
+
+        ResourceAwareScheduler scheduler = new ResourceAwareScheduler();
+        scheduler.prepare(config);
+        scheduler.schedule(topologies, cluster);
+
+        boolean scheduleSuccess = 
isStatusSuccess(cluster.getStatus(topo.getId()));
+
+        if (parallelismMultiplier <= 5) {
+            Assert.assertTrue(scheduleSuccess);
+        } else if (parallelismMultiplier == 20) {
 
 Review comment:
   Maybe I was not clear. I think we should find a number/range so that we can 
have
   ```
   if (parallelismMultiplier <= xx) {
     ...
   } else {
     ...
   }
   ```
   But I am fine with the current code. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to