storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [02/50] [abbrv] storm git commit: STORM-166: fixing a bug where the leader lock was not queued due to incorrect latch state being used
Date Mon, 24 Aug 2015 13:51:47 GMT
STORM-166: fixing a bug where the leader lock was not queued due to incorrect latch state being
used


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

Branch: refs/heads/master
Commit: dd991e53a9c0e474360e6cb70b6c1d2217a2aa07
Parents: d0bb383
Author: Parth Brahmbhatt <brahmbhatt.parth@gmail.com>
Authored: Fri Dec 19 12:09:16 2014 -0800
Committer: Parth Brahmbhatt <brahmbhatt.parth@gmail.com>
Committed: Fri Dec 19 12:09:16 2014 -0800

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/zookeeper.clj | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/dd991e53/storm-core/src/clj/backtype/storm/zookeeper.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/zookeeper.clj b/storm-core/src/clj/backtype/storm/zookeeper.clj
index a7d43ac..a058098 100644
--- a/storm-core/src/clj/backtype/storm/zookeeper.clj
+++ b/storm-core/src/clj/backtype/storm/zookeeper.clj
@@ -233,7 +233,7 @@
         STORMS-ROOT (str (conf STORM-ZOOKEEPER-ROOT) "/storms")]
     (reify LeaderLatchListener
       (^void isLeader[this]
-        (log-message (str hostname "gained leadership, checking if it has all the topology
code locally."))
+        (log-message (str hostname " gained leadership, checking if it has all the topology
code locally."))
         (let [active-topology-ids (set (get-children zk STORMS-ROOT false))
               local-topology-ids (set (.list (File. (master-stormdist-root conf))))
               diff-topology (first (set-delta active-topology-ids local-topology-ids))]
@@ -241,9 +241,9 @@
                           "] local-topology-ids [" (clojure.string/join "," local-topology-ids)
                           "] diff-topology [" (clojure.string/join "," diff-topology) "]")
         (if (empty? diff-topology)
-          (log-message " Accepting leadership, all active topology found localy.")
+          (log-message "Accepting leadership, all active topology found localy.")
           (do
-            (log-message " code for all active topologies not available locally, giving up
leadership.")
+            (log-message "code for all active topologies not available locally, giving up
leadership.")
             (.close leader-latch)))))
       (^void notLeader[this]
         (log-message (str hostname " lost leadership."))))))
@@ -263,9 +263,8 @@
         (log-message "no-op for zookeeper implementation"))
 
       (^void addToLeaderLockQueue [this]
-        (let [state (.getState @leader-latch)]
         ;if this latch is already closed, we need to create new instance.
-        (if (.equals LeaderLatch$State/CLOSED state)
+        (if (.equals LeaderLatch$State/CLOSED (.getState @leader-latch))
           (do
             (reset! leader-latch (LeaderLatch. zk leader-lock-path id))
             (reset! leader-latch-listener (leader-latch-listener-impl conf zk @leader-latch))
@@ -273,12 +272,12 @@
             ))
 
         ;Only if the latch is not already started we invoke start.
-        (if (.equals LeaderLatch$State/LATENT state)
+        (if (.equals LeaderLatch$State/LATENT (.getState @leader-latch))
           (do
             (.addListener @leader-latch @leader-latch-listener)
             (.start @leader-latch)
             (log-message "Queued up for leader lock."))
-          (log-message "Node already in queue for leader lock."))))
+          (log-message "Node already in queue for leader lock.")))
 
       (^void removeFromLeaderLockQueue [this]
         ;Only started latches can be closed.


Mime
View raw message