You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@storm.apache.org by pt...@apache.org on 2017/02/24 18:16:11 UTC

[02/11] storm git commit: Fixing pacemaker delete-path bug.

Fixing pacemaker delete-path bug.


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

Branch: refs/heads/1.0.x-branch
Commit: a6b9668c98b46a7acfb9d4f39c6e90342b2f41f7
Parents: 07410fe
Author: Kyle Nusbaum <kn...@yahoo-inc.com>
Authored: Tue Feb 21 14:18:31 2017 -0600
Committer: Kyle Nusbaum <kn...@yahoo-inc.com>
Committed: Tue Feb 21 16:06:24 2017 -0600

----------------------------------------------------------------------
 .../org/apache/storm/pacemaker/pacemaker.clj    |  2 +-
 .../storm/pacemaker/pacemaker_state_factory.clj | 24 ++++++++++++--------
 2 files changed, 16 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/a6b9668c/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker.clj b/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker.clj
index 70313e4..2b26a8a 100644
--- a/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker.clj
+++ b/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker.clj
@@ -160,7 +160,7 @@
 (defn delete-path [^String path heartbeats]
   (let [prefix (if (= \/ (last path)) path (str path "/"))]
     (doseq [k (.keySet heartbeats)
-            :when (= (.indexOf k prefix) 0)]
+            :when (= (.indexOf (str k "/") prefix) 0)]
       (delete-pulse-id k heartbeats)))
   (HBMessage. HBServerMessageType/DELETE_PATH_RESPONSE nil))
 

http://git-wip-us.apache.org/repos/asf/storm/blob/a6b9668c/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker_state_factory.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker_state_factory.clj b/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker_state_factory.clj
index 80d4de5..21f3ee1 100644
--- a/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker_state_factory.clj
+++ b/storm-core/src/clj/org/apache/storm/pacemaker/pacemaker_state_factory.clj
@@ -86,15 +86,21 @@
       (delete_worker_hb [this path]
         (util/retry-on-exception
          max-retries
-         "delete_worker_hb"
-         #(let [response
-                (.send pacemaker-client
-                       (HBMessage. HBServerMessageType/DELETE_PATH
-                                   (HBMessageData/path path)))]
-            (if (= (.get_type response) HBServerMessageType/DELETE_PATH_RESPONSE)
-              :ok
-              (throw (HBExecutionException. "Invalid Response Type"))))))
-      
+         "delete-worker-hb"
+         #(let [pacemaker-client-pool (makeClientPool conf pacemaker-client-pool servers)
+                results (map (fn [[host client]]
+                               (try
+                                 (if (is-connection-ready client)
+                                   (delete-worker-hb path client)
+                                   :error)
+                                 (catch Exception e
+                                   :error)))
+                             @pacemaker-client-pool)]
+            (when (every? (fn [result] (= :error result)) results)
+              (throw (HBExecutionException. "Cannot connect to any pacemaker servers"))))
+         nil))
+
+      ;; aggregating worker heartbeat details
       (get_worker_hb [this path watch?]
         (util/retry-on-exception
          max-retries