danny0405 commented on code in PR #7306:
URL: https://github.com/apache/hudi/pull/7306#discussion_r1037758501
##########
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:
Why the `REGISTRY_LOCK` can not work correctly here, can you elaborate the
explanation then ?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]