Skip to content

Commit 5245254

Browse files
author
Tsz-Wo Nicholas Sze
committed
HDFS-10319. Balancer should not try to pair storages with different types.
1 parent a7f903b commit 5245254

File tree

1 file changed

+8
-2
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer

1 file changed

+8
-2
lines changed

hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Balancer.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,15 +520,21 @@ C chooseCandidate(G g, Iterator<C> candidates, Matcher matcher) {
520520
final C c = candidates.next();
521521
if (!c.hasSpaceForScheduling()) {
522522
candidates.remove();
523-
} else if (matcher.match(dispatcher.getCluster(),
524-
g.getDatanodeInfo(), c.getDatanodeInfo())) {
523+
} else if (matchStorageGroups(c, g, matcher)) {
525524
return c;
526525
}
527526
}
528527
}
529528
return null;
530529
}
531530

531+
private boolean matchStorageGroups(StorageGroup left, StorageGroup right,
532+
Matcher matcher) {
533+
return left.getStorageType() == right.getStorageType()
534+
&& matcher.match(dispatcher.getCluster(),
535+
left.getDatanodeInfo(), right.getDatanodeInfo());
536+
}
537+
532538
/* reset all fields in a balancer preparing for the next iteration */
533539
void resetData(Configuration conf) {
534540
this.overUtilized.clear();

0 commit comments

Comments
 (0)