HDFS-13962. Add null check for add-replica pool to avoid lock acquiring. Contributed by Surendra Singh Lilhore.
(cherry picked from commit 1043795f7f
)
This commit is contained in:
parent
21553e22b6
commit
b6698e2a82
|
@ -183,8 +183,10 @@ class BlockPoolSlice {
|
||||||
.setConf(conf)
|
.setConf(conf)
|
||||||
.setInitialUsed(loadDfsUsed())
|
.setInitialUsed(loadDfsUsed())
|
||||||
.build();
|
.build();
|
||||||
|
if (addReplicaThreadPool == null) {
|
||||||
// initialize add replica fork join pool
|
// initialize add replica fork join pool
|
||||||
initializeAddReplicaPool(conf);
|
initializeAddReplicaPool(conf);
|
||||||
|
}
|
||||||
// Make the dfs usage to be saved during shutdown.
|
// Make the dfs usage to be saved during shutdown.
|
||||||
shutdownHook = new Runnable() {
|
shutdownHook = new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -154,7 +154,7 @@ class ReplicaMap {
|
||||||
if (oldReplicaInfo != null) {
|
if (oldReplicaInfo != null) {
|
||||||
return oldReplicaInfo;
|
return oldReplicaInfo;
|
||||||
} else {
|
} else {
|
||||||
set.add(replicaInfo);
|
set.addOrReplace(replicaInfo);
|
||||||
}
|
}
|
||||||
return replicaInfo;
|
return replicaInfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue