HDFS-10319. Balancer should not try to pair storages with different types.

This commit is contained in:
Tsz-Wo Nicholas Sze 2016-04-21 15:20:12 -07:00
parent b726ae0876
commit 704c57e3eb
1 changed files with 8 additions and 2 deletions

View File

@ -520,8 +520,7 @@ C chooseCandidate(G g, Iterator<C> candidates, Matcher matcher) {
final C c = candidates.next();
if (!c.hasSpaceForScheduling()) {
candidates.remove();
} else if (matcher.match(dispatcher.getCluster(),
g.getDatanodeInfo(), c.getDatanodeInfo())) {
} else if (matchStorageGroups(c, g, matcher)) {
return c;
}
}
@ -529,6 +528,13 @@ C chooseCandidate(G g, Iterator<C> candidates, Matcher matcher) {
return null;
}
private boolean matchStorageGroups(StorageGroup left, StorageGroup right,
Matcher matcher) {
return left.getStorageType() == right.getStorageType()
&& matcher.match(dispatcher.getCluster(),
left.getDatanodeInfo(), right.getDatanodeInfo());
}
/* reset all fields in a balancer preparing for the next iteration */
void resetData(Configuration conf) {
this.overUtilized.clear();