You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bi...@apache.org on 2019/11/08 01:57:14 UTC

[hbase] branch branch-2.2 updated: HBASE-23263 NPE in Quotas.jsp (#800)

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

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


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 9571578  HBASE-23263 NPE in Quotas.jsp (#800)
9571578 is described below

commit 95715787afcbf66525d7a9cb26573416d8380be0
Author: Karthik Palanisamy <kp...@hortonworks.com>
AuthorDate: Thu Nov 7 17:55:57 2019 -0800

    HBASE-23263 NPE in Quotas.jsp (#800)
    
    Signed-off-by: Guangxu Cheng <gu...@gmail.com>
---
 .../main/resources/hbase-webapps/master/quotas.jsp | 33 ++++++++++++++--------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp b/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp
index 4909ab6..780a8d4 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/quotas.jsp
@@ -23,6 +23,7 @@
   import="java.util.List"
   import="org.apache.hadoop.conf.Configuration"
   import="org.apache.hadoop.hbase.master.HMaster"
+  import="org.apache.hadoop.hbase.quotas.MasterQuotaManager"
   import="org.apache.hadoop.hbase.quotas.QuotaRetriever"
   import="org.apache.hadoop.hbase.quotas.QuotaSettings"
   import="org.apache.hadoop.hbase.quotas.ThrottleSettings"
@@ -31,20 +32,24 @@
   HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
   Configuration conf = master.getConfiguration();
   pageContext.setAttribute("pageTitle", "HBase Master Quotas: " + master.getServerName());
-  boolean exceedThrottleQuotaEnabled = master.getMasterQuotaManager().isExceedThrottleQuotaEnabled();
   List<ThrottleSettings> regionServerThrottles = new ArrayList<>();
   List<ThrottleSettings> namespaceThrottles = new ArrayList<>();
   List<ThrottleSettings> userThrottles = new ArrayList<>();
-  try (QuotaRetriever scanner = QuotaRetriever.open(conf, null)) {
-    for (QuotaSettings quota : scanner) {
-      if (quota instanceof ThrottleSettings) {
-        ThrottleSettings throttle = (ThrottleSettings) quota;
-        if (throttle.getUserName() != null) {
-          userThrottles.add(throttle);
-        } else if (throttle.getNamespace() != null) {
-          namespaceThrottles.add(throttle);
-        } else if (throttle.getRegionServer() != null) {
-          regionServerThrottles.add(throttle);
+  MasterQuotaManager quotaManager = master.getMasterQuotaManager();
+  boolean exceedThrottleQuotaEnabled = false;
+  if (quotaManager != null) {
+    exceedThrottleQuotaEnabled = quotaManager.isExceedThrottleQuotaEnabled();
+    try (QuotaRetriever scanner = QuotaRetriever.open(conf, null)) {
+      for (QuotaSettings quota : scanner) {
+        if (quota instanceof ThrottleSettings) {
+          ThrottleSettings throttle = (ThrottleSettings) quota;
+          if (throttle.getUserName() != null) {
+            userThrottles.add(throttle);
+          } else if (throttle.getNamespace() != null) {
+            namespaceThrottles.add(throttle);
+          } else if (throttle.getRegionServer() != null) {
+            regionServerThrottles.add(throttle);
+          }
         }
       }
     }
@@ -61,13 +66,15 @@
   </div>
 </div>
 
+<%if (quotaManager != null) {%>
+
 <div class="container-fluid content">
   <div class="row">
     <div class="page-header">
       <h2>Rpc Throttle Enabled</h2>
     </div>
   </div>
-  <%if (master.getMasterQuotaManager().isRpcThrottleEnabled()) {%>
+  <%if (quotaManager.isRpcThrottleEnabled()) {%>
   <div class="alert alert-success">
     Rpc throttle is enabled.
   </div>
@@ -201,4 +208,6 @@
   <% } %>
 </div>
 
+<% } %>
+
 <jsp:include page="footer.jsp" />