You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by me...@apache.org on 2019/09/03 02:05:48 UTC
[hbase] branch branch-2 updated: HBASE-22878 Show table throttle
quotas in table jsp (#510)
This is an automated email from the ASF dual-hosted git repository.
meiyi pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new b0456f3 HBASE-22878 Show table throttle quotas in table jsp (#510)
b0456f3 is described below
commit b0456f3297a6389cfd912a4dc031dd1ca834a6ba
Author: meiyi <me...@xiaomi.com>
AuthorDate: Tue Sep 3 09:53:44 2019 +0800
HBASE-22878 Show table throttle quotas in table jsp (#510)
---
.../hadoop/hbase/quotas/QuotaSettingsFactory.java | 9 ++++--
.../main/resources/hbase-webapps/master/table.jsp | 37 +++++++++++++++++++++-
2 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java
index 4473b73..3e5bc16 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java
@@ -123,10 +123,15 @@ public class QuotaSettingsFactory {
return settings;
}
- protected static List<QuotaSettings> fromThrottle(final String userName,
+ public static List<ThrottleSettings> fromTableThrottles(final TableName tableName,
+ final QuotaProtos.Throttle throttle) {
+ return fromThrottle(null, tableName, null, null, throttle);
+ }
+
+ protected static List<ThrottleSettings> fromThrottle(final String userName,
final TableName tableName, final String namespace, final String regionServer,
final QuotaProtos.Throttle throttle) {
- List<QuotaSettings> settings = new ArrayList<>();
+ List<ThrottleSettings> settings = new ArrayList<>();
if (throttle.hasReqNum()) {
settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer,
ThrottleType.REQUEST_NUMBER, throttle.getReqNum()));
diff --git a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
index 17b7d01..55c0e15 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -22,7 +22,6 @@
import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml"
import="java.util.ArrayList"
import="java.util.Collection"
- import="java.util.Collections"
import="java.util.LinkedHashMap"
import="java.util.List"
import="java.util.Map"
@@ -46,8 +45,10 @@
import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
import="org.apache.hadoop.hbase.client.Table"
import="org.apache.hadoop.hbase.master.HMaster"
+ import="org.apache.hadoop.hbase.quotas.QuotaSettingsFactory"
import="org.apache.hadoop.hbase.quotas.QuotaTableUtil"
import="org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot"
+ import="org.apache.hadoop.hbase.quotas.ThrottleSettings"
import="org.apache.hadoop.hbase.util.Bytes"
import="org.apache.hadoop.hbase.util.FSUtils"
import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
@@ -345,6 +346,40 @@ if (fqtn != null && master.isInitialized()) {
</tr>
<%
}
+
+ if (quota.hasThrottle()) {
+ List<ThrottleSettings> throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle());
+ if (throttles.size() > 0) {
+%>
+ <tr>
+ <td>Throttle Quota</td>
+ <td>
+ <table>
+ <tr>
+ <th>Limit</th>
+ <th>Type</th>
+ <th>TimeUnit</th>
+ <th>Scope</th>
+ </tr>
+<%
+ for (ThrottleSettings throttle : throttles) {
+%>
+ <tr>
+ <td><%= throttle.getSoftLimit() %></td>
+ <td><%= throttle.getThrottleType() %></td>
+ <td><%= throttle.getTimeUnit() %></td>
+ <td><%= throttle.getQuotaScope() %></td>
+ </tr>
+<%
+ }
+%>
+ </table>
+ </td>
+ <td>Information about a Throttle Quota on this table, if set.</td>
+ </tr>
+<%
+ }
+ }
}
%>
</table>