Flag for separating zk reader connection in cluster state

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

Branch: refs/heads/master
Commit: 9ad277490e26145ad5250c010aa42ef0ca2e3e07
Parents: 0d8a2fa
Author: Kishor Patil <kpa...@yahoo-inc.com>
Authored: Fri Oct 23 19:34:58 2015 +0000
Committer: Kishor Patil <kpa...@yahoo-inc.com>
Committed: Fri Oct 23 19:34:58 2015 +0000

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/cluster.clj       | 14 +++++---------
 storm-core/src/clj/backtype/storm/daemon/nimbus.clj |  2 +-
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/9ad27749/storm-core/src/clj/backtype/storm/cluster.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/cluster.clj 
b/storm-core/src/clj/backtype/storm/cluster.clj
index 9057267..5c10a1c 100644
--- a/storm-core/src/clj/backtype/storm/cluster.clj
+++ b/storm-core/src/clj/backtype/storm/cluster.clj
@@ -55,12 +55,8 @@
       [(first ZooDefs$Ids/CREATOR_ALL_ACL)
        (ACL. ZooDefs$Perms/READ (Id. "digest" 
(DigestAuthenticationProvider/generateDigest payload)))])))
  
-(defn is-nimbus?
-  []
-  (= (System/getProperty "daemon.name") "nimbus"))
-
 (defnk mk-distributed-cluster-state
-  [conf :auth-conf nil :acls nil]
+  [conf :auth-conf nil :acls nil :separate-zk-writer? false]
   (let [zk (zk/mk-client conf (conf STORM-ZOOKEEPER-SERVERS) (conf 
STORM-ZOOKEEPER-PORT) :auth-conf auth-conf)]
     (zk/mkdirs zk (conf STORM-ZOOKEEPER-ROOT) acls)
     (.close zk))
@@ -78,7 +74,7 @@
                                       (when-not (= :none type)
                                         (doseq [callback (vals @callbacks)]
                                           (callback type path))))))
-        zk-reader (if (is-nimbus?)
+        zk-reader (if separate-zk-writer?
                     (zk/mk-client conf
                          (conf STORM-ZOOKEEPER-SERVERS)
                          (conf STORM-ZOOKEEPER-PORT)
@@ -161,7 +157,7 @@
        [this]
        (reset! active false)
        (.close zk-writer)
-       (if (is-nimbus?) (.close zk-reader)))
+       (if separate-zk-writer? (.close zk-reader)))
 
       (add-listener
         [this listener]
@@ -346,10 +342,10 @@
 
 ;; Watches should be used for optimization. When ZK is reconnecting, they're 
not guaranteed to be called.
 (defnk mk-storm-cluster-state
-  [cluster-state-spec :acls nil]
+  [cluster-state-spec :acls nil :separate-zk-writer? false]
   (let [[solo? cluster-state] (if (satisfies? ClusterState cluster-state-spec)
                                 [false cluster-state-spec]
-                                [true (mk-distributed-cluster-state 
cluster-state-spec :auth-conf cluster-state-spec :acls acls)])
+                                [true (mk-distributed-cluster-state 
cluster-state-spec :auth-conf cluster-state-spec :acls acls 
:separate-zk-writer? separate-zk-writer?)])
         assignment-info-callback (atom {})
         assignment-info-with-version-callback (atom {})
         assignment-version-callback (atom {})

http://git-wip-us.apache.org/repos/asf/storm/blob/9ad27749/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj 
b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
index 0c2b6a8..ce13110 100644
--- a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -105,7 +105,7 @@
      :storm-cluster-state (cluster/mk-storm-cluster-state conf :acls (when
                                                                        
(Utils/isZkAuthenticationConfiguredStormServer
                                                                          conf)
-                                                                       
NIMBUS-ZK-ACLS))
+                                                                       
NIMBUS-ZK-ACLS) :separate-zk-writer? true)
      :submit-lock (Object.)
      :cred-update-lock (Object.)
      :log-update-lock (Object.)

Reply via email to