HDFS-15783. Speed up BlockPlacementPolicyRackFaultTolerant#verifyBlockPlacement (#2626)

This commit is contained in:
Akira Ajisaka 2021-01-21 10:07:46 +09:00 committed by GitHub
parent cfe6e1f7da
commit 45b3a84709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -237,9 +237,8 @@ public BlockPlacementStatus verifyBlockPlacement(DatanodeInfo[] locs,
// only one rack
return new BlockPlacementStatusDefault(1, 1, 1);
}
// 1. Check that all locations are different.
// 2. Count locations on different racks.
Set<String> racks = new TreeSet<>();
// Count locations on different racks.
Set<String> racks = new HashSet<>();
for (DatanodeInfo dn : locs) {
racks.add(dn.getNetworkLocation());
}