|
20 | 20 | <%@page import="java.net.URLEncoder"%> |
21 | 21 | <%@ page contentType="text/html;charset=UTF-8" |
22 | 22 | import="static org.apache.commons.lang3.StringEscapeUtils.escapeXml" |
| 23 | + import="java.io.IOException" |
23 | 24 | import="java.util.ArrayList" |
24 | 25 | import="java.util.Collection" |
25 | | - import="java.util.Collections" |
26 | 26 | import="java.util.HashMap" |
27 | 27 | import="java.util.LinkedHashMap" |
28 | 28 | import="java.util.List" |
29 | 29 | import="java.util.Map" |
30 | | - import="java.util.Objects" |
31 | 30 | import="java.util.TreeMap" |
32 | 31 | import=" java.util.concurrent.TimeUnit" |
33 | 32 | import="org.apache.commons.lang3.StringEscapeUtils" |
|
51 | 50 | import="org.apache.hadoop.hbase.master.HMaster" |
52 | 51 | import="org.apache.hadoop.hbase.master.assignment.RegionStates" |
53 | 52 | import="org.apache.hadoop.hbase.master.RegionState" |
| 53 | + import="org.apache.hadoop.hbase.quotas.QuotaFilter" |
| 54 | + import="org.apache.hadoop.hbase.quotas.QuotaRetriever" |
| 55 | + import="org.apache.hadoop.hbase.quotas.QuotaSettings" |
54 | 56 | import="org.apache.hadoop.hbase.quotas.QuotaTableUtil" |
55 | 57 | import="org.apache.hadoop.hbase.quotas.SpaceQuotaSnapshot" |
| 58 | + import="org.apache.hadoop.hbase.quotas.ThrottleSettings" |
56 | 59 | import="org.apache.hadoop.hbase.util.Bytes" |
57 | 60 | import="org.apache.hadoop.hbase.util.FSUtils" |
58 | 61 | import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator" |
|
77 | 80 | setType(HBaseProtos.RegionSpecifier.RegionSpecifierType.REGION_NAME). |
78 | 81 | setValue(ByteString.copyFrom(regionInfo.getRegionName())).build()).build()); |
79 | 82 | } |
| 83 | +
|
| 84 | + private List<ThrottleSettings> getThrottles(Configuration conf, QuotaFilter filter) |
| 85 | + throws IOException { |
| 86 | + List<ThrottleSettings> throttles = new ArrayList<>(); |
| 87 | + try (QuotaRetriever scanner = QuotaRetriever.open(conf, filter)) { |
| 88 | + for (QuotaSettings quota : scanner) { |
| 89 | + if (quota instanceof ThrottleSettings) { |
| 90 | + ThrottleSettings throttle = (ThrottleSettings) quota; |
| 91 | + throttles.add(throttle); |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + return throttles; |
| 96 | + } |
80 | 97 | %> |
81 | 98 | <% |
82 | 99 | HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER); |
@@ -356,6 +373,37 @@ if (fqtn != null && master.isInitialized()) { |
356 | 373 | </td> |
357 | 374 | <td>Information about a Space Quota on this table, if set.</td> |
358 | 375 | </tr> |
| 376 | +<% |
| 377 | + } |
| 378 | +
|
| 379 | + List<ThrottleSettings> throttles = new ArrayList<>(); |
| 380 | + throttles.addAll(getThrottles(conf, new QuotaFilter().setTableFilter(tn.getNameAsString()))); |
| 381 | + throttles.addAll(getThrottles(conf, new QuotaFilter().setUserFilter(".*") |
| 382 | + .setTableFilter(tn.getNameAsString()))); |
| 383 | + if (throttles.size() > 0) { |
| 384 | +%> |
| 385 | + <tr> |
| 386 | + <td>Throttle Quota</td> |
| 387 | + <td> |
| 388 | + <table> |
| 389 | + <tr> |
| 390 | + <th>User</th> |
| 391 | + <th>Throttle</th> |
| 392 | + </tr> |
| 393 | +<% |
| 394 | + for (ThrottleSettings throttle : throttles) { |
| 395 | +%> |
| 396 | + <tr> |
| 397 | + <td><%= throttle.getUserName() == null ? "" : throttle.getUserName()%></td> |
| 398 | + <td><%= throttle.toString() %></td> |
| 399 | + </tr> |
| 400 | +<% |
| 401 | + } |
| 402 | +%> |
| 403 | + </table> |
| 404 | + </td> |
| 405 | + <td>Information about a Throttle Quota on this table, if set.</td> |
| 406 | + </tr> |
359 | 407 | <% |
360 | 408 | } |
361 | 409 | } |
|
0 commit comments