hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From te...@apache.org
Subject hbase git commit: HBASE-20917 MetaTableMetrics#stop references uninitialized requestsMap for non-meta region
Date Mon, 23 Jul 2018 03:51:08 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 4613f3e8c -> 37de961f2


HBASE-20917 MetaTableMetrics#stop references uninitialized requestsMap for non-meta region


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/37de961f
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/37de961f
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/37de961f

Branch: refs/heads/master
Commit: 37de961f2041f55e90ff9db5fb0aa83308c92515
Parents: 4613f3e
Author: tedyu <yuzhihong@gmail.com>
Authored: Sun Jul 22 20:50:51 2018 -0700
Committer: tedyu <yuzhihong@gmail.com>
Committed: Sun Jul 22 20:50:51 2018 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/coprocessor/MetaTableMetrics.java   | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/37de961f/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MetaTableMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MetaTableMetrics.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MetaTableMetrics.java
index 9bf35c0..64a6288 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MetaTableMetrics.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MetaTableMetrics.java
@@ -309,9 +309,8 @@ public class MetaTableMetrics implements RegionCoprocessor {
   public void start(CoprocessorEnvironment env) throws IOException {
     if (env instanceof RegionCoprocessorEnvironment
         && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable() != null
-        && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable().getName()
!= null
-        && new String(((RegionCoprocessorEnvironment) env).getRegionInfo().getTable().getName(),
-          StandardCharsets.UTF_8).equals(TableName.META_TABLE_NAME.toString())) {
+        && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable()
+          .equals(TableName.META_TABLE_NAME)) {
       regionCoprocessorEnv = (RegionCoprocessorEnvironment) env;
       observer = new ExampleRegionObserverMeta();
       requestsMap = new ConcurrentHashMap<>();
@@ -324,11 +323,13 @@ public class MetaTableMetrics implements RegionCoprocessor {
   }
 
   @Override
-  public void stop(CoprocessorEnvironment e) throws IOException {
+  public void stop(CoprocessorEnvironment env) throws IOException {
     // since meta region can move around, clear stale metrics when stop.
-    for (String meterName : requestsMap.keySet()) {
-      MetricRegistry registry = regionCoprocessorEnv.getMetricRegistryForRegionServer();
-      registry.remove(meterName);
+    if (requestsMap != null) {
+      for (String meterName : requestsMap.keySet()) {
+        MetricRegistry registry = regionCoprocessorEnv.getMetricRegistryForRegionServer();
+        registry.remove(meterName);
+      }
     }
   }
 


Mime
View raw message