hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [1/5] hbase git commit: HBASE-20670 NPE in HMaster#isInMaintenanceMode
Date Mon, 04 Jun 2018 22:20:20 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1 3ea999d95 -> 409531209
  refs/heads/branch-1.4 95e5dee54 -> 8c4a66fc5
  refs/heads/branch-2 3673e54a4 -> d7b09de85
  refs/heads/branch-2.0 1661543c1 -> 71b8e03a5
  refs/heads/master 832f67d48 -> a45763df5


HBASE-20670 NPE in HMaster#isInMaintenanceMode


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

Branch: refs/heads/branch-2.0
Commit: 71b8e03a582f7229ff4ddc4b90c76c8503522008
Parents: 1661543
Author: Andrew Purtell <apurtell@apache.org>
Authored: Fri Jun 1 15:22:18 2018 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Mon Jun 4 13:02:44 2018 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/master/HMaster.java | 25 ++++++++++++++++----
 .../hadoop/hbase/master/MasterRpcServices.java  |  6 ++++-
 .../hadoop/hbase/master/MasterServices.java     |  3 ++-
 3 files changed, 27 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/71b8e03a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index d29ac70..214a02e 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -2796,7 +2796,10 @@ public class HMaster extends HRegionServer implements MasterServices
{
    * @return true if master is in maintenanceMode
    */
   @Override
-  public boolean isInMaintenanceMode() {
+  public boolean isInMaintenanceMode() throws IOException {
+    if (!isInitialized()) {
+      throw new PleaseHoldException("Master is initializing");
+    }
     return maintenanceModeTracker.isInMaintenanceMode();
   }
 
@@ -3333,7 +3336,11 @@ public class HMaster extends HRegionServer implements MasterServices
{
    * @return The state of the load balancer, or false if the load balancer isn't defined.
    */
   public boolean isBalancerOn() {
-    if (null == loadBalancerTracker || isInMaintenanceMode()) {
+    try {
+      if (null == loadBalancerTracker || isInMaintenanceMode()) {
+        return false;
+      }
+    } catch (IOException e) {
       return false;
     }
     return loadBalancerTracker.isBalancerOn();
@@ -3344,8 +3351,12 @@ public class HMaster extends HRegionServer implements MasterServices
{
    * false is returned.
    */
   public boolean isNormalizerOn() {
-    return (null == regionNormalizerTracker || isInMaintenanceMode()) ?
-        false: regionNormalizerTracker.isNormalizerOn();
+    try {
+      return (null == regionNormalizerTracker || isInMaintenanceMode()) ?
+          false: regionNormalizerTracker.isNormalizerOn();
+    } catch (IOException e) {
+      return false;
+    }
   }
 
   /**
@@ -3356,7 +3367,11 @@ public class HMaster extends HRegionServer implements MasterServices
{
    */
   @Override
   public boolean isSplitOrMergeEnabled(MasterSwitchType switchType) {
-    if (null == splitOrMergeTracker || isInMaintenanceMode()) {
+    try {
+      if (null == splitOrMergeTracker || isInMaintenanceMode()) {
+        return false;
+      }
+    } catch (IOException e) {
       return false;
     }
     return splitOrMergeTracker.isSplitOrMergeEnabled(switchType);

http://git-wip-us.apache.org/repos/asf/hbase/blob/71b8e03a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
index 257e99b..0651189 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterRpcServices.java
@@ -1485,7 +1485,11 @@ public class MasterRpcServices extends RSRpcServices
       final RpcController controller,
       final IsInMaintenanceModeRequest request) throws ServiceException {
     IsInMaintenanceModeResponse.Builder response = IsInMaintenanceModeResponse.newBuilder();
-    response.setInMaintenanceMode(master.isInMaintenanceMode());
+    try {
+      response.setInMaintenanceMode(master.isInMaintenanceMode());
+    } catch (IOException e) {
+      throw new ServiceException(e);
+    }
     return response.build();
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/71b8e03a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
index 349946c..11f5975 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterServices.java
@@ -353,8 +353,9 @@ public interface MasterServices extends Server {
 
   /**
    * @return true if master is in maintanceMode
+   * @throws IOException if the inquiry failed due to an IO problem
    */
-  boolean isInMaintenanceMode();
+  boolean isInMaintenanceMode() throws IOException;
 
   /**
    * Abort a procedure.


Mime
View raw message