hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From junping...@apache.org
Subject hadoop git commit: HADOOP-10062. race condition in MetricsSystemImpl#publishMetricsNow that causes incorrect results. (Contributed by Sangjin Lee)
Date Thu, 05 Feb 2015 02:58:46 GMT
Repository: hadoop
Updated Branches:
  refs/heads/trunk 9112f093c -> 0b567f424


HADOOP-10062. race condition in MetricsSystemImpl#publishMetricsNow that causes incorrect
results.  (Contributed by Sangjin Lee)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0b567f42
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0b567f42
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0b567f42

Branch: refs/heads/trunk
Commit: 0b567f424673b5cea1c3bc23b2bd268ef6b7625f
Parents: 9112f09
Author: Junping Du <junping_du@apache.org>
Authored: Wed Feb 4 19:10:52 2015 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Wed Feb 4 19:10:52 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt                   | 3 +++
 .../java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java   | 2 +-
 .../org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java    | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b567f42/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index c229453..9d6989b 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -849,6 +849,9 @@ Release 2.7.0 - UNRELEASED
     HADOOP-11549. flaky test detection tool failed to handle special control
     characters in test result. (Yongjun Zhang via aajisaka)
 
+    HADOOP-10062. race condition in MetricsSystemImpl#publishMetricsNow that 
+    causes incorrect results. (Sangjin Lee via junping_du)
+
 Release 2.6.1 - UNRELEASED
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b567f42/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
index baa75ab..32b00f3 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java
@@ -384,7 +384,7 @@ public class MetricsSystemImpl extends MetricsSystem implements MetricsSource
{
    * Requests an immediate publish of all metrics from sources to sinks.
    */
   @Override
-  public void publishMetricsNow() {
+  public synchronized void publishMetricsNow() {
     if (sinks.size() > 0) {
       publishMetrics(sampleMetrics(), true);
     }    

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b567f42/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/impl/TestMetricsSystemImpl.java
----------------------------------------------------------------------
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 d59e80b..4c2ebc8 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
@@ -190,7 +190,7 @@ public class TestMetricsSystemImpl {
       threads[i] = new Thread(new Runnable() {
         private boolean safeAwait(int mySource, CyclicBarrier barrier) {
           try {
-            barrier1.await(2, TimeUnit.SECONDS);
+            barrier.await(2, TimeUnit.SECONDS);
           } catch (InterruptedException e) {
             results[mySource] = "Interrupted";
             return false;


Mime
View raw message