HBASE-20678 NPE in ReplicationSourceManager#NodeFailoverWorker

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

Branch: refs/heads/HBASE-20331
Commit: 57c86717285d74f4604a277ee034878398568d81
Parents: a45763d
Author: Guanghao Zhang <[email protected]>
Authored: Mon Jun 4 11:10:22 2018 +0800
Committer: Guanghao Zhang <[email protected]>
Committed: Tue Jun 5 14:37:52 2018 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/replication/ZKReplicationQueueStorage.java | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/57c86717/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationQueueStorage.java
----------------------------------------------------------------------
diff --git 
a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationQueueStorage.java
 
b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationQueueStorage.java
index b9ebfb9..cca8bfc 100644
--- 
a/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationQueueStorage.java
+++ 
b/hbase-replication/src/main/java/org/apache/hadoop/hbase/replication/ZKReplicationQueueStorage.java
@@ -393,10 +393,10 @@ class ZKReplicationQueueStorage extends 
ZKReplicationStorageBase
             " failed when creating the node for " + destServerName,
           e);
     }
+    String newQueueId = queueId + "-" + sourceServerName;
     try {
       String oldQueueNode = getQueueNode(sourceServerName, queueId);
       List<String> wals = ZKUtil.listChildrenNoWatch(zookeeper, oldQueueNode);
-      String newQueueId = queueId + "-" + sourceServerName;
       if (CollectionUtils.isEmpty(wals)) {
         ZKUtil.deleteNodeFailSilent(zookeeper, oldQueueNode);
         LOG.info("Removed empty {}/{}", sourceServerName, queueId);
@@ -427,11 +427,12 @@ class ZKReplicationQueueStorage extends 
ZKReplicationStorageBase
       return new Pair<>(newQueueId, logQueue);
     } catch (NoNodeException | NodeExistsException | NotEmptyException | 
BadVersionException e) {
       // Multi call failed; it looks like some other regionserver took away 
the logs.
-      // These exceptions mean that zk tells us the request can not be execute 
so it is safe to just
-      // return a null. For other types of exception should be thrown out to 
notify the upper layer.
+      // These exceptions mean that zk tells us the request can not be 
execute. So return an empty
+      // queue to tell the upper layer that claim nothing. For other types of 
exception should be
+      // thrown out to notify the upper layer.
       LOG.info("Claim queue queueId={} from {} to {} failed with {}, someone 
else took the log?",
           queueId,sourceServerName, destServerName, e.toString());
-      return null;
+      return new Pair<>(newQueueId, Collections.emptySortedSet());
     } catch (KeeperException | InterruptedException e) {
       throw new ReplicationException("Claim queue queueId=" + queueId + " from 
" +
         sourceServerName + " to " + destServerName + " failed", e);

Reply via email to