You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/12/05 22:49:52 UTC

[GitHub] [hudi] complone commented on a diff in pull request #7306: [HUDI-5280] Fix taskmanager concurrent registry

complone commented on code in PR #7306:
URL: https://github.com/apache/hudi/pull/7306#discussion_r1040184209


##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/client/transaction/lock/metrics/HoodieLockMetrics.java:
##########
@@ -70,11 +71,13 @@ private String getMetricsName(String metric) {
 
   private Timer createTimerForMetrics(MetricRegistry registry, String metric) {
     String metricName = getMetricsName(metric);
-    synchronized (REGISTRY_LOCK) {
-      if (registry.getMetrics().get(metricName) == null) {
-        lockDuration = new Timer(new SlidingWindowReservoir(keepLastNtimes));
-        registry.register(metricName, lockDuration);
-        return lockDuration;
+    if (registry.getMetrics().get(metricName) == null) {
+      synchronized (Registry.class) {
+        if (registry.getMetrics().get(metricName) == null) {

Review Comment:
   > 为什么`REGISTRY_LOCK`不能在这里正常工作,你能详细解释一下吗?
   
   I have updated the description



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@hudi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org