Repository: storm Updated Branches: refs/heads/0.10.x-branch c4ce035ef -> 132c58c39
STORM-1750 (0.10.x): Ensure worker dies when report-error-and-die is called. Make cluster set-data try setting data if node creation fails because the node exists. Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/aaf3abf1 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/aaf3abf1 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/aaf3abf1 Branch: refs/heads/0.10.x-branch Commit: aaf3abf1132db1f22789bd58875367ac75216e37 Parents: c4ce035 Author: Stig Rohde Døssing <[email protected]> Authored: Tue May 3 15:04:27 2016 +0200 Committer: Stig Rohde Døssing <[email protected]> Committed: Tue May 3 15:04:27 2016 +0200 ---------------------------------------------------------------------- storm-core/src/clj/backtype/storm/cluster.clj | 9 +++++++-- storm-core/src/clj/backtype/storm/daemon/executor.clj | 5 ++++- 2 files changed, 11 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/aaf3abf1/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 1a13f7b..174987f 100644 --- a/storm-core/src/clj/backtype/storm/cluster.clj +++ b/storm-core/src/clj/backtype/storm/cluster.clj @@ -18,7 +18,7 @@ (:import [org.apache.zookeeper.data Stat ACL Id] [backtype.storm.generated SupervisorInfo Assignment StormBase ClusterWorkerHeartbeat ErrorInfo Credentials] [java.io Serializable]) - (:import [org.apache.zookeeper KeeperException KeeperException$NoNodeException ZooDefs ZooDefs$Ids ZooDefs$Perms]) + (:import [org.apache.zookeeper KeeperException KeeperException$NoNodeException KeeperException$NodeExistsException ZooDefs ZooDefs$Ids ZooDefs$Perms]) (:import [backtype.storm.utils Utils]) (:import [java.security MessageDigest]) (:import [org.apache.zookeeper.server.auth DigestAuthenticationProvider]) @@ -103,7 +103,12 @@ (zk/set-data zk path data) (do (zk/mkdirs zk (parent-path path) acls) - (zk/create-node zk path data :persistent acls)))) + (try + (zk/create-node zk path data :persistent acls) + (catch RuntimeException e + (if (instance? KeeperException$NodeExistsException (.getCause e)) + (zk/set-data zk path data) + (throw e))))))) (delete-node [this path] http://git-wip-us.apache.org/repos/asf/storm/blob/aaf3abf1/storm-core/src/clj/backtype/storm/daemon/executor.clj ---------------------------------------------------------------------- diff --git a/storm-core/src/clj/backtype/storm/daemon/executor.clj b/storm-core/src/clj/backtype/storm/daemon/executor.clj index 12fec2a..57fdc4b 100644 --- a/storm-core/src/clj/backtype/storm/daemon/executor.clj +++ b/storm-core/src/clj/backtype/storm/daemon/executor.clj @@ -253,7 +253,10 @@ :stream->component->grouper (outbound-components worker-context component-id) :report-error (throttled-report-error-fn <>) :report-error-and-die (fn [error] - ((:report-error <>) error) + (try + ((:report-error <>) error) + (catch Exception e + (log-message "Error while reporting error to cluster, proceeding with shutdown"))) (if (or (exception-cause? InterruptedException error) (exception-cause? java.io.InterruptedIOException error))
