HDFS-11671. TestReconstructStripedBlocks#test2RecoveryTasksForSameBlockGroup fails.

This commit is contained in:
Andrew Wang 2017-04-19 13:49:56 -07:00
parent 46940d92e2
commit c1549352cf
2 changed files with 7 additions and 1 deletions

View File

@ -1872,7 +1872,11 @@ public static RefreshUserMappingsProtocol getRefreshUserMappingsProtocolProxy(
*/ */
public static void setDatanodeDead(DatanodeInfo dn) { public static void setDatanodeDead(DatanodeInfo dn) {
dn.setLastUpdate(0); dn.setLastUpdate(0);
dn.setLastUpdateMonotonic(0); // Set this to a large negative value.
// On short-lived VMs, the monotonic time can be less than the heartbeat
// expiry time. Setting this to 0 will fail to immediately mark the DN as
// dead.
dn.setLastUpdateMonotonic(Long.MIN_VALUE/2);
} }
/** /**

View File

@ -211,12 +211,14 @@ public void test2RecoveryTasksForSameBlockGroup() throws Exception {
Path p = new Path("/test2RecoveryTasksForSameBlockGroup"); Path p = new Path("/test2RecoveryTasksForSameBlockGroup");
final byte[] data = new byte[fileLen]; final byte[] data = new byte[fileLen];
DFSTestUtil.writeFile(fs, p, data); DFSTestUtil.writeFile(fs, p, data);
DFSTestUtil.waitForReplication(fs, p, groupSize, 5000);
LocatedStripedBlock lb = (LocatedStripedBlock)fs.getClient() LocatedStripedBlock lb = (LocatedStripedBlock)fs.getClient()
.getLocatedBlocks(p.toString(), 0).get(0); .getLocatedBlocks(p.toString(), 0).get(0);
LocatedBlock[] lbs = StripedBlockUtil.parseStripedBlockGroup(lb, LocatedBlock[] lbs = StripedBlockUtil.parseStripedBlockGroup(lb,
cellSize, dataBlocks, parityBlocks); cellSize, dataBlocks, parityBlocks);
BlockManagerTestUtil.getComputedDatanodeWork(bm);
assertEquals(0, getNumberOfBlocksToBeErasureCoded(cluster)); assertEquals(0, getNumberOfBlocksToBeErasureCoded(cluster));
assertEquals(0, bm.getPendingReconstructionBlocksCount()); assertEquals(0, bm.getPendingReconstructionBlocksCount());