diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index a285ffef15..450ccfaa40 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -347,6 +347,9 @@ Release 2.5.0 - UNRELEASED HADOOP-10462. DF#getFilesystem is not parsing the command output. (Akira AJISAKA via umamahesh) + HADOOP-10468. TestMetricsSystemImpl.testMultiThreadedPublish fails + intermediately. (wheat9) + Release 2.4.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java index e4b5580536..2c236bc533 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsConfig.java @@ -85,7 +85,7 @@ class MetricsConfig extends SubsetConfiguration { private ClassLoader pluginLoader; MetricsConfig(Configuration c, String prefix) { - super(c, prefix.toLowerCase(Locale.US), "."); + super(c, prefix, "."); } static MetricsConfig create(String prefix) { diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java index 7294ee9c27..178719589b 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestGangliaMetrics.java @@ -60,11 +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, NumActiveSources") - .add("test.sink.ganglia.tagsForPrefix.none", ""); + .add("Test.sink.ganglia.tagsForPrefix.all", "*") + .add("Test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " + + "NumActiveSources") + .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 tags = new ArrayList(); tags.add(new MetricsTag(MsInfo.Context, "all")); @@ -97,8 +98,8 @@ public void testTagsForPrefix() throws Exception { @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"); diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java index 6d9024e3ab..49a54af599 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java @@ -88,11 +88,11 @@ public static class TestSink implements MetricsSink { 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 static class TestSink implements MetricsSink { 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(); @@ -167,12 +167,13 @@ public static class TestSink implements MetricsSink { } @Test public void testMultiThreadedPublish() throws Exception { + final int numThreads = 10; new ConfigBuilder().add("*.period", 80) - .add("test.sink.Collector.queue.capacity", "20") + .add("Test.sink.Collector." + MetricsConfig.QUEUE_CAPACITY_KEY, + numThreads) .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); final MetricsSystemImpl ms = new MetricsSystemImpl("Test"); ms.start(); - final int numThreads = 10; final CollectingSink sink = new CollectingSink(numThreads); ms.registerSink("Collector", "Collector of values from all threads.", sink); @@ -279,10 +280,10 @@ public void flush() { @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();