[17/50] [abbrv] hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8a9f6635 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8a9f6635 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8a9f6635 Branch: refs/heads/HADOOP-13070 Commit: 8a9f6635a33e9648e9396e9ec5571fa34aa0c773 Parents: dbe663d Author: Kihwal LeeAuthored: Fri Oct 14 11:38:48 2016 -0500 Committer: Kihwal Lee Committed: Fri Oct 14 11:38:48 2016 -0500 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a9f6635/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..d856065 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(final int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
[08/50] [abbrv] hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fdce5150 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fdce5150 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fdce5150 Branch: refs/heads/HADOOP-13070 Commit: fdce515091f0a61ffd6c9ae464a68447dedf1124 Parents: 008122b Author: Andrew WangAuthored: Thu Oct 13 11:41:37 2016 -0700 Committer: Andrew Wang Committed: Thu Oct 13 11:41:37 2016 -0700 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/fdce5150/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..19f3178 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
[20/50] hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fdce5150 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fdce5150 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fdce5150 Branch: refs/heads/HDFS-10285 Commit: fdce515091f0a61ffd6c9ae464a68447dedf1124 Parents: 008122b Author: Andrew WangAuthored: Thu Oct 13 11:41:37 2016 -0700 Committer: Andrew Wang Committed: Thu Oct 13 11:41:37 2016 -0700 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/fdce5150/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..19f3178 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
[29/50] hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8a9f6635 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8a9f6635 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8a9f6635 Branch: refs/heads/HDFS-10285 Commit: 8a9f6635a33e9648e9396e9ec5571fa34aa0c773 Parents: dbe663d Author: Kihwal LeeAuthored: Fri Oct 14 11:38:48 2016 -0500 Committer: Kihwal Lee Committed: Fri Oct 14 11:38:48 2016 -0500 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a9f6635/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..d856065 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(final int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
[01/50] [abbrv] hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. [Forced Update!]
Repository: hadoop Updated Branches: refs/heads/YARN-3368 85396654e -> 5382eb25f (forced update) HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8a9f6635 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8a9f6635 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8a9f6635 Branch: refs/heads/YARN-3368 Commit: 8a9f6635a33e9648e9396e9ec5571fa34aa0c773 Parents: dbe663d Author: Kihwal LeeAuthored: Fri Oct 14 11:38:48 2016 -0500 Committer: Kihwal Lee Committed: Fri Oct 14 11:38:48 2016 -0500 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a9f6635/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..d856065 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(final int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
Repository: hadoop Updated Branches: refs/heads/branch-2.8 e41295182 -> 8c71fc122 HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. (cherry picked from commit 8a9f6635a33e9648e9396e9ec5571fa34aa0c773) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8c71fc12 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8c71fc12 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8c71fc12 Branch: refs/heads/branch-2.8 Commit: 8c71fc12213b1bdff099c8e61c3670b4f0aedf23 Parents: e412951 Author: Kihwal LeeAuthored: Fri Oct 14 11:44:25 2016 -0500 Committer: Kihwal Lee Committed: Fri Oct 14 11:44:25 2016 -0500 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8c71fc12/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..d856065 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(final int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
Repository: hadoop Updated Branches: refs/heads/trunk dbe663d52 -> 8a9f6635a HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8a9f6635 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8a9f6635 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8a9f6635 Branch: refs/heads/trunk Commit: 8a9f6635a33e9648e9396e9ec5571fa34aa0c773 Parents: dbe663d Author: Kihwal LeeAuthored: Fri Oct 14 11:38:48 2016 -0500 Committer: Kihwal Lee Committed: Fri Oct 14 11:38:48 2016 -0500 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8a9f6635/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..d856065 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(final int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
Repository: hadoop Updated Branches: refs/heads/branch-2 1eb8c0e88 -> 6e0b55fe7 HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. (cherry picked from commit 8a9f6635a33e9648e9396e9ec5571fa34aa0c773) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6e0b55fe Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6e0b55fe Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6e0b55fe Branch: refs/heads/branch-2 Commit: 6e0b55fe7978e51258c85e1b5d4c9f578e4168d0 Parents: 1eb8c0e Author: Kihwal LeeAuthored: Fri Oct 14 11:40:11 2016 -0500 Committer: Kihwal Lee Committed: Fri Oct 14 11:40:11 2016 -0500 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/6e0b55fe/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..d856065 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(final int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
[46/51] [abbrv] hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fdce5150 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fdce5150 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fdce5150 Branch: refs/heads/HDFS-7240 Commit: fdce515091f0a61ffd6c9ae464a68447dedf1124 Parents: 008122b Author: Andrew WangAuthored: Thu Oct 13 11:41:37 2016 -0700 Committer: Andrew Wang Committed: Thu Oct 13 11:41:37 2016 -0700 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/fdce5150/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..19f3178 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
Repository: hadoop Updated Branches: refs/heads/branch-2.8 3a9808e96 -> 7a5aaa789 HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. (cherry picked from commit fdce515091f0a61ffd6c9ae464a68447dedf1124) (cherry picked from commit 2e153bc8abc3fe2f50660136af32711c50e7e7e7) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7a5aaa78 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7a5aaa78 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7a5aaa78 Branch: refs/heads/branch-2.8 Commit: 7a5aaa789d9160ac55f022aae64a0b437ddccf06 Parents: 3a9808e Author: Andrew WangAuthored: Thu Oct 13 11:41:37 2016 -0700 Committer: Andrew Wang Committed: Thu Oct 13 11:42:23 2016 -0700 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7a5aaa78/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..19f3178 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
Repository: hadoop Updated Branches: refs/heads/branch-2 ecd3467f1 -> 2e153bc8a HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. (cherry picked from commit fdce515091f0a61ffd6c9ae464a68447dedf1124) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/2e153bc8 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/2e153bc8 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/2e153bc8 Branch: refs/heads/branch-2 Commit: 2e153bc8abc3fe2f50660136af32711c50e7e7e7 Parents: ecd3467f Author: Andrew WangAuthored: Thu Oct 13 11:41:37 2016 -0700 Committer: Andrew Wang Committed: Thu Oct 13 11:42:03 2016 -0700 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/2e153bc8/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..19f3178 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org
hadoop git commit: HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin.
Repository: hadoop Updated Branches: refs/heads/trunk 008122b3c -> fdce51509 HDFS-10990. TestPendingInvalidateBlock should wait for IBRs. Contributed by Yiqun Lin. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fdce5150 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fdce5150 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fdce5150 Branch: refs/heads/trunk Commit: fdce515091f0a61ffd6c9ae464a68447dedf1124 Parents: 008122b Author: Andrew WangAuthored: Thu Oct 13 11:41:37 2016 -0700 Committer: Andrew Wang Committed: Thu Oct 13 11:41:37 2016 -0700 -- .../blockmanagement/TestPendingInvalidateBlock.java| 13 + 1 file changed, 9 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/fdce5150/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java index 696b2aa..19f3178 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestPendingInvalidateBlock.java @@ -86,6 +86,8 @@ public class TestPendingInvalidateBlock { public void testPendingDeletion() throws Exception { final Path foo = new Path("/foo"); DFSTestUtil.createFile(dfs, foo, BLOCKSIZE, REPLICATION, 0); +DFSTestUtil.waitForReplication(dfs, foo, REPLICATION, 1); + // restart NN cluster.restartNameNode(true); InvalidateBlocks invalidateBlocks = @@ -98,6 +100,7 @@ public class TestPendingInvalidateBlock { "invalidateBlocks", mockIb); dfs.delete(foo, true); +waitForNumPendingDeletionBlocks(REPLICATION); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(REPLICATION, cluster.getNamesystem() .getPendingDeletionBlocks()); @@ -105,7 +108,7 @@ public class TestPendingInvalidateBlock { dfs.getPendingDeletionBlocksCount()); Mockito.doReturn(0L).when(mockIb).getInvalidationDelay(); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(0, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); Assert.assertEquals(0, dfs.getPendingDeletionBlocksCount()); @@ -182,7 +185,7 @@ public class TestPendingInvalidateBlock { Assert.assertEquals(4, cluster.getNamesystem().getPendingDeletionBlocks()); cluster.restartNameNode(true); -waitForBlocksToDelete(); +waitForNumPendingDeletionBlocks(0); Assert.assertEquals(3, cluster.getNamesystem().getBlocksTotal()); Assert.assertEquals(0, cluster.getNamesystem().getPendingDeletionBlocks()); } @@ -199,7 +202,8 @@ public class TestPendingInvalidateBlock { return cluster.getNamesystem().getUnderReplicatedBlocks(); } - private void waitForBlocksToDelete() throws Exception { + private void waitForNumPendingDeletionBlocks(int numBlocks) + throws Exception { GenericTestUtils.waitFor(new Supplier() { @Override @@ -207,7 +211,8 @@ public class TestPendingInvalidateBlock { try { cluster.triggerBlockReports(); - if (cluster.getNamesystem().getPendingDeletionBlocks() == 0) { + if (cluster.getNamesystem().getPendingDeletionBlocks() + == numBlocks) { return true; } } catch (Exception e) { - To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org