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