HDFS-15092. TestRedudantBlocks#testProcessOverReplicatedAndRedudantBlock sometimes fails. Contributed by Fei Hui.
(cherry picked from commit8cfc3673dc
) (cherry picked from commit86028d975c
)
This commit is contained in:
parent
91acb7b9fe
commit
1f55483339
|
@ -35,8 +35,10 @@ import org.apache.hadoop.hdfs.protocol.LocatedBlock;
|
||||||
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
import org.apache.hadoop.hdfs.protocol.LocatedBlocks;
|
||||||
import org.apache.hadoop.hdfs.protocol.LocatedStripedBlock;
|
import org.apache.hadoop.hdfs.protocol.LocatedStripedBlock;
|
||||||
import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
|
import org.apache.hadoop.hdfs.protocol.SystemErasureCodingPolicies;
|
||||||
|
import org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStriped;
|
||||||
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
import org.apache.hadoop.hdfs.server.datanode.SimulatedFSDataset;
|
||||||
import org.apache.hadoop.hdfs.util.StripedBlockUtil;
|
import org.apache.hadoop.hdfs.util.StripedBlockUtil;
|
||||||
|
import org.apache.hadoop.test.GenericTestUtils;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -108,18 +110,26 @@ public class TestRedudantBlocks {
|
||||||
blk.setBlockId(groupId + 2);
|
blk.setBlockId(groupId + 2);
|
||||||
cluster.injectBlocks(i, Arrays.asList(blk), bpid);
|
cluster.injectBlocks(i, Arrays.asList(blk), bpid);
|
||||||
|
|
||||||
|
BlockInfoStriped blockInfo =
|
||||||
|
(BlockInfoStriped)cluster.getNamesystem().getBlockManager()
|
||||||
|
.getStoredBlock(new Block(groupId));
|
||||||
// update blocksMap
|
// update blocksMap
|
||||||
cluster.triggerBlockReports();
|
cluster.triggerBlockReports();
|
||||||
// delete redundant block
|
// delete redundant block
|
||||||
cluster.triggerHeartbeats();
|
cluster.triggerHeartbeats();
|
||||||
//wait for IBR
|
//wait for IBR
|
||||||
Thread.sleep(1100);
|
GenericTestUtils.waitFor(
|
||||||
|
() -> cluster.getNamesystem().getBlockManager()
|
||||||
|
.countNodes(blockInfo).liveReplicas() >= groupSize -1,
|
||||||
|
500, 10000);
|
||||||
|
|
||||||
// trigger reconstruction
|
// trigger reconstruction
|
||||||
cluster.triggerHeartbeats();
|
cluster.triggerHeartbeats();
|
||||||
|
|
||||||
//wait for IBR
|
//wait for IBR
|
||||||
Thread.sleep(1100);
|
GenericTestUtils.waitFor(
|
||||||
|
() -> cluster.getNamesystem().getBlockManager()
|
||||||
|
.countNodes(blockInfo).liveReplicas() >= groupSize,
|
||||||
|
500, 10000);
|
||||||
|
|
||||||
HashSet<Long> blockIdsSet = new HashSet<Long>();
|
HashSet<Long> blockIdsSet = new HashSet<Long>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue