HDFS-11827. NPE is thrown when log level changed in BlockPlacementPolicyDefault#chooseRandom() method. Contributed by xupeng.
This commit is contained in:
parent
18c494a00c
commit
ec21ce425f
@ -735,7 +735,7 @@ protected DatanodeStorageInfo chooseRandom(int numOfReplicas,
|
|||||||
}
|
}
|
||||||
Preconditions.checkState(excludedNodes.add(chosenNode), "chosenNode "
|
Preconditions.checkState(excludedNodes.add(chosenNode), "chosenNode "
|
||||||
+ chosenNode + " is already in excludedNodes " + excludedNodes);
|
+ chosenNode + " is already in excludedNodes " + excludedNodes);
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled() && builder != null) {
|
||||||
builder.append("\nNode ").append(NodeBase.getPath(chosenNode))
|
builder.append("\nNode ").append(NodeBase.getPath(chosenNode))
|
||||||
.append(" [");
|
.append(" [");
|
||||||
}
|
}
|
||||||
@ -771,7 +771,7 @@ protected DatanodeStorageInfo chooseRandom(int numOfReplicas,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOG.isDebugEnabled()) {
|
if (LOG.isDebugEnabled() && builder != null) {
|
||||||
builder.append("\n]");
|
builder.append("\n]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user