You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by bo...@apache.org on 2016/01/20 21:13:20 UTC

[1/2] storm git commit: Merge branch 'STORM-1481' of https://github.com/vesense/storm into STORM-1481

Repository: storm
Updated Branches:
  refs/heads/1.x-branch e29b14682 -> 6912aaba0


Merge branch 'STORM-1481' of https://github.com/vesense/storm into STORM-1481

STORM-1481: avoid Math.abs(Integer) get a negative value


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

Branch: refs/heads/1.x-branch
Commit: 4fb83d926c9cfcdf0abad667cfd7390b1f56f654
Parents: e29b146
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Jan 20 13:57:55 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Jan 20 13:59:18 2016 -0600

----------------------------------------------------------------------
 .../storm/trident/partition/IndexHashGrouping.java     |  8 +++++---
 storm-core/src/jvm/org/apache/storm/utils/Utils.java   | 13 +++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/4fb83d92/storm-core/src/jvm/org/apache/storm/trident/partition/IndexHashGrouping.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/trident/partition/IndexHashGrouping.java b/storm-core/src/jvm/org/apache/storm/trident/partition/IndexHashGrouping.java
index 223006f..25c3a1a 100644
--- a/storm-core/src/jvm/org/apache/storm/trident/partition/IndexHashGrouping.java
+++ b/storm-core/src/jvm/org/apache/storm/trident/partition/IndexHashGrouping.java
@@ -20,15 +20,17 @@ package org.apache.storm.trident.partition;
 import org.apache.storm.generated.GlobalStreamId;
 import org.apache.storm.grouping.CustomStreamGrouping;
 import org.apache.storm.task.WorkerTopologyContext;
+import org.apache.storm.utils.Utils;
+
 import java.util.Arrays;
 import java.util.List;
 
 public class IndexHashGrouping implements CustomStreamGrouping {
     public static int objectToIndex(Object val, int numPartitions) {
-        if(val==null) return 0;
-        else {
-            return Math.abs(val.hashCode()) % numPartitions;
+        if(val == null) {
+            return 0;
         }
+        return Utils.toPositive(val.hashCode()) % numPartitions;
     }
     
     int _index;

http://git-wip-us.apache.org/repos/asf/storm/blob/4fb83d92/storm-core/src/jvm/org/apache/storm/utils/Utils.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/utils/Utils.java b/storm-core/src/jvm/org/apache/storm/utils/Utils.java
index 3605b7a..9d0c7c6 100644
--- a/storm-core/src/jvm/org/apache/storm/utils/Utils.java
+++ b/storm-core/src/jvm/org/apache/storm/utils/Utils.java
@@ -1369,5 +1369,18 @@ public class Utils {
         }
         return topologyInfo;
     }
+
+    /**
+     * A cheap way to deterministically convert a number to a positive value. When the input is
+     * positive, the original value is returned. When the input number is negative, the returned
+     * positive value is the original value bit AND against Integer.MAX_VALUE(0x7fffffff) which
+     * is not its absolutely value.
+     *
+     * @param number a given number
+     * @return a positive number.
+     */
+    public static int toPositive(int number) {
+        return number & Integer.MAX_VALUE;
+    }
 }
 


[2/2] storm git commit: Added STORM-1481 to Changelog

Posted by bo...@apache.org.
Added STORM-1481 to Changelog


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

Branch: refs/heads/1.x-branch
Commit: 6912aaba00715c43c87cc094fa7a0c9f64a89e93
Parents: 4fb83d9
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Wed Jan 20 14:01:56 2016 -0600
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Wed Jan 20 14:02:26 2016 -0600

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


http://git-wip-us.apache.org/repos/asf/storm/blob/6912aaba/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 88a31fc..8c4e3bd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
 ## 1.0.0
+ * STORM-1481: avoid Math.abs(Integer) get a negative value
  * STORM-1473: enable log search for daemon logs
  * STORM-1472: Fix the errorTime bug and show the time to be readable
  * STORM-1466: Move the org.apache.thrift7 namespace to something correct/sensible