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 2015/05/04 21:19:17 UTC
[1/4] storm git commit: Log errors when required kafka params are
missing
Repository: storm
Updated Branches:
refs/heads/master 44e9aaf57 -> ea0fe124c
Log errors when required kafka params are missing
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/326cc1c7
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/326cc1c7
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/326cc1c7
Branch: refs/heads/master
Commit: 326cc1c796d073c768de4b5aced1669bd47c6891
Parents: 66be747
Author: Curtis Allen <cu...@pearson.com>
Authored: Tue Dec 23 16:13:31 2014 -0700
Committer: Curtis Allen <cu...@pearson.com>
Committed: Tue Dec 23 16:13:31 2014 -0700
----------------------------------------------------------------------
.../jvm/storm/kafka/DynamicBrokersReader.java | 24 ++++++++++++++++++++
.../storm/kafka/DynamicBrokersReaderTest.java | 13 +++++++++++
2 files changed, 37 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/326cc1c7/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
----------------------------------------------------------------------
diff --git a/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java b/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
index f17c6f7..b7baf17 100644
--- a/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
+++ b/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
@@ -41,6 +41,14 @@ public class DynamicBrokersReader {
private String _topic;
public DynamicBrokersReader(Map conf, String zkStr, String zkPath, String topic) {
+ // Check required parameters
+ if(conf == null) {LOG.error("conf cannot be null");}
+ validateConfig(conf);
+
+ if(zkStr == null) {LOG.error("zkString cannot be null");}
+ if(zkPath == null) {LOG.error("zkPath cannot be null");}
+ if(topic == null) {LOG.error("topic cannot be null");}
+
_zkPath = zkPath;
_topic = topic;
try {
@@ -53,6 +61,7 @@ public class DynamicBrokersReader {
_curator.start();
} catch (Exception ex) {
LOG.error("Couldn't connect to zookeeper", ex);
+ throw new RuntimeException(ex);
}
}
@@ -149,4 +158,19 @@ public class DynamicBrokersReader {
}
}
+ private void validateConfig(final Map conf) {
+ if(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT) == null) {
+ LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_SESSION_TIMEOUT);
+ }
+ if(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT) == null) {
+ LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT);
+ }
+ if(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES) == null) {
+ LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_RETRY_TIMES);
+ }
+ if(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL) == null) {
+ LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_RETRY_INTERVAL);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/storm/blob/326cc1c7/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
----------------------------------------------------------------------
diff --git a/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java b/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
index 794cafc..02ff3ea 100644
--- a/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
+++ b/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
@@ -170,4 +170,17 @@ public class DynamicBrokersReaderTest {
assertEquals(newPort, brokerInfo.getBrokerFor(partition).port);
assertEquals(newHost, brokerInfo.getBrokerFor(partition).host);
}
+
+ @Test(expected = RuntimeException.class)
+ public void testErrorLogsWhenConfigIsMissing() throws Exception {
+ String connectionString = server.getConnectString();
+ Map conf = new HashMap();
+ conf.put(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT, 1000);
+// conf.put(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT, 1000);
+ conf.put(Config.STORM_ZOOKEEPER_RETRY_TIMES, 4);
+ conf.put(Config.STORM_ZOOKEEPER_RETRY_INTERVAL, 5);
+
+ DynamicBrokersReader dynamicBrokersReader1 = new DynamicBrokersReader(conf, connectionString, masterPath, topic);
+
+ }
}
[4/4] storm git commit: Added STORM-603 to Changelog
Posted by bo...@apache.org.
Added STORM-603 to Changelog
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/ea0fe124
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/ea0fe124
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/ea0fe124
Branch: refs/heads/master
Commit: ea0fe124c943c6e2bab889c537bd13188df50107
Parents: 93f11c4
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Mon May 4 14:18:33 2015 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Mon May 4 14:18:33 2015 -0500
----------------------------------------------------------------------
CHANGELOG.md | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/ea0fe124/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 900319d..bd4b8c3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,5 @@
## 0.11.0
+ * STORM-603: Log errors when required kafka params are missing
* STORM-607: storm-hbase HBaseMapState should support user to customize the hbase-key & hbase-qualifier
* STORM-795: Update the user document for the extlib issue
* STORM-801: Add Travis CI badge to README
[3/4] storm git commit: Merge branch 'STORM-603' of
https://github.com/curtisallen/storm into STORM-603
Posted by bo...@apache.org.
Merge branch 'STORM-603' of https://github.com/curtisallen/storm into STORM-603
STORM-603: Log errors when required kafka params are missing
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/93f11c46
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/93f11c46
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/93f11c46
Branch: refs/heads/master
Commit: 93f11c46a219dbaa210a994ded34ed37b0ec8c14
Parents: 44e9aaf 95a1055
Author: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Authored: Mon May 4 13:52:28 2015 -0500
Committer: Robert (Bobby) Evans <ev...@yahoo-inc.com>
Committed: Mon May 4 13:52:28 2015 -0500
----------------------------------------------------------------------
.../jvm/storm/kafka/DynamicBrokersReader.java | 26 ++++++++++++++++++++
.../storm/kafka/DynamicBrokersReaderTest.java | 13 ++++++++++
2 files changed, 39 insertions(+)
----------------------------------------------------------------------
[2/4] storm git commit: Rather then just log errors when required
parameters are missing,
throw a NullPointerException as soon as a required value is missing.
Posted by bo...@apache.org.
Rather then just log errors when required parameters are missing, throw a NullPointerException as soon as a required value is missing.
Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/95a10557
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/95a10557
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/95a10557
Branch: refs/heads/master
Commit: 95a10557ca9eed5f193841e0a72b5032b627aceb
Parents: 326cc1c
Author: Curtis Allen <cu...@pearson.com>
Authored: Thu Apr 30 13:13:24 2015 -0600
Committer: Curtis Allen <cu...@pearson.com>
Committed: Thu Apr 30 13:13:24 2015 -0600
----------------------------------------------------------------------
.../jvm/storm/kafka/DynamicBrokersReader.java | 34 +++++++++++---------
.../storm/kafka/DynamicBrokersReaderTest.java | 2 +-
2 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/storm/blob/95a10557/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
----------------------------------------------------------------------
diff --git a/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java b/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
index b7baf17..d379061 100644
--- a/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
+++ b/external/storm-kafka/src/jvm/storm/kafka/DynamicBrokersReader.java
@@ -19,6 +19,7 @@ package storm.kafka;
import backtype.storm.Config;
import backtype.storm.utils.Utils;
+import com.google.common.base.Preconditions;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.RetryNTimes;
@@ -42,12 +43,13 @@ public class DynamicBrokersReader {
public DynamicBrokersReader(Map conf, String zkStr, String zkPath, String topic) {
// Check required parameters
- if(conf == null) {LOG.error("conf cannot be null");}
+ Preconditions.checkNotNull(conf, "conf cannot be null");
+
validateConfig(conf);
- if(zkStr == null) {LOG.error("zkString cannot be null");}
- if(zkPath == null) {LOG.error("zkPath cannot be null");}
- if(topic == null) {LOG.error("topic cannot be null");}
+ Preconditions.checkNotNull(zkStr,"zkString cannot be null");
+ Preconditions.checkNotNull(zkPath, "zkPath cannot be null");
+ Preconditions.checkNotNull(topic, "topic cannot be null");
_zkPath = zkPath;
_topic = topic;
@@ -158,19 +160,19 @@ public class DynamicBrokersReader {
}
}
+ /**
+ * Validate required parameters in the input configuration Map
+ * @param conf
+ */
private void validateConfig(final Map conf) {
- if(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT) == null) {
- LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_SESSION_TIMEOUT);
- }
- if(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT) == null) {
- LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT);
- }
- if(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES) == null) {
- LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_RETRY_TIMES);
- }
- if(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL) == null) {
- LOG.error("{} cannot be null", Config.STORM_ZOOKEEPER_RETRY_INTERVAL);
- }
+ Preconditions.checkNotNull(conf.get(Config.STORM_ZOOKEEPER_SESSION_TIMEOUT),
+ "%s cannot be null", Config.STORM_ZOOKEEPER_SESSION_TIMEOUT);
+ Preconditions.checkNotNull(conf.get(Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT),
+ "%s cannot be null", Config.STORM_ZOOKEEPER_CONNECTION_TIMEOUT);
+ Preconditions.checkNotNull(conf.get(Config.STORM_ZOOKEEPER_RETRY_TIMES),
+ "%s cannot be null", Config.STORM_ZOOKEEPER_RETRY_TIMES);
+ Preconditions.checkNotNull(conf.get(Config.STORM_ZOOKEEPER_RETRY_INTERVAL),
+ "%s cannot be null", Config.STORM_ZOOKEEPER_RETRY_INTERVAL);
}
}
http://git-wip-us.apache.org/repos/asf/storm/blob/95a10557/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
----------------------------------------------------------------------
diff --git a/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java b/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
index 02ff3ea..941ac9e 100644
--- a/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
+++ b/external/storm-kafka/src/test/storm/kafka/DynamicBrokersReaderTest.java
@@ -171,7 +171,7 @@ public class DynamicBrokersReaderTest {
assertEquals(newHost, brokerInfo.getBrokerFor(partition).host);
}
- @Test(expected = RuntimeException.class)
+ @Test(expected = NullPointerException.class)
public void testErrorLogsWhenConfigIsMissing() throws Exception {
String connectionString = server.getConnectString();
Map conf = new HashMap();