HADOOP-10062. race condition in MetricsSystemImpl#publishMetricsNow that causes incorrect results. (Contributed by Sangjin Lee)
This commit is contained in:
parent
9112f093cd
commit
0b567f4246
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue