Revert "HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin."
This reverts commit 2e153bc8ab
.
This commit is contained in:
parent
c5a1303704
commit
dc78e0e7fc
|
@ -86,8 +86,6 @@ public class TestPendingInvalidateBlock {
|
||||||
public void testPendingDeletion() throws Exception {
|
public void testPendingDeletion() throws Exception {
|
||||||
final Path foo = new Path("/foo");
|
final Path foo = new Path("/foo");
|
||||||
DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0);
|
DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0);
|
||||||
DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 10000);
|
|
||||||
|
|
||||||
// restart NN
|
// restart NN
|
||||||
cluster.restartNameNode(true);
|
cluster.restartNameNode(true);
|
||||||
InvalidateBlocks invalidateBlocks =
|
InvalidateBlocks invalidateBlocks =
|
||||||
|
@ -100,7 +98,6 @@ public class TestPendingInvalidateBlock {
|
||||||
"invalidateBlocks", mockIb);
|
"invalidateBlocks", mockIb);
|
||||||
dfs.delete(foo, true);
|
dfs.delete(foo, true);
|
||||||
|
|
||||||
waitForNumPendingDeletionBlocks(REPLICATION);
|
|
||||||
Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal());
|
Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal());
|
||||||
Assert.assertEquals(REPLICATION, cluster.getNamesystem()
|
Assert.assertEquals(REPLICATION, cluster.getNamesystem()
|
||||||
.getPendingDeletionBlocks());
|
.getPendingDeletionBlocks());
|
||||||
|
@ -108,7 +105,7 @@ public class TestPendingInvalidateBlock {
|
||||||
dfs.getPendingDeletionBlocksCount());
|
dfs.getPendingDeletionBlocksCount());
|
||||||
Mockito.doReturn(0L).when(mockIb).getInvalidationDelay();
|
Mockito.doReturn(0L).when(mockIb).getInvalidationDelay();
|
||||||
|
|
||||||
waitForNumPendingDeletionBlocks(0);
|
waitForBlocksToDelete();
|
||||||
Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal());
|
Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal());
|
||||||
Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks());
|
Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks());
|
||||||
Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount());
|
Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount());
|
||||||
|
@ -185,7 +182,7 @@ public class TestPendingInvalidateBlock {
|
||||||
Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks());
|
Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks());
|
||||||
|
|
||||||
cluster.restartNameNode(true);
|
cluster.restartNameNode(true);
|
||||||
waitForNumPendingDeletionBlocks(0);
|
waitForBlocksToDelete();
|
||||||
Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal());
|
Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal());
|
||||||
Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks());
|
Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks());
|
||||||
}
|
}
|
||||||
|
@ -202,8 +199,7 @@ public class TestPendingInvalidateBlock {
|
||||||
return cluster.getNamesystem().getUnderReplicatedBlocks();
|
return cluster.getNamesystem().getUnderReplicatedBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForNumPendingDeletionBlocks(int numBlocks)
|
private void waitForBlocksToDelete() throws Exception {
|
||||||
throws Exception {
|
|
||||||
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
GenericTestUtils.waitFor(new Supplier<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -211,8 +207,7 @@ public class TestPendingInvalidateBlock {
|
||||||
try {
|
try {
|
||||||
cluster.triggerBlockReports();
|
cluster.triggerBlockReports();
|
||||||
|
|
||||||
if (cluster.getNamesystem().getPendingDeletionBlocks()
|
if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) {
|
||||||
== numBlocks) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue