HDFS-10710. In BlockManager#rescanPostponedMisreplicatedBlocks(), postponed misreplicated block counts should be retrieved within the NN lock protection.Contributed by GAO Rui.
(cherry picked from commitf4ba5ff1d7
) (cherry picked from commit180a26d9fb
)
This commit is contained in:
parent
5883718eea
commit
5bdee64bde
|
@ -2020,9 +2020,9 @@ public class BlockManager implements BlockStatsMXBean {
|
|||
return;
|
||||
}
|
||||
long startTimeRescanPostponedMisReplicatedBlocks = Time.monotonicNow();
|
||||
namesystem.writeLock();
|
||||
long startPostponedMisReplicatedBlocksCount =
|
||||
getPostponedMisreplicatedBlocksCount();
|
||||
namesystem.writeLock();
|
||||
try {
|
||||
// blocksPerRescan is the configured number of blocks per rescan.
|
||||
// Randomly select blocksPerRescan consecutive blocks from the HashSet
|
||||
|
@ -2075,9 +2075,9 @@ public class BlockManager implements BlockStatsMXBean {
|
|||
}
|
||||
}
|
||||
} finally {
|
||||
namesystem.writeUnlock();
|
||||
long endPostponedMisReplicatedBlocksCount =
|
||||
getPostponedMisreplicatedBlocksCount();
|
||||
namesystem.writeUnlock();
|
||||
LOG.info("Rescan of postponedMisreplicatedBlocks completed in " +
|
||||
(Time.monotonicNow() - startTimeRescanPostponedMisReplicatedBlocks) +
|
||||
" msecs. " + endPostponedMisReplicatedBlocksCount +
|
||||
|
|
Loading…
Reference in New Issue