Addendum patch for HADOOP-10468 TestMetricsSystemImpl.testMultiThreadedPublish fails intermediately. Contributed by Akira AJISAKA
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1610829 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
317542f51f
commit
4dcc08b656
|
@ -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, ".");
|
super(c, prefix.toLowerCase(Locale.US), ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetricsConfig create(String prefix) {
|
static MetricsConfig create(String prefix) {
|
||||||
|
|
|
@ -60,12 +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, " +
|
.add("test.sink.ganglia.tagsForPrefix.some", "NumActiveSinks, " +
|
||||||
"NumActiveSources")
|
"NumActiveSources")
|
||||||
.add("Test.sink.ganglia.tagsForPrefix.none", "");
|
.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"));
|
||||||
|
@ -98,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");
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -169,13 +169,14 @@ public class TestMetricsSystemImpl {
|
||||||
@Test public void testMultiThreadedPublish() throws Exception {
|
@Test public void testMultiThreadedPublish() throws Exception {
|
||||||
final int numThreads = 10;
|
final int numThreads = 10;
|
||||||
new ConfigBuilder().add("*.period", 80)
|
new ConfigBuilder().add("*.period", 80)
|
||||||
.add("Test.sink.Collector." + MetricsConfig.QUEUE_CAPACITY_KEY,
|
.add("test.sink.collector." + MetricsConfig.QUEUE_CAPACITY_KEY,
|
||||||
numThreads)
|
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 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);
|
||||||
final TestSource[] sources = new TestSource[numThreads];
|
final TestSource[] sources = new TestSource[numThreads];
|
||||||
final Thread[] threads = new Thread[numThreads];
|
final Thread[] threads = new Thread[numThreads];
|
||||||
|
@ -280,10 +281,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();
|
||||||
|
|
Loading…
Reference in New Issue