You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2014/06/02 17:46:06 UTC
svn commit: r1599247 -
/hive/trunk/common/src/test/org/apache/hadoop/hive/common/metrics/TestMetrics.java
Author: hashutosh
Date: Mon Jun 2 15:46:05 2014
New Revision: 1599247
URL: http://svn.apache.org/r1599247
Log:
HIVE-7154 : TestMetrics fails intermittently on the trunk (Szehon Ho via Ashutosh Chauhan)
Modified:
hive/trunk/common/src/test/org/apache/hadoop/hive/common/metrics/TestMetrics.java
Modified: hive/trunk/common/src/test/org/apache/hadoop/hive/common/metrics/TestMetrics.java
URL: http://svn.apache.org/viewvc/hive/trunk/common/src/test/org/apache/hadoop/hive/common/metrics/TestMetrics.java?rev=1599247&r1=1599246&r2=1599247&view=diff
==============================================================================
--- hive/trunk/common/src/test/org/apache/hadoop/hive/common/metrics/TestMetrics.java (original)
+++ hive/trunk/common/src/test/org/apache/hadoop/hive/common/metrics/TestMetrics.java Mon Jun 2 15:46:05 2014
@@ -197,6 +197,7 @@ public class TestMetrics {
@Test
public void testScopeConcurrency() throws Exception {
+ MetricsScope fooScope = Metrics.startScope(scopeName);
final int threads = 10;
ExecutorService executorService = Executors.newFixedThreadPool(threads);
for (int i=0; i<threads; i++) {
@@ -211,12 +212,13 @@ public class TestMetrics {
}
executorService.shutdown();
assertTrue(executorService.awaitTermination(periodMs * 3 * threads, TimeUnit.MILLISECONDS));
-
- final MetricsScope fooScope = Metrics.getScope(scopeName);
+
+ fooScope = Metrics.getScope(scopeName);
assertEquals(Long.valueOf(3 * threads), fooScope.getNumCounter());
assertTrue(fooScope.getTimeCounter().longValue() > 3 * periodMs * threads);
Double avgT = (Double)Metrics.get("foo.avg_t");
assertTrue(avgT.doubleValue() > periodMs);
+ Metrics.endScope(scopeName);
}
void testScopeImpl(int n) throws Exception {