HBASE-20678 NPE in ReplicationSourceManager#NodeFailoverWorker

This commit is contained in:
Guanghao Zhang 2018-06-04 11:10:22 +08:00
parent a45763df55
commit 57c8671728
1 changed files with 5 additions and 4 deletions

View File

@ -393,10 +393,10 @@ class ZKReplicationQueueStorage extends ZKReplicationStorageBase
" failed when creating the node for " + destServerName, " failed when creating the node for " + destServerName,
e); e);
} }
String newQueueId = queueId + "-" + sourceServerName;
try { try {
String oldQueueNode = getQueueNode(sourceServerName, queueId); String oldQueueNode = getQueueNode(sourceServerName, queueId);
List<String> wals = ZKUtil.listChildrenNoWatch(zookeeper, oldQueueNode); List<String> wals = ZKUtil.listChildrenNoWatch(zookeeper, oldQueueNode);
String newQueueId = queueId + "-" + sourceServerName;
if (CollectionUtils.isEmpty(wals)) { if (CollectionUtils.isEmpty(wals)) {
ZKUtil.deleteNodeFailSilent(zookeeper, oldQueueNode); ZKUtil.deleteNodeFailSilent(zookeeper, oldQueueNode);
LOG.info("Removed empty {}/{}", sourceServerName, queueId); LOG.info("Removed empty {}/{}", sourceServerName, queueId);
@ -427,11 +427,12 @@ class ZKReplicationQueueStorage extends ZKReplicationStorageBase
return new Pair<>(newQueueId, logQueue); return new Pair<>(newQueueId, logQueue);
} catch (NoNodeException | NodeExistsException | NotEmptyException | BadVersionException e) { } catch (NoNodeException | NodeExistsException | NotEmptyException | BadVersionException e) {
// Multi call failed; it looks like some other regionserver took away the logs. // 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 // These exceptions mean that zk tells us the request can not be execute. So return an empty
// return a null. For other types of exception should be thrown out to notify the upper layer. // 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?", LOG.info("Claim queue queueId={} from {} to {} failed with {}, someone else took the log?",
queueId,sourceServerName, destServerName, e.toString()); queueId,sourceServerName, destServerName, e.toString());
return null; return new Pair<>(newQueueId, Collections.emptySortedSet());
} catch (KeeperException | InterruptedException e) { } catch (KeeperException | InterruptedException e) {
throw new ReplicationException("Claim queue queueId=" + queueId + " from " + throw new ReplicationException("Claim queue queueId=" + queueId + " from " +
sourceServerName + " to " + destServerName + " failed", e); sourceServerName + " to " + destServerName + " failed", e);