HDFS-13155. BlockPlacementPolicyDefault.chooseTargetInOrder Not Checking Return Value for NULL. Contributed by Zsolt Venczel.
(cherry picked from commitbccdfeee0a
) (cherry picked from commit302c36ffdc
)
This commit is contained in:
parent
3ee5fd16f4
commit
63fc8f82cb
|
@ -480,9 +480,13 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy {
|
|||
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