3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 <%@page
import="org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.RegionSpecifier.RegionSpecifierType"%>
21 <%@ page contentType
="text/html;charset=UTF-8"
22 import="static org.apache.commons.lang.StringEscapeUtils.escapeXml"
23 import="org.apache.hadoop.hbase.shaded.com.google.protobuf.ByteString"
24 import="java.net.URLEncoder"
25 import="java.util.ArrayList"
26 import="java.util.TreeMap"
27 import="java.util.List"
28 import="java.util.LinkedHashMap"
29 import="java.util.Map"
30 import="java.util.Set"
31 import="java.util.Collection"
32 import="java.util.Collections"
33 import="java.util.Comparator"
34 import="org.apache.commons.lang.StringEscapeUtils"
35 import="org.apache.hadoop.conf.Configuration"
36 import="org.apache.hadoop.util.StringUtils"
37 import="org.apache.hadoop.hbase.HRegionInfo"
38 import="org.apache.hadoop.hbase.HRegionLocation"
39 import="org.apache.hadoop.hbase.ServerName"
40 import="org.apache.hadoop.hbase.ServerLoad"
41 import="org.apache.hadoop.hbase.RegionLoad"
42 import="org.apache.hadoop.hbase.HConstants"
43 import="org.apache.hadoop.hbase.master.HMaster"
44 import="org.apache.hadoop.hbase.zookeeper.MetaTableLocator"
45 import="org.apache.hadoop.hbase.util.Bytes"
46 import="org.apache.hadoop.hbase.util.FSUtils"
47 import="org.apache.hadoop.hbase.shaded.protobuf.generated.ClusterStatusProtos"
48 import="org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos"
49 import="org.apache.hadoop.hbase.TableName"
50 import="org.apache.hadoop.hbase.HColumnDescriptor"
51 import="org.apache.hadoop.hbase.HBaseConfiguration"
52 import="org.apache.hadoop.hbase.TableNotFoundException"%>
53 <%@ page
import="org.apache.hadoop.hbase.client.*" %>
56 * @return An empty region load stamped with the passed in <code>hri</code>
59 private RegionLoad
getEmptyRegionLoad(final HRegionInfo hri
) {
60 return new RegionLoad(ClusterStatusProtos
.RegionLoad
.newBuilder().
61 setRegionSpecifier(HBaseProtos
.RegionSpecifier
.newBuilder().
62 setType(HBaseProtos
.RegionSpecifier
.RegionSpecifierType
.REGION_NAME
).
63 setValue(ByteString
.copyFrom(hri
.getRegionName())).build()).build());
67 HMaster master
= (HMaster
)getServletContext().getAttribute(HMaster
.MASTER
);
68 Configuration conf
= master
.getConfiguration();
70 MetaTableLocator metaTableLocator
= new MetaTableLocator();
71 String fqtn
= request
.getParameter("name");
72 final String escaped_fqtn
= StringEscapeUtils
.escapeHtml(fqtn
);
73 String sortKey
= request
.getParameter("sort");
74 String reverse
= request
.getParameter("reverse");
75 final boolean reverseOrder
= (reverse
==null||!reverse
.equals("false"));
76 String showWholeKey
= request
.getParameter("showwhole");
77 final boolean showWhole
= (showWholeKey
!=null && showWholeKey
.equals("true"));
80 boolean withReplica
= false;
81 ServerName rl
= metaTableLocator
.getMetaRegionLocation(master
.getZooKeeper());
82 boolean showFragmentation
= conf
.getBoolean("hbase.master.ui.fragmentation.enabled", false);
83 boolean readOnly
= conf
.getBoolean("hbase.master.ui.readonly", false);
84 int numMetaReplicas
= conf
.getInt(HConstants
.META_REPLICAS_NUM
,
85 HConstants
.DEFAULT_META_REPLICA_NUM
);
86 Map
<String
, Integer
> frags
= null;
87 if (showFragmentation
) {
88 frags
= FSUtils
.getTableFragmentation(master
);
90 String action
= request
.getParameter("action");
91 String key
= request
.getParameter("key");
92 String left
= request
.getParameter("left");
93 String right
= request
.getParameter("right");
94 long totalStoreFileSizeMB
= 0;
96 final String numRegionsParam
= request
.getParameter("numRegions");
97 // By default, the page render up to 10000 regions to improve the page load time
98 int numRegionsToRender
= 10000;
99 if (numRegionsParam
!= null) {
100 // either 'all' or a number
101 if (numRegionsParam
.equals("all")) {
102 numRegionsToRender
= -1;
105 numRegionsToRender
= Integer
.parseInt(numRegionsParam
);
106 } catch (NumberFormatException ex
) {
117 <?xml version=
"1.0" encoding=
"UTF-8" ?>
118 <html xmlns=
"http://www.w3.org/1999/xhtml">
120 <meta charset=
"utf-8">
121 <%
if ( !readOnly
&& action
!= null ) { %>
122 <title>HBase Master: <%= StringEscapeUtils
.escapeHtml(master
.getServerName().toString()) %></title>
124 <title>Table: <%= escaped_fqtn
%></title>
126 <meta name=
"viewport" content=
"width=device-width, initial-scale=1.0">
127 <meta name=
"description" content=
"">
128 <meta name=
"author" content=
"">
131 <link href=
"/static/css/bootstrap.min.css" rel=
"stylesheet">
132 <link href=
"/static/css/bootstrap-theme.min.css" rel=
"stylesheet">
133 <link href=
"/static/css/hbase.css" rel=
"stylesheet">
134 <%
if ( ( !readOnly
&& action
!= null ) || fqtn
== null ) { %>
135 <script type=
"text/javascript">
137 setTimeout("history.back()",5000);
142 <script src="/static/js/html5shiv.js"></script>
147 <div class=
"navbar navbar-fixed-top navbar-default">
148 <div class=
"container-fluid">
149 <div class=
"navbar-header">
150 <button type=
"button" class=
"navbar-toggle" data-toggle=
"collapse" data-target=
".navbar-collapse">
151 <span class=
"icon-bar"></span>
152 <span class=
"icon-bar"></span>
153 <span class=
"icon-bar"></span>
155 <a class=
"navbar-brand" href=
"/master-status"><img src=
"/static/hbase_logo_small.png" alt=
"HBase Logo"/></a>
157 <div class=
"collapse navbar-collapse">
158 <ul class=
"nav navbar-nav">
159 <li><a href=
"/master-status">Home
</a></li>
160 <li><a href=
"/tablesDetailed.jsp">Table Details
</a></li>
161 <li><a href=
"/procedures.jsp">Procedures
</a></li>
162 <li><a href=
"/logs/">Local Logs
</a></li>
163 <li><a href=
"/logLevel">Log Level
</a></li>
164 <li><a href=
"/dump">Debug Dump
</a></li>
165 <li><a href=
"/jmx">Metrics Dump
</a></li>
166 <%
if (HBaseConfiguration
.isShowConfInServlet()) { %>
167 <li><a href=
"/conf">HBase Configuration
</a></li>
170 </div><!--/.nav-collapse -->
174 if ( fqtn
!= null ) {
176 table
= master
.getConnection().getTable(TableName
.valueOf(fqtn
));
177 if (table
.getTableDescriptor().getRegionReplication() > 1) {
178 tableHeader
= "<h2>Table Regions</h2><table class=\"table table-striped\" style=\"table-layout: fixed; word-wrap: break-word;\"><tr><th>Name</th><th>Region Server</th><th>ReadRequests</th><th>WriteRequests</th><th>StorefileSize</th><th>Num.Storefiles</th><th>MemSize</th><th>Locality</th><th>Start Key</th><th>End Key</th><th>ReplicaID</th></tr>";
181 tableHeader
= "<h2>Table Regions</h2><table class=\"table table-striped\" style=\"table-layout: fixed; word-wrap: break-word;\"><tr><th>Name</th><th>Region Server</th><th>ReadRequests</th><th>WriteRequests</th><th>StorefileSize</th><th>Num.Storefiles</th><th>MemSize</th><th>Locality</th><th>Start Key</th><th>End Key</th></tr>";
183 if ( !readOnly
&& action
!= null ) {
185 <div class=
"container-fluid content">
186 <div class=
"row inner_header">
187 <div class=
"page-header">
188 <h1>Table action request accepted
</h1>
193 try (Admin admin
= master
.getConnection().getAdmin()) {
194 if (action
.equals("split")) {
195 if (key
!= null && key
.length() > 0) {
196 admin
.split(TableName
.valueOf(fqtn
), Bytes
.toBytes(key
));
198 admin
.split(TableName
.valueOf(fqtn
));
201 %> Split request accepted. <%
202 } else if (action.equals(
"compact")) {
203 if (key != null && key.length()
> 0) {
204 List
<HRegionInfo> regions = admin.getTableRegions(TableName.valueOf(fqtn));
205 byte[] row = Bytes.toBytes(key);
207 for (HRegionInfo region : regions) {
208 if (region.containsRow(row)) {
209 admin.compactRegion(region.getRegionName());
213 admin.compact(TableName.valueOf(fqtn));
215 %
> Compact request accepted. <%
216 } else if (action
.equals("merge")) {
217 if (left
!= null && left
.length() > 0 && right
!= null && right
.length() > 0) {
218 admin
.mergeRegions(Bytes
.toBytesBinary(left
), Bytes
.toBytesBinary(right
), false);
220 %> Merge request accepted. <%
224 <p>Go
<a href=
"javascript:history.back()">Back
</a>, or wait for the redirect.
229 <div class=
"container-fluid content">
230 <div class=
"row inner_header">
231 <div class=
"page-header">
232 <h1>Table
<small><%= escaped_fqtn
%></small></h1>
237 if(fqtn
.equals(TableName
.META_TABLE_NAME
.getNameAsString())) {
241 // NOTE: Presumes meta with one or more replicas
242 for (int j
= 0; j
< numMetaReplicas
; j
++) {
243 HRegionInfo meta
= RegionReplicaUtil
.getRegionInfoForReplica(
244 HRegionInfo
.FIRST_META_REGIONINFO
, j
);
245 ServerName metaLocation
= metaTableLocator
.waitMetaRegionLocation(master
.getZooKeeper(), j
, 1);
246 for (int i
= 0; i
< 1; i
++) {
248 String readReq
= "N/A";
249 String writeReq
= "N/A";
250 String fileSize
= "N/A";
251 String fileCount
= "N/A";
252 String memSize
= "N/A";
253 float locality
= 0.0f
;
255 if (metaLocation
!= null) {
256 ServerLoad sl
= master
.getServerManager().getLoad(metaLocation
);
257 // The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely.
258 url
= "//" + URLEncoder
.encode(metaLocation
.getHostname()) + ":" + master
.getRegionServerInfoPort(metaLocation
) + "/";
260 Map
<byte[], RegionLoad
> map
= sl
.getRegionsLoad();
261 if (map
.containsKey(meta
.getRegionName())) {
262 RegionLoad load
= map
.get(meta
.getRegionName());
263 readReq
= String
.format("%,1d", load
.getReadRequestsCount());
264 writeReq
= String
.format("%,1d", load
.getWriteRequestsCount());
265 fileSize
= StringUtils
.byteDesc(load
.getStorefileSizeMB()*1024l*1024);
266 fileCount
= String
.format("%,1d", load
.getStorefiles());
267 memSize
= StringUtils
.byteDesc(load
.getMemStoreSizeMB()*1024l*1024);
268 locality
= load
.getDataLocality();
274 <td><%=
escapeXml(meta
.getRegionNameAsString()) %></td>
275 <td><a href=
"<%= url %>"><%= StringEscapeUtils
.escapeHtml(metaLocation
.getHostname().toString()) + ":" + master
.getRegionServerInfoPort(metaLocation
) %></a></td>
276 <td><%= readReq
%></td>
277 <td><%= writeReq
%></td>
278 <td><%= fileSize
%></td>
279 <td><%= fileCount
%></td>
280 <td><%= memSize
%></td>
281 <td><%= locality
%></td>
282 <td><%=
escapeXml(Bytes
.toString(meta
.getStartKey())) %></td>
283 <td><%=
escapeXml(Bytes
.toString(meta
.getEndKey())) %></td>
289 Admin admin
= master
.getConnection().getAdmin();
290 RegionLocator r
= master
.getClusterConnection().getRegionLocator(table
.getName());
292 <h2>Table Attributes
</h2>
293 <table class=
"table table-striped">
295 <th>Attribute Name
</th>
301 <td><%= admin
.isTableEnabled(table
.getName()) %></td>
302 <td>Is the table enabled
</td>
309 CompactionState compactionState
= admin
.getCompactionState(table
.getName());
311 <%= compactionState
%>
313 } catch (Exception e
) {
314 // Nothing really to do here
315 for(StackTraceElement element
: e
.getStackTrace()) {
316 %><%= StringEscapeUtils.escapeHtml(element.toString()) %
><%
322 <td>Is the table compacting
</td>
324 <%
if (showFragmentation
) { %>
326 <td>Fragmentation
</td>
327 <td><%= frags
.get(fqtn
) != null ? frags
.get(fqtn
).intValue() + "%" : "n/a" %></td>
328 <td>How fragmented is the table. After a major compaction it is
0%.
</td>
332 <h2>Table Schema
</h2>
333 <table class=
"table table-striped">
339 Collection
<HColumnDescriptor
> families
= table
.getTableDescriptor().getFamilies();
340 for (HColumnDescriptor family
: families
) {
343 <td><%= StringEscapeUtils
.escapeHtml(family
.getNameAsString()) %></td>
345 <table class=
"table table-striped">
351 Map
<Bytes
, Bytes
> familyValues
= family
.getValues();
352 for (Bytes familyKey
: familyValues
.keySet()) {
356 <%= StringEscapeUtils
.escapeHtml(familyKey
.toString()) %>
359 <%= StringEscapeUtils
.escapeHtml(familyValues
.get(familyKey
).toString()) %>
369 long totalReadReq
= 0;
370 long totalWriteReq
= 0;
372 long totalStoreFileCount
= 0;
373 long totalMemSize
= 0;
374 String urlRegionServer
= null;
375 Map
<ServerName
, Integer
> regDistribution
= new TreeMap
<>();
376 Map
<ServerName
, Integer
> primaryRegDistribution
= new TreeMap
<>();
377 List
<HRegionLocation
> regions
= r
.getAllRegionLocations();
378 Map
<HRegionInfo
, RegionLoad
> regionsToLoad
= new LinkedHashMap
<>();
379 Map
<HRegionInfo
, ServerName
> regionsToServer
= new LinkedHashMap
<>();
380 for (HRegionLocation hriEntry
: regions
) {
381 HRegionInfo regionInfo
= hriEntry
.getRegionInfo();
382 ServerName addr
= hriEntry
.getServerName();
383 regionsToServer
.put(regionInfo
, addr
);
386 ServerLoad sl
= master
.getServerManager().getLoad(addr
);
388 Map
<byte[], RegionLoad
> map
= sl
.getRegionsLoad();
389 RegionLoad regionload
= map
.get(regionInfo
.getRegionName());
390 regionsToLoad
.put(regionInfo
, regionload
);
391 if(regionload
!= null) {
392 totalReadReq
+= regionload
.getReadRequestsCount();
393 totalWriteReq
+= regionload
.getWriteRequestsCount();
394 totalSize
+= regionload
.getStorefileSizeMB();
395 totalStoreFileCount
+= regionload
.getStorefiles();
396 totalMemSize
+= regionload
.getMemStoreSizeMB();
397 totalStoreFileSizeMB
+= regionload
.getStorefileSizeMB();
399 RegionLoad load0
= getEmptyRegionLoad(regionInfo
);
400 regionsToLoad
.put(regionInfo
, load0
);
403 RegionLoad load0
= getEmptyRegionLoad(regionInfo
);
404 regionsToLoad
.put(regionInfo
, load0
);
407 RegionLoad load0
= getEmptyRegionLoad(regionInfo
);
408 regionsToLoad
.put(regionInfo
, load0
);
412 if(regions
!= null && regions
.size() > 0) { %>
413 <h2>Table Regions
</h2>
415 <select id=
"sel" style=
"margin-right: 10px">
416 <option value=
"regionName">RegionName
</option>
417 <option value=
"readrequest">ReadRequest
</option>
418 <option value=
"writerequest">WriteRequest
</option>
419 <option value=
"size">StorefileSize
</option>
420 <option value=
"filecount">Num.Storefiles
</option>
421 <option value=
"memstore">MemstoreSize
</option>
422 <option value=
"locality">Locality
</option>
424 Ascending
<input type=
"checkbox" id=
"ascending" value=
"Ascending" style=
"margin-right:10px">
425 ShowDetailName&Start/End Key
<input type=
"checkbox" id=
"showWhole" style=
"margin-right:10px">
426 <input type=
"button" id=
"submit" value=
"Reorder" onClick=
"reloadAsSort()" style=
"font-size: 12pt; width: 5em; margin-bottom: 5px" class=
"btn">
429 <table class=
"table table-striped">
431 <th>Name(<%= String
.format("%,1d", regions
.size())%>)
</th>
432 <th>Region Server
</th>
433 <th>ReadRequests
<br>(<%= String
.format("%,1d", totalReadReq
)%>)
</th>
434 <th>WriteRequests
<br>(<%= String
.format("%,1d", totalWriteReq
)%>)
</th>
435 <th>StorefileSize
<br>(<%= StringUtils
.byteDesc(totalSize
*1024l*1024)%>)
</th>
436 <th>Num.Storefiles
<br>(<%= String
.format("%,1d", totalStoreFileCount
)%>)
</th>
437 <th>MemSize
<br>(<%= StringUtils
.byteDesc(totalMemSize
*1024l*1024)%>)
</th>
451 List
<Map
.Entry
<HRegionInfo
, RegionLoad
>> entryList
= new ArrayList
<>(regionsToLoad
.entrySet());
452 if(sortKey
!= null) {
453 if (sortKey
.equals("readrequest")) {
454 Collections
.sort(entryList
,
455 new Comparator
<Map
.Entry
<HRegionInfo
, RegionLoad
>>() {
457 Map
.Entry
<HRegionInfo
, RegionLoad
> entry1
,
458 Map
.Entry
<HRegionInfo
, RegionLoad
> entry2
) {
459 if (entry1
== null || entry1
.getValue() == null) {
461 } else if (entry2
== null || entry2
.getValue() == null) {
465 if (entry1
.getValue().getReadRequestsCount() < entry2
.getValue().getReadRequestsCount()) {
467 } else if (entry1
.getValue().getReadRequestsCount() > entry2
.getValue().getReadRequestsCount()) {
471 result
= -1 * result
;
476 } else if (sortKey
.equals("writerequest")) {
477 Collections
.sort(entryList
,
478 new Comparator
<Map
.Entry
<HRegionInfo
, RegionLoad
>>() {
480 Map
.Entry
<HRegionInfo
, RegionLoad
> entry1
,
481 Map
.Entry
<HRegionInfo
, RegionLoad
> entry2
) {
482 if (entry1
== null || entry1
.getValue() == null) {
484 } else if (entry2
== null || entry2
.getValue() == null) {
488 if (entry1
.getValue().getWriteRequestsCount() < entry2
.getValue()
489 .getWriteRequestsCount()) {
491 } else if (entry1
.getValue().getWriteRequestsCount() > entry2
.getValue()
492 .getWriteRequestsCount()) {
496 result
= -1 * result
;
501 } else if (sortKey
.equals("size")) {
502 Collections
.sort(entryList
,
503 new Comparator
<Map
.Entry
<HRegionInfo
, RegionLoad
>>() {
505 Map
.Entry
<HRegionInfo
, RegionLoad
> entry1
,
506 Map
.Entry
<HRegionInfo
, RegionLoad
> entry2
) {
507 if (entry1
== null || entry1
.getValue() == null) {
509 } else if (entry2
== null || entry2
.getValue() == null) {
513 if (entry1
.getValue().getStorefileSizeMB() < entry2
.getValue()
514 .getStorefileSizeMB()) {
516 } else if (entry1
.getValue().getStorefileSizeMB() > entry2
517 .getValue().getStorefileSizeMB()) {
521 result
= -1 * result
;
526 } else if (sortKey
.equals("filecount")) {
527 Collections
.sort(entryList
,
528 new Comparator
<Map
.Entry
<HRegionInfo
, RegionLoad
>>() {
530 Map
.Entry
<HRegionInfo
, RegionLoad
> entry1
,
531 Map
.Entry
<HRegionInfo
, RegionLoad
> entry2
) {
532 if (entry1
== null || entry1
.getValue() == null) {
534 } else if (entry2
== null || entry2
.getValue() == null) {
538 if (entry1
.getValue().getStorefiles() < entry2
.getValue()
541 } else if (entry1
.getValue().getStorefiles() > entry2
.getValue()
546 result
= -1 * result
;
551 } else if (sortKey
.equals("memstore")) {
552 Collections
.sort(entryList
,
553 new Comparator
<Map
.Entry
<HRegionInfo
, RegionLoad
>>() {
555 Map
.Entry
<HRegionInfo
, RegionLoad
> entry1
,
556 Map
.Entry
<HRegionInfo
, RegionLoad
> entry2
) {
557 if (entry1
== null || entry1
.getValue()==null) {
559 } else if (entry2
== null || entry2
.getValue()==null) {
563 if (entry1
.getValue().getMemStoreSizeMB() < entry2
.getValue()
564 .getMemStoreSizeMB()) {
566 } else if (entry1
.getValue().getMemStoreSizeMB() > entry2
567 .getValue().getMemStoreSizeMB()) {
571 result
= -1 * result
;
576 } else if (sortKey
.equals("locality")) {
577 Collections
.sort(entryList
,
578 new Comparator
<Map
.Entry
<HRegionInfo
, RegionLoad
>>() {
580 Map
.Entry
<HRegionInfo
, RegionLoad
> entry1
,
581 Map
.Entry
<HRegionInfo
, RegionLoad
> entry2
) {
582 if (entry1
== null || entry1
.getValue()==null) {
584 } else if (entry2
== null || entry2
.getValue()==null) {
588 if (entry1
.getValue().getDataLocality() < entry2
.getValue()
589 .getDataLocality()) {
591 } else if (entry1
.getValue().getDataLocality() > entry2
592 .getValue().getDataLocality()) {
596 result
= -1 * result
;
603 numRegions
= regions
.size();
604 int numRegionsRendered
= 0;
605 // render all regions
606 if (numRegionsToRender
< 0) {
607 numRegionsToRender
= numRegions
;
609 for (Map
.Entry
<HRegionInfo
, RegionLoad
> hriEntry
: entryList
) {
610 HRegionInfo regionInfo
= hriEntry
.getKey();
611 ServerName addr
= regionsToServer
.get(regionInfo
);
612 RegionLoad load
= hriEntry
.getValue();
613 String readReq
= "N/A";
614 String writeReq
= "N/A";
615 String regionSize
= "N/A";
616 String fileCount
= "N/A";
617 String memSize
= "N/A";
618 float locality
= 0.0f
;
620 readReq
= String
.format("%,1d", load
.getReadRequestsCount());
621 writeReq
= String
.format("%,1d", load
.getWriteRequestsCount());
622 regionSize
= StringUtils
.byteDesc(load
.getStorefileSizeMB()*1024l*1024);
623 fileCount
= String
.format("%,1d", load
.getStorefiles());
624 memSize
= StringUtils
.byteDesc(load
.getMemStoreSizeMB()*1024l*1024);
625 locality
= load
.getDataLocality();
629 ServerLoad sl
= master
.getServerManager().getLoad(addr
);
630 // This port might be wrong if RS actually ended up using something else.
632 "//" + URLEncoder
.encode(addr
.getHostname()) + ":" + master
.getRegionServerInfoPort(addr
) + "/";
634 Integer i
= regDistribution
.get(addr
);
635 if (null == i
) i
= Integer
.valueOf(0);
636 regDistribution
.put(addr
, i
+ 1);
637 if (withReplica
&& RegionReplicaUtil
.isDefaultReplica(regionInfo
.getReplicaId())) {
638 i
= primaryRegDistribution
.get(addr
);
639 if (null == i
) i
= Integer
.valueOf(0);
640 primaryRegDistribution
.put(addr
, i
+1);
644 if (numRegionsRendered
< numRegionsToRender
) {
645 numRegionsRendered
++;
648 <td><%=
escapeXml(showWhole?Bytes
.toStringBinary(regionInfo
.getRegionName()):regionInfo
.getEncodedName()) %></td>
650 if (urlRegionServer
!= null) {
653 <a href=
"<%= urlRegionServer %>"><%= StringEscapeUtils
.escapeHtml(addr
.getHostname().toString()) + ":" + master
.getRegionServerInfoPort(addr
) %></a>
658 <td class=
"undeployed-region">not deployed
</td>
662 <td><%= readReq
%></td>
663 <td><%= writeReq
%></td>
664 <td><%= regionSize
%></td>
665 <td><%= fileCount
%></td>
666 <td><%= memSize
%></td>
667 <td><%= locality
%></td>
668 <td><%=
escapeXml(showWhole?Bytes
.toStringBinary(regionInfo
.getStartKey()):"-")%></td>
669 <td><%=
escapeXml(showWhole?Bytes
.toStringBinary(regionInfo
.getEndKey()):"-")%></td>
673 <td><%= regionInfo
.getReplicaId() %></td>
681 <%
if (numRegions
> numRegionsRendered
) {
682 String allRegionsUrl
= "?name=" + URLEncoder
.encode(fqtn
,"UTF-8") + "&numRegions=all";
684 <p>This table has
<b><%= numRegions
%></b> regions in total, in order to improve the page load time,
685 only
<b><%= numRegionsRendered
%></b> regions are displayed here,
<a href=
"<%= allRegionsUrl %>">click
686 here
</a> to see all regions.
</p>
688 <h2>Regions by Region Server
</h2>
692 <table class=
"table table-striped"><tr><th>Region Server
</th><th>Region Count
</th><th>Primary Region Count
</th></tr>
696 <table class=
"table table-striped"><tr><th>Region Server
</th><th>Region Count
</th></tr>
701 for (Map
.Entry
<ServerName
, Integer
> rdEntry
: regDistribution
.entrySet()) {
702 ServerName addr
= rdEntry
.getKey();
703 String url
= "//" + URLEncoder
.encode(addr
.getHostname()) + ":" + master
.getRegionServerInfoPort(addr
) + "/";
706 <td><a href=
"<%= url %>"><%= StringEscapeUtils
.escapeHtml(addr
.getHostname().toString()) + ":" + master
.getRegionServerInfoPort(addr
) %></a></td>
707 <td><%= rdEntry
.getValue()%></td>
711 <td><%= primaryRegDistribution
.get(addr
)%></td>
719 } catch(Exception ex
) {
720 for(StackTraceElement element
: ex
.getStackTrace()) {
721 %><%= StringEscapeUtils.escapeHtml(element.toString()) %
><%
730 <table class=
"table table-striped">
738 <td><%= StringUtils
.TraditionalBinaryPrefix
.long2String(totalStoreFileSizeMB
* 1024 * 1024, "B", 2)%></td>
739 <td>Total size of store files (in bytes)
</td>
743 <%
if (!readOnly
) { %>
748 <table class=
"table" width=
"95%" >
751 <input type=
"hidden" name=
"action" value=
"compact">
752 <input type=
"hidden" name=
"name" value=
"<%= escaped_fqtn %>">
753 <td style
="border-style: none; text-align: center">
754 <input style
="font-size: 12pt; width: 10em" type
="submit" value
="Compact" class="btn"></td
>
755 <td style
="border-style: none" width
="5%"> 
;</td
>
756 <td style
="border-style: none">Row
Key (optional
):<input type
="text" name
="key" size
="40"></td
>
757 <td style
="border-style: none">This action will force a compaction of all
758 regions of the table
, or
, if a key is supplied
, only the region containing the
762 <tr
><td style
="border-style: none" colspan
="4"> 
;</td
></tr
>
765 <input type
="hidden" name
="action" value
="split">
766 <input type
="hidden" name
="name" value
="<%= escaped_fqtn %>">
767 <td style
="border-style: none; text-align: center">
768 <input style
="font-size: 12pt; width: 10em" type
="submit" value
="Split" class="btn"></td
>
769 <td style
="border-style: none" width
="5%"> 
;</td
>
770 <td style
="border-style: none">Row
Key (optional
):<input type
="text" name
="key" size
="40"></td
>
771 <td style
="border-style: none">This action will force a split of all eligible
772 regions of the table
, or
, if a key is supplied
, only the region containing the
773 given key
. An eligible region is one that does not contain any references to
774 other regions
. Split requests
for noneligible regions will be ignored
.</td
>
779 <input type
="hidden" name
="action" value
="merge">
780 <input type
="hidden" name
="name" value
="<%= escaped_fqtn %>">
781 <td style
="border-style: none; text-align: center">
782 <input style
="font-size: 12pt; width: 10em" type
="submit" value
="Merge" class="btn"></td
>
783 <td style
="border-style: none" width
="5%"> 
;</td
>
784 <td style
="border-style: none">Region
Key (Required
):<input type
="text" name
="left" size
="40">
785 Region
Key (Required
) :<input type
="text" name
="right" size
="40"></td
>
786 <td style
="border-style: none">This action will merge two
787 regions of the table
, Merge requests
for noneligible regions will be ignored
.</td
>
797 } catch(TableNotFoundException e
) { %>
798 <div class=
"container-fluid content">
799 <div class=
"row inner_header">
800 <div class=
"page-header">
801 <h1>Table not found
</h1>
805 <p>Go
<a href=
"javascript:history.back()">Back
</a>
807 } catch(IllegalArgumentException e
) { %>
808 <div class=
"container-fluid content">
809 <div class=
"row inner_header">
810 <div class=
"page-header">
811 <h1>Table qualifier must not be empty
</h1>
815 <p>Go
<a href=
"javascript:history.back()">Back
</a>
819 else { // handle the case for fqtn is null with error message + redirect
821 <div class=
"container-fluid content">
822 <div class=
"row inner_header">
823 <div class=
"page-header">
824 <h1>Table not ready
</h1>
828 <p>Go
<a href=
"javascript:history.back()">Back
</a>, or wait for the redirect.
831 <script src=
"/static/js/jquery.min.js" type=
"text/javascript"></script>
832 <script src=
"/static/js/bootstrap.min.js" type=
"text/javascript"></script>
839 var sortKeyValue
='<%= StringEscapeUtils.escapeJavaScript(sortKey) %>';
840 if(sortKeyValue
=="readrequest")index
=1;
841 else if(sortKeyValue
=="writerequest")index
=2;
842 else if(sortKeyValue
=="size")index
=3;
843 else if(sortKeyValue
=="filecount")index
=4;
844 else if(sortKeyValue
=="memstore")index
=5;
845 else if(sortKeyValue
=="locality")index
=6;
846 document
.getElementById("sel").selectedIndex
=index
;
848 <% // turned into a boolean when we pulled it out of the request. %>
849 var reverse
='<%= reverseOrder %>';
850 if(reverse
=='false')document
.getElementById("ascending").checked
=true;
852 <% // turned into a boolean when we pulled it out of the request. %>
853 var showWhole
='<%= showWhole %>';
854 if(showWhole
=='true')document
.getElementById("showWhole").checked
=true;
856 function reloadAsSort(){
857 var url
="?name="+'<%= URLEncoder.encode(fqtn) %>';
858 if(document
.getElementById("sel").selectedIndex
>0){
859 url
=url
+"&sort="+document
.getElementById("sel").value
;
861 if(document
.getElementById("ascending").checked
){
862 url
=url
+"&reverse=false";
864 if(document
.getElementById("showWhole").checked
){
865 url
=url
+"&showwhole=true";