hadoop git commit: HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki via Colin P. McCabe)
Repository: hadoop Updated Branches: refs/heads/branch-2 ca1208825 - 8dac24592 HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki via Colin P. McCabe) (cherry picked from commit 61dc2ea3fee4085b19cd2d01de9eacdc4c42e21f) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/8dac2459 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/8dac2459 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/8dac2459 Branch: refs/heads/branch-2 Commit: 8dac245920f41709dd6343873682f172fdbeb0a1 Parents: ca12088 Author: Colin Patrick Mccabe cmcc...@cloudera.com Authored: Thu Apr 9 11:28:02 2015 -0700 Committer: Colin Patrick Mccabe cmcc...@cloudera.com Committed: Thu Apr 9 11:42:00 2015 -0700 -- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 + .../org/apache/hadoop/tracing/TestTracing.java | 125 +++ 2 files changed, 45 insertions(+), 83 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/8dac2459/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index c38e0ed..2b1acf5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1126,6 +1126,9 @@ Release 2.7.0 - UNRELEASED HDFS-8025. Addendum fix for HDFS-3087 Decomissioning on NN restart can complete without blocks being replicated. (Ming Ma via wang) +HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki +via Colin P. McCabe) + BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS HDFS-7720. Quota by Storage Type API, tools and ClientNameNode http://git-wip-us.apache.org/repos/asf/hadoop/blob/8dac2459/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java index 01361b5..f6fef5a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java @@ -31,7 +31,7 @@ import org.apache.htrace.Span; import org.apache.htrace.SpanReceiver; import org.apache.htrace.Trace; import org.apache.htrace.TraceScope; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -56,27 +56,26 @@ public class TestTracing { private static SpanReceiverHost spanReceiverHost; @Test - public void testGetSpanReceiverHost() throws Exception { -Configuration c = new Configuration(); + public void testTracing() throws Exception { // getting instance already loaded. -c.set(SpanReceiverHost.SPAN_RECEIVERS_CONF_KEY, ); -SpanReceiverHost s = SpanReceiverHost.getInstance(c); -Assert.assertEquals(spanReceiverHost, s); +Assert.assertEquals(spanReceiverHost, +SpanReceiverHost.getInstance(new Configuration())); + +// write and read without tracing started +String fileName = testTracingDisabled.dat; +writeTestFile(fileName); +Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); +readTestFile(fileName); +Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); + +writeWithTracing(); +readWithTracing(); } - @Test - public void testWriteTraceHooks() throws Exception { + public void writeWithTracing() throws Exception { long startTime = System.currentTimeMillis(); TraceScope ts = Trace.startSpan(testWriteTraceHooks, Sampler.ALWAYS); -Path file = new Path(traceWriteTest.dat); -FSDataOutputStream stream = dfs.create(file); - -for (int i = 0; i 10; i++) { - byte[] data = RandomStringUtils.randomAlphabetic(102400).getBytes(); - stream.write(data); -} -stream.hflush(); -stream.close(); +writeTestFile(testWriteTraceHooks.dat); long endTime = System.currentTimeMillis(); ts.close(); @@ -125,55 +124,17 @@ public class TestTracing { Assert.assertEquals(ts.getSpan().getTraceId(), span.getTraceId()); } } +SetSpanReceiver.SetHolder.spans.clear(); } - @Test - public void testWriteWithoutTraceHooks() throws Exception { -Path file = new Path(withoutTraceWriteTest.dat); -FSDataOutputStream stream = dfs.create(file); -for (int i = 0; i 10; i++) { - byte[] data = RandomStringUtils.randomAlphabetic(102400).getBytes(); - stream.write(data); -} -stream.hflush(); -
hadoop git commit: HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki via Colin P. McCabe)
Repository: hadoop Updated Branches: refs/heads/branch-2.7 d665d11f9 - 4d5b1fbde HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki via Colin P. McCabe) (cherry picked from commit 61dc2ea3fee4085b19cd2d01de9eacdc4c42e21f) (cherry picked from commit 8dac245920f41709dd6343873682f172fdbeb0a1) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4d5b1fbd Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4d5b1fbd Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4d5b1fbd Branch: refs/heads/branch-2.7 Commit: 4d5b1fbdec9c6ad16f2068940df178362f27393e Parents: d665d11 Author: Colin Patrick Mccabe cmcc...@cloudera.com Authored: Thu Apr 9 11:28:02 2015 -0700 Committer: Colin Patrick Mccabe cmcc...@cloudera.com Committed: Thu Apr 9 11:42:29 2015 -0700 -- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 + .../org/apache/hadoop/tracing/TestTracing.java | 125 +++ 2 files changed, 45 insertions(+), 83 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d5b1fbd/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 2abc8a8..bc24dd5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -974,6 +974,9 @@ Release 2.7.0 - UNRELEASED HDFS-8025. Addendum fix for HDFS-3087 Decomissioning on NN restart can complete without blocks being replicated. (Ming Ma via wang) +HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki +via Colin P. McCabe) + BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS HDFS-7720. Quota by Storage Type API, tools and ClientNameNode http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d5b1fbd/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java index 3720abe..dc71514 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java @@ -31,7 +31,7 @@ import org.apache.htrace.Span; import org.apache.htrace.SpanReceiver; import org.apache.htrace.Trace; import org.apache.htrace.TraceScope; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -56,27 +56,26 @@ public class TestTracing { private static SpanReceiverHost spanReceiverHost; @Test - public void testGetSpanReceiverHost() throws Exception { -Configuration c = new Configuration(); + public void testTracing() throws Exception { // getting instance already loaded. -c.set(SpanReceiverHost.SPAN_RECEIVERS_CONF_KEY, ); -SpanReceiverHost s = SpanReceiverHost.getInstance(c); -Assert.assertEquals(spanReceiverHost, s); +Assert.assertEquals(spanReceiverHost, +SpanReceiverHost.getInstance(new Configuration())); + +// write and read without tracing started +String fileName = testTracingDisabled.dat; +writeTestFile(fileName); +Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); +readTestFile(fileName); +Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); + +writeWithTracing(); +readWithTracing(); } - @Test - public void testWriteTraceHooks() throws Exception { + public void writeWithTracing() throws Exception { long startTime = System.currentTimeMillis(); TraceScope ts = Trace.startSpan(testWriteTraceHooks, Sampler.ALWAYS); -Path file = new Path(traceWriteTest.dat); -FSDataOutputStream stream = dfs.create(file); - -for (int i = 0; i 10; i++) { - byte[] data = RandomStringUtils.randomAlphabetic(102400).getBytes(); - stream.write(data); -} -stream.hflush(); -stream.close(); +writeTestFile(testWriteTraceHooks.dat); long endTime = System.currentTimeMillis(); ts.close(); @@ -125,55 +124,17 @@ public class TestTracing { Assert.assertEquals(ts.getSpan().getTraceId(), span.getTraceId()); } } +SetSpanReceiver.SetHolder.spans.clear(); } - @Test - public void testWriteWithoutTraceHooks() throws Exception { -Path file = new Path(withoutTraceWriteTest.dat); -FSDataOutputStream stream = dfs.create(file); -for (int i = 0; i 10; i++) { - byte[] data =
hadoop git commit: HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki via Colin P. McCabe)
Repository: hadoop Updated Branches: refs/heads/trunk 30acb7372 - 61dc2ea3f HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki via Colin P. McCabe) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/61dc2ea3 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/61dc2ea3 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/61dc2ea3 Branch: refs/heads/trunk Commit: 61dc2ea3fee4085b19cd2d01de9eacdc4c42e21f Parents: 30acb73 Author: Colin Patrick Mccabe cmcc...@cloudera.com Authored: Thu Apr 9 11:28:02 2015 -0700 Committer: Colin Patrick Mccabe cmcc...@cloudera.com Committed: Thu Apr 9 11:28:02 2015 -0700 -- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 + .../org/apache/hadoop/tracing/TestTracing.java | 125 +++ 2 files changed, 45 insertions(+), 83 deletions(-) -- http://git-wip-us.apache.org/repos/asf/hadoop/blob/61dc2ea3/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 59cab03..4b22fa4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1427,6 +1427,9 @@ Release 2.7.0 - UNRELEASED HDFS-8072. Reserved RBW space is not released if client terminates while writing block. (Arpit Agarwal) +HDFS-8063: Fix intermittent test failures in TestTracing (Masatake Iwasaki +via Colin P. McCabe) + BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS HDFS-7720. Quota by Storage Type API, tools and ClientNameNode http://git-wip-us.apache.org/repos/asf/hadoop/blob/61dc2ea3/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java -- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java index 01361b5..f6fef5a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/tracing/TestTracing.java @@ -31,7 +31,7 @@ import org.apache.htrace.Span; import org.apache.htrace.SpanReceiver; import org.apache.htrace.Trace; import org.apache.htrace.TraceScope; -import org.junit.AfterClass; +import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; @@ -56,27 +56,26 @@ public class TestTracing { private static SpanReceiverHost spanReceiverHost; @Test - public void testGetSpanReceiverHost() throws Exception { -Configuration c = new Configuration(); + public void testTracing() throws Exception { // getting instance already loaded. -c.set(SpanReceiverHost.SPAN_RECEIVERS_CONF_KEY, ); -SpanReceiverHost s = SpanReceiverHost.getInstance(c); -Assert.assertEquals(spanReceiverHost, s); +Assert.assertEquals(spanReceiverHost, +SpanReceiverHost.getInstance(new Configuration())); + +// write and read without tracing started +String fileName = testTracingDisabled.dat; +writeTestFile(fileName); +Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); +readTestFile(fileName); +Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); + +writeWithTracing(); +readWithTracing(); } - @Test - public void testWriteTraceHooks() throws Exception { + public void writeWithTracing() throws Exception { long startTime = System.currentTimeMillis(); TraceScope ts = Trace.startSpan(testWriteTraceHooks, Sampler.ALWAYS); -Path file = new Path(traceWriteTest.dat); -FSDataOutputStream stream = dfs.create(file); - -for (int i = 0; i 10; i++) { - byte[] data = RandomStringUtils.randomAlphabetic(102400).getBytes(); - stream.write(data); -} -stream.hflush(); -stream.close(); +writeTestFile(testWriteTraceHooks.dat); long endTime = System.currentTimeMillis(); ts.close(); @@ -125,55 +124,17 @@ public class TestTracing { Assert.assertEquals(ts.getSpan().getTraceId(), span.getTraceId()); } } +SetSpanReceiver.SetHolder.spans.clear(); } - @Test - public void testWriteWithoutTraceHooks() throws Exception { -Path file = new Path(withoutTraceWriteTest.dat); -FSDataOutputStream stream = dfs.create(file); -for (int i = 0; i 10; i++) { - byte[] data = RandomStringUtils.randomAlphabetic(102400).getBytes(); - stream.write(data); -} -stream.hflush(); -stream.close(); -Assert.assertTrue(SetSpanReceiver.SetHolder.size() == 0); - } - - @Test - public void