You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bb...@apache.org on 2023/03/31 13:17:59 UTC

[hbase] branch branch-2 updated: HBASE-27758 Inconsistent synchronization in MetricsUserSourceImpl (#5149)

This is an automated email from the ASF dual-hosted git repository.

bbeaudreault pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new cc00b8b8a85 HBASE-27758 Inconsistent synchronization in MetricsUserSourceImpl (#5149)
cc00b8b8a85 is described below

commit cc00b8b8a852fffddb46e7b25459bb3c6e6c9313
Author: Bryan Beaudreault <bb...@apache.org>
AuthorDate: Fri Mar 31 08:10:58 2023 -0400

    HBASE-27758 Inconsistent synchronization in MetricsUserSourceImpl (#5149)
    
    Signed-off-by: Duo Zhang <zh...@apache.org>
---
 .../hbase/regionserver/MetricsUserSourceImpl.java  | 36 ++++++++++------------
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java
index 7985967c047..65dfaafe522 100644
--- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java
+++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java
@@ -137,16 +137,14 @@ public class MetricsUserSourceImpl implements MetricsUserSource {
 
   @Override
   public void register() {
-    synchronized (this) {
-      getHisto = registry.newTimeHistogram(userGetKey);
-      scanTimeHisto = registry.newTimeHistogram(userScanTimeKey);
-      putHisto = registry.newTimeHistogram(userPutKey);
-      deleteHisto = registry.newTimeHistogram(userDeleteKey);
-      incrementHisto = registry.newTimeHistogram(userIncrementKey);
-      appendHisto = registry.newTimeHistogram(userAppendKey);
-      replayHisto = registry.newTimeHistogram(userReplayKey);
-      blockBytesScannedCount = registry.newCounter(userBlockBytesScannedKey, "", 0);
-    }
+    getHisto = registry.newTimeHistogram(userGetKey);
+    scanTimeHisto = registry.newTimeHistogram(userScanTimeKey);
+    putHisto = registry.newTimeHistogram(userPutKey);
+    deleteHisto = registry.newTimeHistogram(userDeleteKey);
+    incrementHisto = registry.newTimeHistogram(userIncrementKey);
+    appendHisto = registry.newTimeHistogram(userAppendKey);
+    replayHisto = registry.newTimeHistogram(userReplayKey);
+    blockBytesScannedCount = registry.newCounter(userBlockBytesScannedKey, "", 0);
   }
 
   @Override
@@ -162,16 +160,14 @@ public class MetricsUserSourceImpl implements MetricsUserSource {
       LOG.debug("Removing user Metrics for user: " + user);
     }
 
-    synchronized (this) {
-      registry.removeMetric(userGetKey);
-      registry.removeMetric(userScanTimeKey);
-      registry.removeMetric(userPutKey);
-      registry.removeMetric(userDeleteKey);
-      registry.removeMetric(userIncrementKey);
-      registry.removeMetric(userAppendKey);
-      registry.removeMetric(userReplayKey);
-      registry.removeMetric(userBlockBytesScannedKey);
-    }
+    registry.removeMetric(userGetKey);
+    registry.removeMetric(userScanTimeKey);
+    registry.removeMetric(userPutKey);
+    registry.removeMetric(userDeleteKey);
+    registry.removeMetric(userIncrementKey);
+    registry.removeMetric(userAppendKey);
+    registry.removeMetric(userReplayKey);
+    registry.removeMetric(userBlockBytesScannedKey);
   }
 
   @Override