|
@@ -209,8 +209,6 @@ public class TestPendingReplication {
|
|
// Place into blocksmap with GenerationStamp = 1
|
|
// Place into blocksmap with GenerationStamp = 1
|
|
blockInfo.setGenerationStamp(1);
|
|
blockInfo.setGenerationStamp(1);
|
|
blocksMap.addBlockCollection(blockInfo, bc);
|
|
blocksMap.addBlockCollection(blockInfo, bc);
|
|
- //Save it for later.
|
|
|
|
- BlockInfo storedBlock = blockInfo;
|
|
|
|
|
|
|
|
assertEquals("Size of pendingReplications ", 1,
|
|
assertEquals("Size of pendingReplications ", 1,
|
|
pendingReplications.size());
|
|
pendingReplications.size());
|
|
@@ -257,49 +255,6 @@ public class TestPendingReplication {
|
|
// Verify size of neededReplications is exactly 1.
|
|
// Verify size of neededReplications is exactly 1.
|
|
assertEquals("size of neededReplications is 1 ", 1,
|
|
assertEquals("size of neededReplications is 1 ", 1,
|
|
neededReplications.size());
|
|
neededReplications.size());
|
|
-
|
|
|
|
- // Verify HDFS-11960
|
|
|
|
- // Stop the replication/redundancy monitor
|
|
|
|
- BlockManagerTestUtil.stopReplicationThread(blkManager);
|
|
|
|
- pendingReplications.clear();
|
|
|
|
- // Pick a real node
|
|
|
|
- DatanodeDescriptor desc[] = { blkManager.getDatanodeManager().
|
|
|
|
- getDatanodes().iterator().next() };
|
|
|
|
-
|
|
|
|
- // Add a stored block to the pendingReconstruction.
|
|
|
|
- pendingReplications.increment(storedBlock, desc);
|
|
|
|
- assertEquals("Size of pendingReplications ", 1,
|
|
|
|
- pendingReplications.size());
|
|
|
|
-
|
|
|
|
- // A received IBR processing calls addBlock(). If the gen stamp in the
|
|
|
|
- // report is not the same, it should stay in pending.
|
|
|
|
- fsn.writeLock();
|
|
|
|
- try {
|
|
|
|
- // Use a wrong gen stamp.
|
|
|
|
- blkManager.addBlock(desc[0].getStorageInfos()[0],
|
|
|
|
- new Block(1, 1, 0), null);
|
|
|
|
- } finally {
|
|
|
|
- fsn.writeUnlock();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // The block should still be pending
|
|
|
|
- assertEquals("Size of pendingReplications ", 1,
|
|
|
|
- pendingReplications.size());
|
|
|
|
-
|
|
|
|
- // A block report with the correct gen stamp should remove the record
|
|
|
|
- // from the pending queue.
|
|
|
|
- fsn.writeLock();
|
|
|
|
- try {
|
|
|
|
- blkManager.addBlock(desc[0].getStorageInfos()[0],
|
|
|
|
- new Block(1, 1, 1), null);
|
|
|
|
- } finally {
|
|
|
|
- fsn.writeUnlock();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // The pending queue should be empty.
|
|
|
|
- assertEquals("Size of pendingReplications ", 0,
|
|
|
|
- pendingReplications.size());
|
|
|
|
-
|
|
|
|
} finally {
|
|
} finally {
|
|
if (cluster != null) {
|
|
if (cluster != null) {
|
|
cluster.shutdown();
|
|
cluster.shutdown();
|