HADOOP-10468. Merge r1585659 from trunk.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1585660 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Haohui Mai 2014-04-08 08:21:03 +00:00
parent 02beaa7b18
commit 1c0b72e807
4 changed files with 28 additions and 23 deletions

View File

@ -42,6 +42,9 @@ Release 2.5.0 - UNRELEASED
HADOOP-10462. DF#getFilesystem is not parsing the command output. HADOOP-10462. DF#getFilesystem is not parsing the command output.
(Akira AJISAKA via umamahesh) (Akira AJISAKA via umamahesh)
HADOOP-10468. TestMetricsSystemImpl.testMultiThreadedPublish fails
intermediately. (wheat9)
Release 2.4.1 - UNRELEASED Release 2.4.1 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -85,7 +85,7 @@ class MetricsConfig extends SubsetConfiguration {
private ClassLoader pluginLoader; private ClassLoader pluginLoader;
MetricsConfig(Configuration c, String prefix) { MetricsConfig(Configuration c, String prefix) {
super(c, prefix.toLowerCase(Locale.US), "."); super(c, prefix, ".");
} }
static MetricsConfig create(String prefix) { static MetricsConfig create(String prefix) {

View File

@ -60,11 +60,12 @@ public class TestGangliaMetrics {
@Test @Test
public void testTagsForPrefix() throws Exception { public void testTagsForPrefix() throws Exception {
ConfigBuilder cb = new ConfigBuilder() ConfigBuilder cb = new ConfigBuilder()
.add("test.sink.ganglia.tagsForPrefix.all", "*") .add("Test.sink.ganglia.tagsForPrefix.all", "*")
.add("test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, NumActiveSources") .add("Test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " +
.add("test.sink.ganglia.tagsForPrefix.none", ""); "NumActiveSources")
.add("Test.sink.ganglia.tagsForPrefix.none", "");
GangliaSink30 sink = new GangliaSink30(); GangliaSink30 sink = new GangliaSink30();
sink.init(cb.subset("test.sink.ganglia")); sink.init(cb.subset("Test.sink.ganglia"));
List<MetricsTag> tags = new ArrayList<MetricsTag>(); List<MetricsTag> tags = new ArrayList<MetricsTag>();
tags.add(new MetricsTag(MsInfo.Context, "all")); tags.add(new MetricsTag(MsInfo.Context, "all"));
@ -97,8 +98,8 @@ public class TestGangliaMetrics {
@Test public void testGangliaMetrics2() throws Exception { @Test public void testGangliaMetrics2() throws Exception {
ConfigBuilder cb = new ConfigBuilder().add("default.period", 10) ConfigBuilder cb = new ConfigBuilder().add("default.period", 10)
.add("test.sink.gsink30.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" .add("Test.sink.gsink31.context", "test") // filter out only "test"
.save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));
MetricsSystemImpl ms = new MetricsSystemImpl("Test"); MetricsSystemImpl ms = new MetricsSystemImpl("Test");

View File

@ -88,11 +88,11 @@ public class TestMetricsSystemImpl {
DefaultMetricsSystem.shutdown(); DefaultMetricsSystem.shutdown();
new ConfigBuilder().add("*.period", 8) new ConfigBuilder().add("*.period", 8)
//.add("test.sink.plugin.urls", getPluginUrlsAsString()) //.add("test.sink.plugin.urls", getPluginUrlsAsString())
.add("test.sink.test.class", TestSink.class.getName()) .add("Test.sink.test.class", TestSink.class.getName())
.add("test.*.source.filter.exclude", "s0") .add("Test.*.source.filter.exclude", "s0")
.add("test.source.s1.metric.filter.exclude", "X*") .add("Test.source.s1.metric.filter.exclude", "X*")
.add("test.sink.sink1.metric.filter.exclude", "Y*") .add("Test.sink.sink1.metric.filter.exclude", "Y*")
.add("test.sink.sink2.metric.filter.exclude", "Y*") .add("Test.sink.sink2.metric.filter.exclude", "Y*")
.save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));
MetricsSystemImpl ms = new MetricsSystemImpl("Test"); MetricsSystemImpl ms = new MetricsSystemImpl("Test");
ms.start(); ms.start();
@ -130,11 +130,11 @@ public class TestMetricsSystemImpl {
DefaultMetricsSystem.shutdown(); DefaultMetricsSystem.shutdown();
new ConfigBuilder().add("*.period", 8) new ConfigBuilder().add("*.period", 8)
//.add("test.sink.plugin.urls", getPluginUrlsAsString()) //.add("test.sink.plugin.urls", getPluginUrlsAsString())
.add("test.sink.test.class", TestSink.class.getName()) .add("Test.sink.test.class", TestSink.class.getName())
.add("test.*.source.filter.exclude", "s0") .add("Test.*.source.filter.exclude", "s0")
.add("test.source.s1.metric.filter.exclude", "X*") .add("Test.source.s1.metric.filter.exclude", "X*")
.add("test.sink.sink1.metric.filter.exclude", "Y*") .add("Test.sink.sink1.metric.filter.exclude", "Y*")
.add("test.sink.sink2.metric.filter.exclude", "Y*") .add("Test.sink.sink2.metric.filter.exclude", "Y*")
.save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));
MetricsSystemImpl ms = new MetricsSystemImpl("Test"); MetricsSystemImpl ms = new MetricsSystemImpl("Test");
ms.start(); ms.start();
@ -167,12 +167,13 @@ public class TestMetricsSystemImpl {
} }
@Test public void testMultiThreadedPublish() throws Exception { @Test public void testMultiThreadedPublish() throws Exception {
final int numThreads = 10;
new ConfigBuilder().add("*.period", 80) 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")); .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));
final MetricsSystemImpl ms = new MetricsSystemImpl("Test"); final MetricsSystemImpl ms = new MetricsSystemImpl("Test");
ms.start(); ms.start();
final int numThreads = 10;
final CollectingSink sink = new CollectingSink(numThreads); final CollectingSink sink = new CollectingSink(numThreads);
ms.registerSink("Collector", ms.registerSink("Collector",
"Collector of values from all threads.", sink); "Collector of values from all threads.", sink);
@ -279,10 +280,10 @@ public class TestMetricsSystemImpl {
@Test public void testHangingSink() { @Test public void testHangingSink() {
new ConfigBuilder().add("*.period", 8) new ConfigBuilder().add("*.period", 8)
.add("test.sink.test.class", TestSink.class.getName()) .add("Test.sink.test.class", TestSink.class.getName())
.add("test.sink.hanging.retry.delay", "1") .add("Test.sink.hanging.retry.delay", "1")
.add("test.sink.hanging.retry.backoff", "1.01") .add("Test.sink.hanging.retry.backoff", "1.01")
.add("test.sink.hanging.retry.count", "0") .add("Test.sink.hanging.retry.count", "0")
.save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test")); .save(TestMetricsConfig.getTestFilename("hadoop-metrics2-test"));
MetricsSystemImpl ms = new MetricsSystemImpl("Test"); MetricsSystemImpl ms = new MetricsSystemImpl("Test");
ms.start(); ms.start();