Author: jlowe Date: Tue Jul 15 20:00:54 2014 New Revision: 1610831 URL: http://svn.apache.org/r1610831 Log: svn merge -c 1610829 FIXES: Addendum patch for HADOOP-10468 TestMetricsSystemImpl.testMultiThreadedPublish fails intermediately. Contributed by Akira AJISAKA
Modified: hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java Modified: hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java?rev=1610831&r1=1610830&r2=1610831&view=diff ============================================================================== --- hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java (original) +++ hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java Tue Jul 15 20:00:54 2014 @@ -85,7 +85,7 @@ class MetricsConfig extends SubsetConfig private ClassLoader pluginLoader; MetricsConfig(Configuration c, String prefix) { - super(c, prefix, "."); + super(c, prefix.toLowerCase(Locale.US), "."); } static MetricsConfig create(String prefix) { Modified: hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java?rev=1610831&r1=1610830&r2=1610831&view=diff ============================================================================== --- hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java (original) +++ hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java Tue Jul 15 20:00:54 2014 @@ -60,12 +60,12 @@ public class TestGangliaMetrics { @Test public void testTagsForPrefix() throws Exception { ConfigBuilder cb = new ConfigBuilder() - .add("Test.sink.ganglia.tagsForPrefix.all", "*") - .add("Test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " + + .add("test.sink.ganglia.tagsForPrefix.all", "*") + .add("test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " + "NumActiveSources") - .add("Test.sink.ganglia.tagsForPrefix.none", ""); + .add("test.sink.ganglia.tagsForPrefix.none", ""); GangliaSink30 sink = new GangliaSink30(); - sink.init(cb.subset("Test.sink.ganglia")); + sink.init(cb.subset("test.sink.ganglia")); List<MetricsTag> tags = new ArrayList<MetricsTag>(); tags.add(new MetricsTag(MsInfo.Context, "all")); @@ -98,8 +98,8 @@ public class TestGangliaMetrics { @Test public void testGangliaMetrics2() throws Exception { ConfigBuilder cb = new ConfigBuilder().add("default.period", 10) - .add("Test.sink.gsink30.context", "test") // filter out only "test" - .add("Test.sink.gsink31.context", "test") // filter out only "test" + .add("test.sink.gsink30.context", "test") // filter out only "test" + .add("test.sink.gsink31.context", "test") // filter out only "test" .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); MetricsSystemImpl ms = new MetricsSystemImpl("Test"); Modified: hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java?rev=1610831&r1=1610830&r2=1610831&view=diff ============================================================================== --- hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java (original) +++ hadoop/common/branches/branch-2.5/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java Tue Jul 15 20:00:54 2014 @@ -88,11 +88,11 @@ public class TestMetricsSystemImpl { DefaultMetricsSystem.shutdown(); new ConfigBuilder().add("*.period", 8) //.add("test.sink.plugin.urls", getPluginUrlsAsString()) - .add("Test.sink.test.class", TestSink.class.getName()) - .add("Test.*.source.filter.exclude", "s0") - .add("Test.source.s1.metric.filter.exclude", "X*") - .add("Test.sink.sink1.metric.filter.exclude", "Y*") - .add("Test.sink.sink2.metric.filter.exclude", "Y*") + .add("test.sink.test.class", TestSink.class.getName()) + .add("test.*.source.filter.exclude", "s0") + .add("test.source.s1.metric.filter.exclude", "X*") + .add("test.sink.sink1.metric.filter.exclude", "Y*") + .add("test.sink.sink2.metric.filter.exclude", "Y*") .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); MetricsSystemImpl ms = new MetricsSystemImpl("Test"); ms.start(); @@ -130,11 +130,11 @@ public class TestMetricsSystemImpl { DefaultMetricsSystem.shutdown(); new ConfigBuilder().add("*.period", 8) //.add("test.sink.plugin.urls", getPluginUrlsAsString()) - .add("Test.sink.test.class", TestSink.class.getName()) - .add("Test.*.source.filter.exclude", "s0") - .add("Test.source.s1.metric.filter.exclude", "X*") - .add("Test.sink.sink1.metric.filter.exclude", "Y*") - .add("Test.sink.sink2.metric.filter.exclude", "Y*") + .add("test.sink.test.class", TestSink.class.getName()) + .add("test.*.source.filter.exclude", "s0") + .add("test.source.s1.metric.filter.exclude", "X*") + .add("test.sink.sink1.metric.filter.exclude", "Y*") + .add("test.sink.sink2.metric.filter.exclude", "Y*") .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); MetricsSystemImpl ms = new MetricsSystemImpl("Test"); ms.start(); @@ -169,13 +169,14 @@ public class TestMetricsSystemImpl { @Test public void testMultiThreadedPublish() throws Exception { final int numThreads = 10; new ConfigBuilder().add("*.period", 80) - .add("Test.sink.Collector." + MetricsConfig.QUEUE_CAPACITY_KEY, + .add("test.sink.collector." + MetricsConfig.QUEUE_CAPACITY_KEY, numThreads) .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); final MetricsSystemImpl ms = new MetricsSystemImpl("Test"); ms.start(); + final CollectingSink sink = new CollectingSink(numThreads); - ms.registerSink("Collector", + ms.registerSink("collector", "Collector of values from all threads.", sink); final TestSource[] sources = new TestSource[numThreads]; final Thread[] threads = new Thread[numThreads]; @@ -280,10 +281,10 @@ public class TestMetricsSystemImpl { @Test public void testHangingSink() { new ConfigBuilder().add("*.period", 8) - .add("Test.sink.test.class", TestSink.class.getName()) - .add("Test.sink.hanging.retry.delay", "1") - .add("Test.sink.hanging.retry.backoff", "1.01") - .add("Test.sink.hanging.retry.count", "0") + .add("test.sink.test.class", TestSink.class.getName()) + .add("test.sink.hanging.retry.delay", "1") + .add("test.sink.hanging.retry.backoff", "1.01") + .add("test.sink.hanging.retry.count", "0") .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); MetricsSystemImpl ms = new MetricsSystemImpl("Test"); ms.start();