You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/09/19 10:40:39 UTC
[GitHub] [flink] maqingxiang commented on a change in pull request #9697:
[FLINK-14094] [runtime] [metric] Fix OperatorIOMetricGroup repeat register
problem
maqingxiang commented on a change in pull request #9697: [FLINK-14094] [runtime] [metric] Fix OperatorIOMetricGroup repeat register problem
URL: https://github.com/apache/flink/pull/9697#discussion_r326106556
##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/TaskMetricGroup.java
##########
@@ -143,20 +143,17 @@ public OperatorMetricGroup getOrAddOperator(OperatorID operatorID, String name)
LOG.warn("The operator name {} exceeded the {} characters length limit and was truncated.", name, METRICS_OPERATOR_NAME_MAX_LENGTH);
name = name.substring(0, METRICS_OPERATOR_NAME_MAX_LENGTH);
}
- OperatorMetricGroup operator = new OperatorMetricGroup(this.registry, this, operatorID, name);
+
// unique OperatorIDs only exist in streaming, so we have to rely on the name for batch operators
final String key = operatorID + name;
+ if (operators.containsKey(key)) {
+ return operators.get(key);
+ }
+ OperatorMetricGroup operator = new OperatorMetricGroup(this.registry, this, operatorID, name);
synchronized (this) {
- OperatorMetricGroup previous = operators.put(key, operator);
- if (previous == null) {
- // no operator group so far
- return operator;
- } else {
- // already had an operator group. restore that one.
- operators.put(key, previous);
- return previous;
- }
+ operators.put(key, operator);
+ return operator;
Review comment:
Thanks for your review @tillrohrmann. I had improved it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services