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/03/18 20:39:14 UTC

[07/16] storm git commit: Handling the case where executor stats can be null on initialization.

Handling the case where executor stats can be null on initialization.


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

Branch: refs/heads/master
Commit: f23b3c8719b94fa7af04ac2138479842c449deab
Parents: 4319766
Author: Parth Brahmbhatt <br...@gmail.com>
Authored: Thu Mar 5 16:57:17 2015 -0800
Committer: Parth Brahmbhatt <br...@gmail.com>
Committed: Thu Mar 5 16:57:17 2015 -0800

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/cluster.clj   | 12 +++++++-----
 storm-core/src/clj/backtype/storm/converter.clj |  9 +++++----
 2 files changed, 12 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f23b3c87/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 1d5026f..8866d04 100644
--- a/storm-core/src/clj/backtype/storm/cluster.clj
+++ b/storm-core/src/clj/backtype/storm/cluster.clj
@@ -336,10 +336,11 @@
 
       (get-worker-heartbeat
         [this storm-id node port]
-        (-> cluster-state
-            (get-data (workerbeat-path storm-id node port) false)
-          (maybe-deserialize ZKWorkerHeartbeat)
-          clojurify-zk-worker-hb))
+        (let [worker-hb (get-data cluster-state (workerbeat-path storm-id node port) false)]
+          (if worker-hb
+            (-> worker-hb
+              (maybe-deserialize ZKWorkerHeartbeat)
+              clojurify-zk-worker-hb))))
 
 
       (executor-beats
@@ -368,7 +369,8 @@
       (worker-heartbeat!
         [this storm-id node port info]
         (let [thrift-worker-hb (thriftify-zk-worker-hb info)]
-          (set-data cluster-state (workerbeat-path storm-id node port) (Utils/serialize thrift-worker-hb) acls)))
+          (if thrift-worker-hb
+            (set-data cluster-state (workerbeat-path storm-id node port) (Utils/serialize thrift-worker-hb) acls))))
 
       (remove-worker-heartbeat!
         [this storm-id node port]

http://git-wip-us.apache.org/repos/asf/storm/blob/f23b3c87/storm-core/src/clj/backtype/storm/converter.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/converter.clj b/storm-core/src/clj/backtype/storm/converter.clj
index 6a9f4a6..e011798 100644
--- a/storm-core/src/clj/backtype/storm/converter.clj
+++ b/storm-core/src/clj/backtype/storm/converter.clj
@@ -168,10 +168,11 @@
     {}))
 
 (defn thriftify-zk-worker-hb [worker-hb]
-  (doto (ZKWorkerHeartbeat.)
-    (.set_storm_id (:storm-id worker-hb))
-    (.set_executor_stats (thriftify-stats (:executor-stats worker-hb)))
-    (.set_time_secs (:time-secs worker-hb))))
+  (if (not-empty (filter second (:executor-stats worker-hb)))
+    (doto (ZKWorkerHeartbeat.)
+      (.set_storm_id (:storm-id worker-hb))
+      (.set_executor_stats (thriftify-stats (filter second (:executor-stats worker-hb))))
+      (.set_time_secs (:time-secs worker-hb)))))
 
 (defn clojurify-error [^ErrorInfo error]
   (if error