Github user yuqi1129 commented on a diff in the pull request:
https://github.com/apache/flink/pull/5959#discussion_r186603684
--- Diff:
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/ComponentMetricGroup.java
---
@@ -57,11 +57,12 @@ public ComponentMetricGroup(MetricRegistry registry,
String[] scope, P parent) {
if (variables == null) { // avoid synchronization for common
case
synchronized (this) {
if (variables == null) {
- variables = new HashMap<>();
- putVariables(variables);
+ Map<String, String> tmpVariables = new
HashMap<>();
+ putVariables(tmpVariables);
if (parent != null) { // not true for
Job-/TaskManagerMetricGroup
-
variables.putAll(parent.getAllVariables());
+
tmpVariables.putAll(parent.getAllVariables());
}
+ variables = tmpVariables;
--- End diff --
Do not need any test that verify this change ?
---