Repository: hadoop Updated Branches: refs/heads/branch-2.6 d75375a62 -> 8b9241f93
Revert HADOOP-12715 which cause build failure on branch-2.6. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8b9241f9 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8b9241f9 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8b9241f9 Branch: refs/heads/branch-2.6 Commit: 8b9241f93e86fa61d4e841a275087bbb7c7867e0 Parents: d75375a Author: Junping Du <[email protected]> Authored: Wed Jan 27 08:14:30 2016 -0800 Committer: Junping Du <[email protected]> Committed: Wed Jan 27 08:14:30 2016 -0800 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 - .../hadoop/crypto/key/TestValueQueue.java | 65 +++++--------------- 2 files changed, 16 insertions(+), 52 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8b9241f9/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index ebdcf45..af9ffa9 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -27,9 +27,6 @@ Release 2.6.4 - UNRELEASED HADOOP-12736. TestTimedOutTestsListener#testThreadDumpAndDeadlocks sometimes times out. (Xiao Chen via aajisaka) - HADOOP-12715. TestValueQueue#testgetAtMostPolicyALL fails intermittently. - (Xiao Chen via waltersu4549) - Release 2.6.3 - 2015-12-17 INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/8b9241f9/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestValueQueue.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestValueQueue.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestValueQueue.java index 5eae9a0..8e3a093 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestValueQueue.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestValueQueue.java @@ -19,24 +19,18 @@ package org.apache.hadoop.crypto.key; import java.io.IOException; import java.util.Queue; -import java.util.concurrent.ExecutionException; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.hadoop.crypto.key.kms.ValueQueue; import org.apache.hadoop.crypto.key.kms.ValueQueue.QueueRefiller; import org.apache.hadoop.crypto.key.kms.ValueQueue.SyncGenerationPolicy; -import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert; import org.junit.Test; -import com.google.common.base.Supplier; import com.google.common.collect.Sets; public class TestValueQueue { - Logger LOG = LoggerFactory.getLogger(TestValueQueue.class); private static class FillInfo { final int num; @@ -66,7 +60,7 @@ public class TestValueQueue { /** * Verifies that Queue is initially filled to "numInitValues" */ - @Test(timeout=30000) + @Test public void testInitFill() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq = @@ -80,7 +74,7 @@ public class TestValueQueue { /** * Verifies that Queue is initialized (Warmed-up) for provided keys */ - @Test(timeout=30000) + @Test public void testWarmUp() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq = @@ -103,7 +97,7 @@ public class TestValueQueue { * Verifies that the refill task is executed after "checkInterval" if * num values below "lowWatermark" */ - @Test(timeout=30000) + @Test public void testRefill() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq = @@ -122,7 +116,7 @@ public class TestValueQueue { * Verifies that the No refill Happens after "checkInterval" if * num values above "lowWatermark" */ - @Test(timeout=30000) + @Test public void testNoRefill() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq = @@ -137,56 +131,29 @@ public class TestValueQueue { /** * Verify getAtMost when SyncGeneration Policy = ALL */ - @Test(timeout=30000) + @Test public void testgetAtMostPolicyALL() throws Exception { MockFiller filler = new MockFiller(); - final ValueQueue<String> vq = + ValueQueue<String> vq = new ValueQueue<String>(10, 0.1f, 300, 1, SyncGenerationPolicy.ALL, filler); Assert.assertEquals("test", vq.getNext("k1")); Assert.assertEquals(1, filler.getTop().num); - - // Synchronous call: - // 1. Synchronously fill returned list - // 2. Start another async task to fill the queue in the cache - Assert.assertEquals("Failed in sync call.", 10, - vq.getAtMost("k1", 10).size()); - Assert.assertEquals("Sync call filler got wrong number.", 10, - filler.getTop().num); - - // Wait for the async task to finish - GenericTestUtils.waitFor(new Supplier<Boolean>() { - @Override - public Boolean get() { - try { - int size = vq.getSize("k1"); - if (size != 10) { - LOG.info("Current ValueQueue size is " + size); - return false; - } - return true; - } catch (ExecutionException e) { - LOG.error("Exception when getSize.", e); - return false; - } - } - }, 100, 3000); - Assert.assertEquals("Failed in async call.", 10, filler.getTop().num); - - // Drain completely after filled by the async thread - Assert.assertEquals("Failed to drain completely after async.", 10, - vq.getAtMost("k1", 10).size()); + // Drain completely + Assert.assertEquals(10, vq.getAtMost("k1", 10).size()); + // Synchronous call + Assert.assertEquals(10, filler.getTop().num); + // Ask for more... return all + Assert.assertEquals(19, vq.getAtMost("k1", 19).size()); // Synchronous call (No Async call since num > lowWatermark) - Assert.assertEquals("Failed to get all 19.", 19, - vq.getAtMost("k1", 19).size()); - Assert.assertEquals("Failed in sync call.", 19, filler.getTop().num); + Assert.assertEquals(19, filler.getTop().num); vq.shutdown(); } /** * Verify getAtMost when SyncGeneration Policy = ALL */ - @Test(timeout=30000) + @Test public void testgetAtMostPolicyATLEAST_ONE() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq = @@ -204,7 +171,7 @@ public class TestValueQueue { /** * Verify getAtMost when SyncGeneration Policy = LOW_WATERMARK */ - @Test(timeout=30000) + @Test public void testgetAtMostPolicyLOW_WATERMARK() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq = @@ -221,7 +188,7 @@ public class TestValueQueue { vq.shutdown(); } - @Test(timeout=30000) + @Test public void testDrain() throws Exception { MockFiller filler = new MockFiller(); ValueQueue<String> vq =
