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:12:48 UTC
[1/3] storm git commit: avoid abs get negative value
Repository: storm
Updated Branches:
refs/heads/master e38d1d782 -> 686ffd697
avoid abs get negative value
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/181b3b09
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/181b3b09
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/181b3b09
Branch: refs/heads/master
Commit: 181b3b09a973acf99719ad60fe03f4d23c869324
Parents: 90e4f3e
Author: Xin Wang <be...@163.com>
Authored: Sat Jan 16 19:40:24 2016 +0800
Committer: vesense <be...@163.com>
Committed: Sat Jan 16 19:50:30 2016 +0800
----------------------------------------------------------------------
.../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/181b3b09/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/181b3b09/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/3] storm git commit: Merge branch 'STORM-1481' of
https://github.com/vesense/storm into STORM-1481
Posted by bo...@apache.org.
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/daff0e39
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/daff0e39
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/daff0e39
Branch: refs/heads/master
Commit: daff0e394c11d31c175f9f03195a8156e0d18150
Parents: e38d1d7 181b3b0
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:57:55 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(-)
----------------------------------------------------------------------
[3/3] 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/686ffd69
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/686ffd69
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/686ffd69
Branch: refs/heads/master
Commit: 686ffd69763af695b8391a417e87c1de23adf169
Parents: daff0e3
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:01:56 2016 -0600
----------------------------------------------------------------------
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/686ffd69/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8d4ba1b..fb5a26a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
* STORM-1484: ignore subproject .classpath & .project file
## 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-1450: Fix minor bugs and refactor code in ResourceAwareScheduler