You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by et...@apache.org on 2019/08/22 14:18:33 UTC

[storm] branch master updated: STORM-3475 Add ConstraintSolverStrategy Unit Test

This is an automated email from the ASF dual-hosted git repository.

ethanli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/storm.git


The following commit(s) were added to refs/heads/master by this push:
     new 8d2316f  STORM-3475 Add ConstraintSolverStrategy Unit Test
     new e005c1c  Merge pull request #3097 from dandsager1/STORM-3475
8d2316f is described below

commit 8d2316ffda6b1d0d76c3bbfda09bf0a91a556c26
Author: dandsager <da...@verizonmedia.com>
AuthorDate: Mon Aug 5 15:49:10 2019 -0500

    STORM-3475 Add ConstraintSolverStrategy Unit Test
---
 storm-server/pom.xml                               |  5 +++
 .../scheduling/TestConstraintSolverStrategy.java   | 48 +++++++++++++++++++++-
 2 files changed, 52 insertions(+), 1 deletion(-)

diff --git a/storm-server/pom.xml b/storm-server/pom.xml
index 2a93616..fa4e39e 100644
--- a/storm-server/pom.xml
+++ b/storm-server/pom.xml
@@ -125,6 +125,11 @@
             <groupId>org.apache.httpcomponents</groupId>
             <artifactId>httpclient</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-params</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestConstraintSolverStrategy.java b/storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestConstraintSolverStrategy.java
index 4ae5c88..2235905 100644
--- a/storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestConstraintSolverStrategy.java
+++ b/storm-server/src/test/java/org/apache/storm/scheduler/resource/strategies/scheduling/TestConstraintSolverStrategy.java
@@ -37,7 +37,9 @@ import org.apache.storm.scheduler.resource.strategies.priority.DefaultScheduling
 import org.apache.storm.utils.Time;
 import org.apache.storm.utils.Utils;
 import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -202,6 +204,50 @@ public class TestConstraintSolverStrategy {
         }
     }
 
+    /*
+     * 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) {
+            // For default JVM, scheduling currently fails due to StackOverflow.
+            // For now just log the results of the test. Change to assert when StackOverflow issue is fixed.
+            LOG.info("testScheduleLargeExecutorCount scheduling {} with {}x executor multiplier", scheduleSuccess ? "succeeds" : "fails",
+                    parallelismMultiplier);
+        }
+    }
+
     @Test
     public void testIntegrationWithRAS() {
         List<List<String>> constraints = new LinkedList<>();