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/08/24 15:52:29 UTC

[44/50] [abbrv] storm git commit: STORM-726: Adding nimbus.host config for backward compatibility.

STORM-726: Adding nimbus.host config for backward compatibility.

Conflicts:
	storm-core/src/clj/backtype/storm/ui/core.clj
	storm-core/src/jvm/backtype/storm/Config.java
	storm-core/src/jvm/backtype/storm/utils/NimbusClient.java

Conflicts:
	storm-core/src/clj/backtype/storm/ui/core.clj
	storm-core/src/jvm/backtype/storm/Config.java
	storm-core/src/jvm/backtype/storm/utils/NimbusClient.java


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

Branch: refs/heads/master
Commit: 0395fd6878f574724686328c1039454ce6acd23d
Parents: 95fb680
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Thu Mar 26 11:22:10 2015 -0700
Committer: Parth Brahmbhatt <br...@gmail.com>
Committed: Wed Aug 12 09:49:44 2015 -0700

----------------------------------------------------------------------
 conf/defaults.yaml                              |  2 +-
 storm-core/src/clj/backtype/storm/ui/core.clj   |  9 ++++----
 storm-core/src/jvm/backtype/storm/Config.java   |  6 +++--
 .../jvm/backtype/storm/utils/NimbusClient.java  | 24 ++++++++++----------
 4 files changed, 21 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/0395fd68/conf/defaults.yaml
----------------------------------------------------------------------
diff --git a/conf/defaults.yaml b/conf/defaults.yaml
index dd69eb6..cad5021 100644
--- a/conf/defaults.yaml
+++ b/conf/defaults.yaml
@@ -51,7 +51,7 @@ storm.meta.serialization.delegate: "backtype.storm.serialization.GzipThriftSeria
 storm.codedistributor.class: "backtype.storm.codedistributor.LocalFileSystemCodeDistributor"
 
 ### nimbus.* configs are for the master
-nimbus.seeds : ["localhost:6627"]
+nimbus.seeds : ["localhost"]
 nimbus.thrift.port: 6627
 nimbus.thrift.threads: 64
 nimbus.thrift.max_buffer_size: 1048576

