Skip to content

Commit b0456f3

Browse files
author
meiyi
committed
HBASE-22878 Show table throttle quotas in table jsp (#510)
1 parent 34eab1e commit b0456f3

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
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.LinkedHashMap"
2726
import="java.util.List"
2827
import="java.util.Map"
@@ -46,8 +45,10 @@
4645
import="org.apache.hadoop.hbase.client.RegionReplicaUtil"
4746
import="org.apache.hadoop.hbase.client.Table"
4847
import="org.apache.hadoop.hbase.master.HMaster"
48+
import="org.apache.hadoop.hbase.quotas.QuotaSettingsFactory"
4949
import="org.apache.hadoop.hbase.quotas.QuotaTableUtil"
5050
import="org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot"
51+
import="org.apache.hadoop.hbase.quotas.ThrottleSettings"
5152
import="org.apache.hadoop.hbase.util.Bytes"
5253
import="org.apache.hadoop.hbase.util.FSUtils"
5354
import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
@@ -345,6 +346,40 @@ if (fqtn != null && master.isInitialized()) {
345346
</tr>
346347
<%
347348
}
349+
350+
if (quota.hasThrottle()) {
351+
List<ThrottleSettings> throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle());
352+
if (throttles.size() > 0) {
353+
%>
354+
<tr>
355+
<td>Throttle Quota</td>
356+
<td>
357+
<table>
358+
<tr>
359+
<th>Limit</th>
360+
<th>Type</th>
361+
<th>TimeUnit</th>
362+
<th>Scope</th>
363+
</tr>
364+
<%
365+
for (ThrottleSettings throttle : throttles) {
366+
%>
367+
<tr>
368+
<td><%= throttle.getSoftLimit() %></td>
369+
<td><%= throttle.getThrottleType() %></td>
370+
<td><%= throttle.getTimeUnit() %></td>
371+
<td><%= throttle.getQuotaScope() %></td>
372+
</tr>
373+
<%
374+
}
375+
%>
376+
</table>
377+
</td>
378+
<td>Information about a Throttle Quota on this table, if set.</td>
379+
</tr>
380+
<%
381+
}
382+
}
348383
}
349384
%>
350385
</table>

0 commit comments

Comments
 (0)