HDFS-16785. Avoid to hold write lock to improve performance when add volume. (#4945). Contributed by ZanderXu.

Signed-off-by: Tao Li <tomscut@apache.org>
Signed-off-by: He Xiaoqiao <hexiaoqiao@apache.org>
This commit is contained in:
ZanderXu 2022-11-13 22:01:35 +08:00 committed by GitHub
parent 22c9f28f4d
commit d3c1c453f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -520,7 +520,7 @@ public void addVolume(final StorageLocation location,
for (final NamespaceInfo nsInfo : nsInfos) { for (final NamespaceInfo nsInfo : nsInfos) {
String bpid = nsInfo.getBlockPoolID(); String bpid = nsInfo.getBlockPoolID();
try (AutoCloseDataSetLock l = lockManager.writeLock(LockLevel.BLOCK_POOl, bpid)) { try {
fsVolume.addBlockPool(bpid, this.conf, this.timer); fsVolume.addBlockPool(bpid, this.conf, this.timer);
fsVolume.getVolumeMap(bpid, tempVolumeMap, ramDiskReplicaTracker); fsVolume.getVolumeMap(bpid, tempVolumeMap, ramDiskReplicaTracker);
} catch (IOException e) { } catch (IOException e) {