storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [13/50] [abbrv] storm git commit: STORM-166: renew thread should only renew creds on leader nimbus.
Date Mon, 24 Aug 2015 13:51:58 GMT
STORM-166: renew thread should only renew creds on leader nimbus.


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

Branch: refs/heads/master
Commit: a17167e4eb6cea78d7da7fa2632c0cbbb3a40c7a
Parents: eb242e0
Author: Parth Brahmbhatt <brahmbhatt.parth@gmail.com>
Authored: Fri Dec 19 17:09:36 2014 -0800
Committer: Parth Brahmbhatt <brahmbhatt.parth@gmail.com>
Committed: Fri Dec 19 17:09:36 2014 -0800

----------------------------------------------------------------------
 .../src/clj/backtype/storm/daemon/nimbus.clj    | 36 +++++++++++---------
 1 file changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/a17167e4/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 0281e73..0eb3c7f 100644
--- a/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -984,23 +984,25 @@
 )
 
 (defn renew-credentials [nimbus]
-  (let [storm-cluster-state (:storm-cluster-state nimbus)
-        renewers (:cred-renewers nimbus)
-        update-lock (:cred-update-lock nimbus)
-        assigned-ids (set (.active-storms storm-cluster-state))]
-    (when-not (empty? assigned-ids)
-      (doseq [id assigned-ids]
-        (locking update-lock
-          (let [orig-creds (.credentials storm-cluster-state id nil)
-                topology-conf (try-read-storm-conf (:conf nimbus) id)]
-            (if orig-creds
-              (let [new-creds (HashMap. orig-creds)]
-                (doseq [renewer renewers]
-                  (log-message "Renewing Creds For " id " with " renewer)
-                  (.renew renewer new-creds (Collections/unmodifiableMap topology-conf)))
-                (when-not (= orig-creds new-creds)
-                  (.set-credentials! storm-cluster-state id new-creds topology-conf)
-                  )))))))))
+  (if (is-leader nimbus :throw-exception false)
+    (let [storm-cluster-state (:storm-cluster-state nimbus)
+          renewers (:cred-renewers nimbus)
+          update-lock (:cred-update-lock nimbus)
+          assigned-ids (set (.active-storms storm-cluster-state))]
+      (when-not (empty? assigned-ids)
+        (doseq [id assigned-ids]
+          (locking update-lock
+            (let [orig-creds (.credentials storm-cluster-state id nil)
+                  topology-conf (try-read-storm-conf (:conf nimbus) id)]
+              (if orig-creds
+                (let [new-creds (HashMap. orig-creds)]
+                  (doseq [renewer renewers]
+                    (log-message "Renewing Creds For " id " with " renewer)
+                    (.renew renewer new-creds (Collections/unmodifiableMap topology-conf)))
+                  (when-not (= orig-creds new-creds)
+                    (.set-credentials! storm-cluster-state id new-creds topology-conf)
+                    ))))))))
+    (log-message "not a leader skipping , credential renweal.")))
 
 (defn validate-topology-size [topo-conf nimbus-conf topology]
   (let [workers-count (get topo-conf TOPOLOGY-WORKERS)


Mime
View raw message