HBASE-23263 NPE in Quotas.jsp (#800)
Signed-off-by: Guangxu Cheng <guangxucheng@gmail.com>
This commit is contained in:
parent
c348e642d9
commit
264d3e3b16
|
@ -23,6 +23,7 @@
|
||||||
import="java.util.List"
|
import="java.util.List"
|
||||||
import="org.apache.hadoop.conf.Configuration"
|
import="org.apache.hadoop.conf.Configuration"
|
||||||
import="org.apache.hadoop.hbase.master.HMaster"
|
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.QuotaRetriever"
|
||||||
import="org.apache.hadoop.hbase.quotas.QuotaSettings"
|
import="org.apache.hadoop.hbase.quotas.QuotaSettings"
|
||||||
import="org.apache.hadoop.hbase.quotas.ThrottleSettings"
|
import="org.apache.hadoop.hbase.quotas.ThrottleSettings"
|
||||||
|
@ -31,10 +32,13 @@
|
||||||
HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
|
HMaster master = (HMaster) getServletContext().getAttribute(HMaster.MASTER);
|
||||||
Configuration conf = master.getConfiguration();
|
Configuration conf = master.getConfiguration();
|
||||||
pageContext.setAttribute("pageTitle", "HBase Master Quotas: " + master.getServerName());
|
pageContext.setAttribute("pageTitle", "HBase Master Quotas: " + master.getServerName());
|
||||||
boolean exceedThrottleQuotaEnabled = master.getMasterQuotaManager().isExceedThrottleQuotaEnabled();
|
|
||||||
List<ThrottleSettings> regionServerThrottles = new ArrayList<>();
|
List<ThrottleSettings> regionServerThrottles = new ArrayList<>();
|
||||||
List<ThrottleSettings> namespaceThrottles = new ArrayList<>();
|
List<ThrottleSettings> namespaceThrottles = new ArrayList<>();
|
||||||
List<ThrottleSettings> userThrottles = new ArrayList<>();
|
List<ThrottleSettings> userThrottles = new ArrayList<>();
|
||||||
|
MasterQuotaManager quotaManager = master.getMasterQuotaManager();
|
||||||
|
boolean exceedThrottleQuotaEnabled = false;
|
||||||
|
if (quotaManager != null) {
|
||||||
|
exceedThrottleQuotaEnabled = quotaManager.isExceedThrottleQuotaEnabled();
|
||||||
try (QuotaRetriever scanner = QuotaRetriever.open(conf, null)) {
|
try (QuotaRetriever scanner = QuotaRetriever.open(conf, null)) {
|
||||||
for (QuotaSettings quota : scanner) {
|
for (QuotaSettings quota : scanner) {
|
||||||
if (quota instanceof ThrottleSettings) {
|
if (quota instanceof ThrottleSettings) {
|
||||||
|
@ -49,6 +53,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
%>
|
%>
|
||||||
<jsp:include page="header.jsp">
|
<jsp:include page="header.jsp">
|
||||||
<jsp:param name="pageTitle" value="${pageTitle}"/>
|
<jsp:param name="pageTitle" value="${pageTitle}"/>
|
||||||
|
@ -61,13 +66,15 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<%if (quotaManager != null) {%>
|
||||||
|
|
||||||
<div class="container-fluid content">
|
<div class="container-fluid content">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="page-header">
|
<div class="page-header">
|
||||||
<h2>Rpc Throttle Enabled</h2>
|
<h2>Rpc Throttle Enabled</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%if (master.getMasterQuotaManager().isRpcThrottleEnabled()) {%>
|
<%if (quotaManager.isRpcThrottleEnabled()) {%>
|
||||||
<div class="alert alert-success">
|
<div class="alert alert-success">
|
||||||
Rpc throttle is enabled.
|
Rpc throttle is enabled.
|
||||||
</div>
|
</div>
|
||||||
|
@ -201,4 +208,6 @@
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
|
||||||
<jsp:include page="footer.jsp" />
|
<jsp:include page="footer.jsp" />
|
||||||
|
|
Loading…
Reference in New Issue