HDFS-10335 Mover$Processor#chooseTarget() always chooses the first matching target storage group. Contributed by Mingliang Liu

This commit is contained in:
Tsz-Wo Nicholas Sze 2016-04-29 11:22:33 -07:00
parent ac8fb579c6
commit fe3c2886be
1 changed files with 3 additions and 1 deletions

View File

@ -457,7 +457,9 @@ public class Mover {
List<StorageType> targetTypes, Matcher matcher) {
final NetworkTopology cluster = dispatcher.getCluster();
for (StorageType t : targetTypes) {
for(StorageGroup target : storages.getTargetStorages(t)) {
final List<StorageGroup> targets = storages.getTargetStorages(t);
Collections.shuffle(targets);
for (StorageGroup target : targets) {
if (matcher.match(cluster, source.getDatanodeInfo(),
target.getDatanodeInfo())) {
final PendingMove pm = source.addPendingMove(db, target);