HDFS-13155. BlockPlacementPolicyDefault.chooseTargetInOrder Not Checking Return Value for NULL. Contributed by Zsolt Venczel.
(cherry picked from commit bccdfeee0a
)
This commit is contained in:
parent
fde45994a3
commit
302c36ffdc
|
@ -480,9 +480,13 @@ public class BlockPlacementPolicyDefault extends BlockPlacementPolicy {
|
||||||
throws NotEnoughReplicasException {
|
throws NotEnoughReplicasException {
|
||||||
final int numOfResults = results.size();
|
final int numOfResults = results.size();
|
||||||
if (numOfResults == 0) {
|
if (numOfResults == 0) {
|
||||||
writer = chooseLocalStorage(writer, excludedNodes, blocksize,
|
DatanodeStorageInfo storageInfo = chooseLocalStorage(writer,
|
||||||
maxNodesPerRack, results, avoidStaleNodes, storageTypes, true)
|
excludedNodes, blocksize, maxNodesPerRack, results, avoidStaleNodes,
|
||||||
.getDatanodeDescriptor();
|
storageTypes, true);
|
||||||
|
|
||||||
|
writer = (storageInfo != null) ? storageInfo.getDatanodeDescriptor()
|
||||||
|
: null;
|
||||||
|
|
||||||
if (--numOfReplicas == 0) {
|
if (--numOfReplicas == 0) {
|
||||||
return writer;
|
return writer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue