Skip to content

Commit 1d1813d

Browse files
authored
HBASE-22878 Show table throttle quotas in table jsp (#510)
1 parent 43e732c commit 1d1813d

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

hbase-client/src/main/java/org/apache/hadoop/hbase/quotas/QuotaSettingsFactory.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,15 @@ private static List<QuotaSettings> fromQuotas(final String userName, final Table
123123
return settings;
124124
}
125125

126-
protected static List<QuotaSettings> fromThrottle(final String userName,
126+
public static List<ThrottleSettings> fromTableThrottles(final TableName tableName,
127+
final QuotaProtos.Throttle throttle) {
128+
return fromThrottle(null, tableName, null, null, throttle);
129+
}
130+
131+
protected static List<ThrottleSettings> fromThrottle(final String userName,
127132
final TableName tableName, final String namespace, final String regionServer,
128133
final QuotaProtos.Throttle throttle) {
129-
List<QuotaSettings> settings = new ArrayList<>();
134+
List<ThrottleSettings> settings = new ArrayList<>();
130135
if (throttle.hasReqNum()) {
131136
settings.add(ThrottleSettings.fromTimedQuota(userName, tableName, namespace, regionServer,
132137
ThrottleType.REQUEST_NUMBER, throttle.getReqNum()));

hbase-server/src/main/resources/hbase-webapps/master/table.jsp

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222
import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml"
2323
import="java.util.ArrayList"
2424
import="java.util.Collection"
25-
import="java.util.Collections"
2625
import="java.util.HashMap"
2726
import="java.util.LinkedHashMap"
2827
import="java.util.List"
2928
import="java.util.Map"
30-
import="java.util.Objects"
3129
import="java.util.TreeMap"
3230
import=" java.util.concurrent.TimeUnit"
3331
import="org.apache.commons.lang3.StringEscapeUtils"
@@ -51,8 +49,10 @@
5149
import="org.apache.hadoop.hbase.master.HMaster"
5250
import="org.apache.hadoop.hbase.master.assignment.RegionStates"
5351
import="org.apache.hadoop.hbase.master.RegionState"
52+
import="org.apache.hadoop.hbase.quotas.QuotaSettingsFactory"
5453
import="org.apache.hadoop.hbase.quotas.QuotaTableUtil"
5554
import="org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot"
55+
import="org.apache.hadoop.hbase.quotas.ThrottleSettings"
5656
import="org.apache.hadoop.hbase.util.Bytes"
5757
import="org.apache.hadoop.hbase.util.FSUtils"
5858
import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
@@ -358,6 +358,40 @@ if (fqtn != null && master.isInitialized()) {
358358
</tr>
359359
<%
360360
}
361+
362+
if (quota.hasThrottle()) {
363+
List<ThrottleSettings> throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle());
364+
if (throttles.size() > 0) {
365+
%>
366+
<tr>
367+
<td>Throttle Quota</td>
368+
<td>
369+
<table>
370+
<tr>
371+
<th>Limit</th>
372+
<th>Type</th>
373+
<th>TimeUnit</th>
374+
<th>Scope</th>
375+
</tr>
376+
<%
377+
for (ThrottleSettings throttle : throttles) {
378+
%>
379+
<tr>
380+
<td><%= throttle.getSoftLimit() %></td>
381+
<td><%= throttle.getThrottleType() %></td>
382+
<td><%= throttle.getTimeUnit() %></td>
383+
<td><%= throttle.getQuotaScope() %></td>
384+
</tr>
385+
<%
386+
}
387+
%>
388+
</table>
389+
</td>
390+
<td>Information about a Throttle Quota on this table, if set.</td>
391+
</tr>
392+
<%
393+
}
394+
}
361395
}
362396
%>
363397
</table>

0 commit comments

Comments
 (0)