http://git-wip-us.apache.org/repos/asf/storm/blob/0395fd68/storm-core/src/clj/backtype/storm/ui/core.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/ui/core.clj b/storm-core/src/clj/backtype/storm/ui/core.clj
index 40d030f..a872fd6 100644
--- a/storm-core/src/clj/backtype/storm/ui/core.clj
+++ b/storm-core/src/clj/backtype/storm/ui/core.clj
@@ -587,12 +587,12 @@
       (nimbus-summary
         (.get_nimbuses (.getClusterInfo ^Nimbus$Client nimbus)))))
   ([nimbuses]
-    (let [nimbus-seeds (set (*STORM-CONF* NIMBUS-SEEDS))
+    (let [nimbus-seeds (set (map #(str %1 ":" (*STORM-CONF* NIMBUS-THRIFT-PORT)) (set (*STORM-CONF* NIMBUS-SEEDS))))
           alive-nimbuses (set (map #(str (.get_host %1) ":" (.get_port %1)) nimbuses))
-          dead-nimbuses (clojure.set/difference nimbus-seeds alive-nimbuses)
-          dead-nimbuses-summary (map #(convert-to-nimbus-summary %1) dead-nimbuses)]
+          offline-nimbuses (clojure.set/difference nimbus-seeds alive-nimbuses)
+          offline-nimbuses-summary (map #(convert-to-nimbus-summary %1) offline-nimbuses)]
       {"nimbuses"
-       (concat dead-nimbuses-summary
+       (concat offline-nimbuses-summary
        (for [^NimbusSummary n nimbuses]
          {
           "host" (.get_host n)
@@ -1080,7 +1080,6 @@
       (catch Exception ex
         (json-response (exception->json ex) ((:query-params request) "callback") :status 500)))))
 
-
 (def app
   (handler/site (-> main-routes
                     (wrap-json-params)

http://git-wip-us.apache.org/repos/asf/storm/blob/0395fd68/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 36749ca..cef87f3 100644
--- a/storm-core/src/jvm/backtype/storm/Config.java
+++ b/storm-core/src/jvm/backtype/storm/Config.java
@@ -42,6 +42,7 @@ import java.util.Map;
  * Spouts.</p>
  */
 public class Config extends HashMap<String, Object> {
+
     //DO NOT CHANGE UNLESS WE ADD IN STATE NOT STORED IN THE PARENT CLASS
     private static final long serialVersionUID = -1550278723792864455L;
 
@@ -316,14 +317,15 @@ public class Config extends HashMap<String, Object> {
     public static final Object NIMBUS_THRIFT_TRANSPORT_PLUGIN_SCHEMA = String.class;
 
     /**
-     * The host that the master server is running on, only here for backward compatibility.
+     * The host that the master server is running on, added only for backward compatibility,
+     * the usage deprecated in favor of nimbus.seeds config.
      */
     @Deprecated
     public static final String NIMBUS_HOST = "nimbus.host";
     public static final Object NIMBUS_HOST_SCHEMA = String.class;
 
     /**
-     * List of seed nimbus hosts:port to use for leader nimbus discovery.
+     * List of seed nimbus hosts to use for leader nimbus discovery.
      */
     public static final String NIMBUS_SEEDS = "nimbus.seeds";
     public static final Object NIMBUS_SEEDS_SCHEMA = ConfigValidation.StringsValidator;

http://git-wip-us.apache.org/repos/asf/storm/blob/0395fd68/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java b/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
index 323d2a8..a715de2 100644
--- a/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
+++ b/storm-core/src/jvm/backtype/storm/utils/NimbusClient.java
@@ -56,23 +56,23 @@ public class NimbusClient extends ThriftClient {
             asUser = (String) conf.get(Config.STORM_DO_AS_USER);
         }
 
-        List<String> seeds = (List<String>) conf.get(Config.NIMBUS_SEEDS);
-
-        if(seeds == null  || seeds.isEmpty()) {
-            LOG.warn("config {} has no value. Failing over to deprecated config {}. ", Config.NIMBUS_SEEDS, Config.NIMBUS_HOST);
-            seeds = Lists.newArrayList(conf.get(Config.NIMBUS_HOST) + ":" + conf.get(Config.NIMBUS_THRIFT_PORT));
+        List<String> seeds = null;
+        if(conf.containsKey(Config.NIMBUS_HOST)) {
+            LOG.warn("Using deprecated config {} for backward compatibility. Please update your storm.yaml so it only has config {}",
+                    Config.NIMBUS_HOST, Config.NIMBUS_SEEDS);
+            seeds = Lists.newArrayList(conf.get(Config.NIMBUS_HOST).toString());
+        } else {
+            seeds = (List<String>) conf.get(Config.NIMBUS_SEEDS);
         }
 
-        for(String seed : seeds) {
-            String[] split = seed.split(DELIMITER);
-            String host = split[0];
-            int port = Integer.parseInt(split[1]);
+        for (String host : seeds) {
+            int port = Integer.parseInt(conf.get(Config.NIMBUS_THRIFT_PORT).toString());
             ClusterSummary clusterInfo = null;
             try {
                 NimbusClient client = new NimbusClient(conf, host, port);
                 clusterInfo = client.getClient().getClusterInfo();
             } catch (Exception e) {
-                LOG.warn("Ignoring exception while trying to get leader nimbus info from " + seed
+                LOG.warn("Ignoring exception while trying to get leader nimbus info from " + host
                         + ". will retry with a different seed host.", e);
                 continue;
             }
@@ -83,7 +83,7 @@ public class NimbusClient extends ThriftClient {
                         try {
                             return new NimbusClient(conf, nimbusSummary.get_host(), nimbusSummary.get_port(), null, asUser);
                         } catch (TTransportException e) {
-                            String leaderNimbus = nimbusSummary.get_host() + DELIMITER + nimbusSummary.get_port();
+                            String leaderNimbus = nimbusSummary.get_host() + ":" + nimbusSummary.get_port();
                             throw new RuntimeException("Failed to create a nimbus client for the leader " + leaderNimbus, e);
                         }
                     }
@@ -93,7 +93,7 @@ public class NimbusClient extends ThriftClient {
             }
         }
         throw new RuntimeException("Could not find leader nimbus from seed hosts " + seeds + ". " +
-                "Did you specify a valid list of nimbus host:port for config " + Config.NIMBUS_SEEDS);
+                "Did you specify a valid list of nimbus hosts for config " + Config.NIMBUS_SEEDS);
     }
 
     public NimbusClient(Map conf, String host, int port) throws TTransportException {