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

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


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

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

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

diff --git 
a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java
 
b/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java
index 7985967c047..65dfaafe522 100644
--- 
a/hbase-hadoop-compat/src/main/java/org/apache/hadoop/hbase/regionserver/MetricsUserSourceImpl.java
+++ 
b/hbase-hadoop-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

Reply via email to