HDFS-2434. TestNameNodeMetrics.testCorruptBlock fails intermittently. Contributed by Jing Zhao.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1401423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b73903f6a7
commit
aa42e2161d
@ -482,7 +482,11 @@ Release 2.0.3-alpha - Unreleased
|
||||
HDFS-4072. On file deletion remove corresponding blocks pending
|
||||
replications. (Jing Zhao via suresh)
|
||||
|
||||
HDFS-4022. Replication not happening for appended block. (Vinay via umamahesh)
|
||||
HDFS-4022. Replication not happening for appended block.
|
||||
(Vinay via umamahesh)
|
||||
|
||||
HDFS-2434. TestNameNodeMetrics.testCorruptBlock fails intermittently.
|
||||
(Jing Zhao via suresh)
|
||||
|
||||
Release 2.0.2-alpha - 2012-09-07
|
||||
|
||||
|
@ -205,6 +205,12 @@ public void testCorruptBlock() throws Exception {
|
||||
final Path file = getTestPath("testCorruptBlock");
|
||||
createFile(file, 100, (short)2);
|
||||
|
||||
// Disable the heartbeats, so that no corrupted replica
|
||||
// can be fixed
|
||||
for (DataNode dn : cluster.getDataNodes()) {
|
||||
DataNodeTestUtils.setHeartbeatsDisabledForTests(dn, true);
|
||||
}
|
||||
|
||||
// Corrupt first replica of the block
|
||||
LocatedBlock block = NameNodeAdapter.getBlockLocations(
|
||||
cluster.getNameNode(), file.toString(), 0, 1).get(0);
|
||||
@ -215,12 +221,23 @@ public void testCorruptBlock() throws Exception {
|
||||
} finally {
|
||||
cluster.getNamesystem().writeUnlock();
|
||||
}
|
||||
Thread.sleep(1000); // Wait for block to be marked corrupt
|
||||
BlockManagerTestUtil.getComputedDatanodeWork(bm);
|
||||
BlockManagerTestUtil.updateState(bm);
|
||||
MetricsRecordBuilder rb = getMetrics(NS_METRICS);
|
||||
assertGauge("CorruptBlocks", 1L, rb);
|
||||
assertGauge("PendingReplicationBlocks", 1L, rb);
|
||||
assertGauge("ScheduledReplicationBlocks", 1L, rb);
|
||||
|
||||
fs.delete(file, true);
|
||||
// During the file deletion, both BlockManager#corruptReplicas and
|
||||
// BlockManager#pendingReplications will be updated, i.e., the records
|
||||
// for the blocks of the deleted file will be removed from both
|
||||
// corruptReplicas and pendingReplications. The corresponding
|
||||
// metrics (CorruptBlocks and PendingReplicationBlocks) will only be updated
|
||||
// when BlockManager#computeDatanodeWork is run where the
|
||||
// BlockManager#udpateState is called. And in
|
||||
// BlockManager#computeDatanodeWork the metric ScheduledReplicationBlocks
|
||||
// will also be updated.
|
||||
rb = waitForDnMetricValue(NS_METRICS, "CorruptBlocks", 0L);
|
||||
assertGauge("PendingReplicationBlocks", 0L, rb);
|
||||
assertGauge("ScheduledReplicationBlocks", 0L, rb);
|
||||
|
Loading…
Reference in New Issue
Block a user