You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by ka...@apache.org on 2015/08/14 16:59:39 UTC

[1/3] storm git commit: STORM-988: supervisor.slots.ports should not allow duplicate element values

Repository: storm
Updated Branches:
  refs/heads/master 5966ff3c5 -> 80c6119ba


STORM-988: supervisor.slots.ports should not allow duplicate element values


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/26ea627f
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/26ea627f
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/26ea627f

Branch: refs/heads/master
Commit: 26ea627fb39fb84f31de773e650318a81eba8bd4
Parents: 55ec459
Author: caofangkun <ca...@gmail.com>
Authored: Thu Aug 13 10:41:23 2015 +0800
Committer: caofangkun <ca...@gmail.com>
Committed: Thu Aug 13 10:41:23 2015 +0800

----------------------------------------------------------------------
 storm-core/src/jvm/backtype/storm/Config.java          |  2 +-
 .../src/jvm/backtype/storm/ConfigValidation.java       | 13 ++++++++++---
 storm-core/test/clj/backtype/storm/config_test.clj     |  4 +++-
 3 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/26ea627f/storm-core/src/jvm/backtype/storm/Config.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/Config.java b/storm-core/src/jvm/backtype/storm/Config.java
index 4628bd4..92f55e3 100644
--- a/storm-core/src/jvm/backtype/storm/Config.java
+++ b/storm-core/src/jvm/backtype/storm/Config.java
@@ -876,7 +876,7 @@ public class Config extends HashMap<String, Object> {
      * how many workers run on each machine.
      */
     public static final String SUPERVISOR_SLOTS_PORTS = "supervisor.slots.ports";
-    public static final Object SUPERVISOR_SLOTS_PORTS_SCHEMA = ConfigValidation.IntegersValidator;
+    public static final Object SUPERVISOR_SLOTS_PORTS_SCHEMA = ConfigValidation.NoDuplicateIntegersValidator;
 
     /**
      * A number representing the maximum number of workers any single topology can acquire.

http://git-wip-us.apache.org/repos/asf/storm/blob/26ea627f/storm-core/src/jvm/backtype/storm/ConfigValidation.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/ConfigValidation.java b/storm-core/src/jvm/backtype/storm/ConfigValidation.java
index 1153a4a..fd9dae7 100644
--- a/storm-core/src/jvm/backtype/storm/ConfigValidation.java
+++ b/storm-core/src/jvm/backtype/storm/ConfigValidation.java
@@ -16,9 +16,9 @@
  * limitations under the License.
  */
 package backtype.storm;
+import java.util.HashSet;
 import java.util.Map;
-
-import java.util.Map;
+import java.util.Set;
 
 /**
  * Provides functionality for validating configuration fields.
@@ -228,7 +228,7 @@ public class ConfigValidation {
     /**
      * Validates is a list of Integers.
      */
-    public static Object IntegersValidator = new FieldValidator() {
+    public static Object NoDuplicateIntegersValidator = new FieldValidator() {
         @Override
         public void validateField(String name, Object field)
                 throws IllegalArgumentException {
@@ -236,18 +236,25 @@ public class ConfigValidation {
                 // A null value is acceptable.
                 return;
             }
+            int size = 0;
+            Set<Number> integerSet = new HashSet<Number>();
             if (field instanceof Iterable) {
                 for (Object o : (Iterable)field) {
+                    size++;
                     final long i;
                     if (o instanceof Number &&
                             ((i = ((Number)o).longValue()) == ((Number)o).doubleValue()) &&
                             (i <= Integer.MAX_VALUE && i >= Integer.MIN_VALUE)) {
                         // pass the test
+                        integerSet.add((Number) o);
                     } else {
                         throw new IllegalArgumentException(
                                 "Each element of the list " + name + " must be an Integer within type range.");
                     }
                 }
+                if (size != integerSet.size()) {
+                       throw new IllegalArgumentException(name + " should contain no duplicate elements");
+                }
                 return;
             }
         }

http://git-wip-us.apache.org/repos/asf/storm/blob/26ea627f/storm-core/test/clj/backtype/storm/config_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/config_test.clj b/storm-core/test/clj/backtype/storm/config_test.clj
index fa5575e..0d7a963 100644
--- a/storm-core/test/clj/backtype/storm/config_test.clj
+++ b/storm-core/test/clj/backtype/storm/config_test.clj
@@ -89,10 +89,12 @@
           (.validateField validator "test" (inc Integer/MAX_VALUE))))))
 
 (deftest test-integers-validator
-  (let [validator ConfigValidation/IntegersValidator]
+  (let [validator ConfigValidation/NoDuplicateIntegersValidator]
     (.validateField validator "test" nil)
     (.validateField validator "test" [1000 0 -1000])
     (is (thrown-cause? java.lang.IllegalArgumentException
+          (.validateField validator "test" [0 10 10])))
+    (is (thrown-cause? java.lang.IllegalArgumentException
           (.validateField validator "test" [0 10 1.34])))
     (is (thrown-cause? java.lang.IllegalArgumentException
           (.validateField validator "test" [0 nil])))


[3/3] storm git commit: add STORM-988 to CHANGELOG.md

Posted by ka...@apache.org.
add STORM-988 to CHANGELOG.md


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/80c6119b
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/80c6119b
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/80c6119b

Branch: refs/heads/master
Commit: 80c6119ba0a646adcf791bcf9f248eeb7e482fc4
Parents: 497d0af
Author: Jungtaek Lim <ka...@gmail.com>
Authored: Fri Aug 14 23:59:13 2015 +0900
Committer: Jungtaek Lim <ka...@gmail.com>
Committed: Fri Aug 14 23:59:13 2015 +0900

----------------------------------------------------------------------
 CHANGELOG.md | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/80c6119b/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5d3ec03..8f62775 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,7 @@
  * STORM-968: Adding support to generate the id based on names in Trident
  * STORM-845: Storm ElasticSearch connector
  * STORM-944: storm-hive pom.xml has a dependency conflict with calcite
+ * STORM-988: supervisor.slots.ports should not allow duplicate element values
 
 ## 0.10.0-beta2
  * STORM-843: [storm-redis] Add Javadoc to storm-redis


[2/3] storm git commit: Merge branch 'storm-988' of https://github.com/caofangkun/apache-storm into STORM-988

Posted by ka...@apache.org.
Merge branch 'storm-988' of https://github.com/caofangkun/apache-storm into STORM-988


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/497d0af0
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/497d0af0
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/497d0af0

Branch: refs/heads/master
Commit: 497d0af0803c2e20dcb06dc997c0b6b801e15333
Parents: 5966ff3 26ea627
Author: Jungtaek Lim <ka...@gmail.com>
Authored: Fri Aug 14 23:49:57 2015 +0900
Committer: Jungtaek Lim <ka...@gmail.com>
Committed: Fri Aug 14 23:49:57 2015 +0900

----------------------------------------------------------------------
 storm-core/src/jvm/backtype/storm/Config.java          |  2 +-
 .../src/jvm/backtype/storm/ConfigValidation.java       | 13 ++++++++++---
 storm-core/test/clj/backtype/storm/config_test.clj     |  4 +++-
 3 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/497d0af0/storm-core/src/jvm/backtype/storm/Config.java
----------------------------------------------------------------------