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

 ##########
 File path: 
storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestConstraintSolverStrategy.java
 ##########
 @@ -194,6 +196,51 @@ 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 = new Cluster(new INimbusTest(), new 
ResourceMetrics(new StormMetricsRegistry()), supMap, new HashMap<String, 
SchedulerAssignmentImpl>(), topologies, config);
+
+        ResourceAwareScheduler scheduler = new ResourceAwareScheduler();
+        scheduler.prepare(config);
+        scheduler.schedule(topologies, cluster);
+
+        boolean scheduleSuccess = 
isStatusSuccess(cluster.getStatus(topo.getId()));
+
+        if (parallelismMultiplier == 5) {
 
 Review comment:
   I would like this to be a range. Maybe `<=5` or if you can find the largest 
number that pass the test. 
    So if `@ValueSource(ints = { 5, 20 })` is changed, it won't surprise people

----------------------------------------------------------------
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