storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kabh...@apache.org
Subject [1/2] storm git commit: Convert NoNodeException to KeyNotFoundException in getNimbodesWithLatestSequenceNumberOfBlob
Date Thu, 09 Feb 2017 06:17:48 GMT
Repository: storm
Updated Branches:
  refs/heads/1.x-branch c417c8ee2 -> f91166cf6


Convert NoNodeException to KeyNotFoundException in getNimbodesWithLatestSequenceNumberOfBlob

* since callers are able to handle KeyNotFoundException but not NoNodeException


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

Branch: refs/heads/1.x-branch
Commit: 1e40b02655072270c829057c14a3570a3d6005b9
Parents: c417c8e
Author: Jungtaek Lim <kabhwan@gmail.com>
Authored: Wed Feb 8 13:59:39 2017 +0900
Committer: Jungtaek Lim <kabhwan@gmail.com>
Committed: Thu Feb 9 14:56:39 2017 +0900

----------------------------------------------------------------------
 .../jvm/org/apache/storm/blobstore/BlobStoreUtils.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/1e40b026/storm-core/src/jvm/org/apache/storm/blobstore/BlobStoreUtils.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/org/apache/storm/blobstore/BlobStoreUtils.java b/storm-core/src/jvm/org/apache/storm/blobstore/BlobStoreUtils.java
index 71d286c..bd96b86 100644
--- a/storm-core/src/jvm/org/apache/storm/blobstore/BlobStoreUtils.java
+++ b/storm-core/src/jvm/org/apache/storm/blobstore/BlobStoreUtils.java
@@ -31,6 +31,7 @@ import org.apache.storm.utils.ZookeeperAuthInfo;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.thrift.transport.TTransportException;
 import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.KeeperException.NoNodeException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -75,7 +76,15 @@ public class BlobStoreUtils {
 
     // Check for latest sequence number of a key inside zookeeper and return nimbodes containing
the latest sequence number
     public static Set<NimbusInfo> getNimbodesWithLatestSequenceNumberOfBlob(CuratorFramework
zkClient, String key) throws Exception {
-        List<String> stateInfoList = zkClient.getChildren().forPath("/blobstore/" +
key);
+        List<String> stateInfoList;
+        try {
+            stateInfoList = zkClient.getChildren().forPath("/blobstore/" + key);
+        } catch (KeeperException.NoNodeException e) {
+            // there's a race condition with a delete: blobstore
+            // this should be thrown to the caller to indicate that the key is invalid now
+            throw new KeyNotFoundException(key);
+        }
+
         Set<NimbusInfo> nimbusInfoSet = new HashSet<NimbusInfo>();
         int latestSeqNumber = getLatestSequenceNumber(stateInfoList);
         LOG.debug("getNimbodesWithLatestSequenceNumberOfBlob stateInfo {} version {}", stateInfoList,
latestSeqNumber);


Mime
View raw message