Addendum fix for HDFS-7912.

This commit is contained in:
Zhe Zhang 2015-05-26 12:32:16 -07:00
parent 4ad484883f
commit c9e0268216
4 changed files with 10 additions and 18 deletions

View File

@ -1819,7 +1819,7 @@ private void processPendingReplications() {
* Use the blockinfo from the blocksmap to be certain we're working * Use the blockinfo from the blocksmap to be certain we're working
* with the most up-to-date block information (e.g. genstamp). * with the most up-to-date block information (e.g. genstamp).
*/ */
BlockInfoContiguous bi = blocksMap.getStoredBlock(timedOutItems[i]); BlockInfo bi = blocksMap.getStoredBlock(timedOutItems[i]);
if (bi == null) { if (bi == null) {
continue; continue;
} }

View File

@ -50,6 +50,7 @@
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
public class TestRecoverStripedFile { public class TestRecoverStripedFile {
public static final Log LOG = LogFactory.getLog(TestRecoverStripedFile.class); public static final Log LOG = LogFactory.getLog(TestRecoverStripedFile.class);
@ -340,7 +341,7 @@ private LocatedBlocks getLocatedBlocks(Path file) throws IOException {
private void testCreateStripedFile(Path file, int dataLen) private void testCreateStripedFile(Path file, int dataLen)
throws IOException { throws IOException {
final byte[] data = new byte[dataLen]; final byte[] data = new byte[dataLen];
DFSUtil.getRandom().nextBytes(data); ThreadLocalRandom.current().nextBytes(data);
writeContents(file, data); writeContents(file, data);
} }

View File

@ -186,7 +186,7 @@ public void testProcessPendingReplications() throws Exception {
block = new Block(1, 1, 0); block = new Block(1, 1, 0);
blockInfo = new BlockInfoContiguous(block, (short) 3); blockInfo = new BlockInfoContiguous(block, (short) 3);
pendingReplications.increment(block, pendingReplications.increment(blockInfo,
DatanodeStorageInfo.toDatanodeDescriptors( DatanodeStorageInfo.toDatanodeDescriptors(
DFSTestUtil.createDatanodeStorageInfos(1))); DFSTestUtil.createDatanodeStorageInfos(1)));
BlockCollection bc = Mockito.mock(BlockCollection.class); BlockCollection bc = Mockito.mock(BlockCollection.class);
@ -201,7 +201,8 @@ public void testProcessPendingReplications() throws Exception {
// Add a second block to pendingReplications that has no // Add a second block to pendingReplications that has no
// corresponding entry in blocksmap // corresponding entry in blocksmap
block = new Block(2, 2, 0); block = new Block(2, 2, 0);
pendingReplications.increment(block, blockInfo = new BlockInfoContiguous(block, (short) 3);
pendingReplications.increment(blockInfo,
DatanodeStorageInfo.toDatanodeDescriptors( DatanodeStorageInfo.toDatanodeDescriptors(
DFSTestUtil.createDatanodeStorageInfos(1))); DFSTestUtil.createDatanodeStorageInfos(1)));

View File

@ -1209,13 +1209,8 @@ public void testAddStoredBlockDoesNotCauseSkippedReplication()
BlockManager bm = new BlockManager(mockNS, new HdfsConfiguration()); BlockManager bm = new BlockManager(mockNS, new HdfsConfiguration());
UnderReplicatedBlocks underReplicatedBlocks = bm.neededReplications; UnderReplicatedBlocks underReplicatedBlocks = bm.neededReplications;
<<<<<<< HEAD BlockInfo block1 = genBlockInfo(ThreadLocalRandom.current().nextLong());
Block block1 = new Block(ThreadLocalRandom.current().nextLong()); BlockInfo block2 = genBlockInfo(ThreadLocalRandom.current().nextLong());
Block block2 = new Block(ThreadLocalRandom.current().nextLong());
=======
BlockInfo block1 = genBlockInfo(random.nextLong());
BlockInfo block2 = genBlockInfo(random.nextLong());
>>>>>>> 3e6f458... HDFS-7912. Erasure Coding: track BlockInfo instead of Block in UnderReplicatedBlocks and PendingReplicationBlocks. Contributed by Jing Zhao.
// Adding QUEUE_UNDER_REPLICATED block // Adding QUEUE_UNDER_REPLICATED block
underReplicatedBlocks.add(block1, 0, 1, 1); underReplicatedBlocks.add(block1, 0, 1, 1);
@ -1277,13 +1272,8 @@ public void testupdateNeededReplicationsDoesNotCauseSkippedReplication()
BlockManager bm = new BlockManager(mockNS, new HdfsConfiguration()); BlockManager bm = new BlockManager(mockNS, new HdfsConfiguration());
UnderReplicatedBlocks underReplicatedBlocks = bm.neededReplications; UnderReplicatedBlocks underReplicatedBlocks = bm.neededReplications;
<<<<<<< HEAD BlockInfo block1 = genBlockInfo(ThreadLocalRandom.current().nextLong());
Block block1 = new Block(ThreadLocalRandom.current().nextLong()); BlockInfo block2 = genBlockInfo(ThreadLocalRandom.current().nextLong());
Block block2 = new Block(ThreadLocalRandom.current().nextLong());
=======
BlockInfo block1 = genBlockInfo(random.nextLong());
BlockInfo block2 = genBlockInfo(random.nextLong());
>>>>>>> 3e6f458... HDFS-7912. Erasure Coding: track BlockInfo instead of Block in UnderReplicatedBlocks and PendingReplicationBlocks. Contributed by Jing Zhao.
// Adding QUEUE_UNDER_REPLICATED block // Adding QUEUE_UNDER_REPLICATED block
underReplicatedBlocks.add(block1, 0, 1, 1); underReplicatedBlocks.add(block1, 0, 1, 1);