HDFS-16909. Improve ReplicaMap#mergeAll method. (#5353). Contributed by ZhangHB.
Reviewed-by: zhangshuyan <zqingchai@gmail.com> Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
parent
af933f3a4f
commit
5b22dc6ace
@ -178,13 +178,13 @@ void mergeAll(ReplicaMap other) {
|
|||||||
for (ReplicaInfo replicaInfo : replicaInfos) {
|
for (ReplicaInfo replicaInfo : replicaInfos) {
|
||||||
replicaSet.add(replicaInfo);
|
replicaSet.add(replicaInfo);
|
||||||
}
|
}
|
||||||
|
if (curSet == null && !replicaSet.isEmpty()) {
|
||||||
|
// Add an entry for block pool if it does not exist already
|
||||||
|
curSet = new LightWeightResizableGSet<>();
|
||||||
|
map.put(bp, curSet);
|
||||||
|
}
|
||||||
for (ReplicaInfo replicaInfo : replicaSet) {
|
for (ReplicaInfo replicaInfo : replicaSet) {
|
||||||
checkBlock(replicaInfo);
|
checkBlock(replicaInfo);
|
||||||
if (curSet == null) {
|
|
||||||
// Add an entry for block pool if it does not exist already
|
|
||||||
curSet = new LightWeightResizableGSet<>();
|
|
||||||
map.put(bp, curSet);
|
|
||||||
}
|
|
||||||
curSet.put(replicaInfo);
|
curSet.put(replicaInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user