HDFS-13155. BlockPlacementPolicyDefault.chooseTargetInOrder Not Checking Return Value for NULL. Contributed by Zsolt Venczel.
This commit is contained in:
parent
9efb4b7db0
commit
bccdfeee0a
@ -485,9 +485,13 @@ protected Node chooseTargetInOrder(int numOfReplicas,
|
||||
throws NotEnoughReplicasException {
|
||||
final int numOfResults = results.size();
|
||||
if (numOfResults == 0) {
|
||||
writer = chooseLocalStorage(writer, excludedNodes, blocksize,
|
||||
maxNodesPerRack, results, avoidStaleNodes, storageTypes, true)
|
||||
.getDatanodeDescriptor();
|
||||
DatanodeStorageInfo storageInfo = chooseLocalStorage(writer,
|
||||
excludedNodes, blocksize, maxNodesPerRack, results, avoidStaleNodes,
|
||||
storageTypes, true);
|
||||
|
||||
writer = (storageInfo != null) ? storageInfo.getDatanodeDescriptor()
|
||||
: null;
|
||||
|
||||
if (--numOfReplicas == 0) {
|
||||
return writer;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user