diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon
index 23330096cf39..d837b8504623 100644
--- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon
+++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon
@@ -299,7 +299,12 @@ $(document).ready(function()
type: "numeric"
});
- $("#baseStatsTable").tablesorter();
+ $("#baseStatsTable").tablesorter({
+ headers: {
+ 1: {empty: 'emptyMin'},
+ 2: {empty: 'emptyMax'}
+ }
+ });
$("#requestStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
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 56a0c8096d32..f9b6120196cf 100644
--- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
+++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp
@@ -93,7 +93,7 @@
* its region server.
* @return an anchor tag if one can be built, {@code null} otherwise.
*/
- private static String buildRegionServerLink(final ServerName serverName, final int rsInfoPort,
+ private static String buildRegionLink(final ServerName serverName, final int rsInfoPort,
final RegionInfo regionInfo, final RegionState.State regionState) {
if (serverName == null || regionInfo == null) { return null; }
@@ -107,15 +107,74 @@
+ "?name=" + regionInfo.getEncodedName();
return "" + serverName.getServerName() + "";
}
+
+ /**
+ * Render an
tag contents server name which the given region deploys.
+ * Links to the server rs-status page.
+ * | not deployed | instead if can not find the deploy message.
+ * @return an tag contents server name links to server rs-status page.
+ */
+ private static String buildRegionDeployedServerTag(RegionInfo regionInfo, HMaster master,
+ Map regionsToServer) {
+ ServerName serverName = regionsToServer.get(regionInfo);
+
+ if (serverName == null) {
+ return "| not deployed | ";
+ }
+
+ String hostName = serverName.getHostname();
+ String hostNameEncoded = URLEncoder.encode(hostName);
+ // This port might be wrong if RS actually ended up using something else.
+ int serverInfoPort = master.getRegionServerInfoPort(serverName);
+ String urlRegionServer = "//" + hostNameEncoded + ":" + serverInfoPort + "/rs-status";
+
+ return "" + StringEscapeUtils.escapeHtml4(hostName)
+ + ":" + serverInfoPort + " | ";
+ }
+
+ /**
+ * @return an tag guide user to see all region messages.
+ */
+ private static String moreRegionsToRender(int numRegionsRendered, int numRegions, String fqtn) {
+ if (numRegions > numRegionsRendered) {
+ String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn) + "&numRegions=all";
+
+ return "This table has " + numRegions
+ + " regions in total, in order to improve the page load time, only "
+ + numRegionsRendered + " regions are displayed here, click here to see all regions. ";
+ }
+ return "";
+ }
%>
+
+
+
+
+
<%
final String ZEROMB = "0 MB";
HMaster master = (HMaster)getServletContext().getAttribute(HMaster.MASTER);
Configuration conf = master.getConfiguration();
String fqtn = request.getParameter("name");
+ // handle the case for fqtn is null or master is not initialized with error message + redirect
+ if (fqtn == null || !master.isInitialized()) {
+%>
+
+<% return;
+ } %>
+
+<%
final String escaped_fqtn = StringEscapeUtils.escapeHtml4(fqtn);
- Table table;
- boolean withReplica = false;
+ Table table = master.getConnection().getTable(TableName.valueOf(fqtn));
boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false);
boolean readOnly = !InfoServer.canUserModifyUI(request, getServletContext(), conf);
int numMetaReplicas =
@@ -162,19 +221,22 @@
final MetaBrowser metaBrowser = new MetaBrowser(connection, request);
%>
-
-
-
+<% // unknow table
+ if (! admin.tableExists(TableName.valueOf(fqtn)).get()) { %>
+
+<% return;
+ } %>
-<%
- if (fqtn != null && master.isInitialized()) {
- try {
- table = master.getConnection().getTable(TableName.valueOf(fqtn));
- if (table.getTableDescriptor().getRegionReplication() > 1) {
- withReplica = true;
- }
- if ( !readOnly && action != null ) {
-%>
+<% // table split/compact/merge actions
+ if ( !readOnly && action != null ) { %>
- <%
- if (action.equals("split")) {
+<% if (action.equals("split")) {
if (key != null && key.length() > 0) {
admin.split(TableName.valueOf(fqtn), Bytes.toBytes(key));
} else {
admin.split(TableName.valueOf(fqtn));
}
- %> Split request accepted. <%
+%> Split request accepted. <%
} else if (action.equals("major compact")) {
if (key != null && key.length() > 0) {
List regions = admin.getRegions(TableName.valueOf(fqtn)).get();
@@ -203,7 +264,7 @@
} else {
admin.majorCompact(TableName.valueOf(fqtn));
}
- %> major Compact request accepted. <%
+%> major Compact request accepted. <%
} else if (action.equals("compact")) {
if (key != null && key.length() > 0) {
List regions = admin.getRegions(TableName.valueOf(fqtn)).get();
@@ -217,246 +278,227 @@
} else {
admin.compact(TableName.valueOf(fqtn));
}
- %> Compact request accepted. <%
+%> Compact request accepted. <%
} else if (action.equals("merge")) {
- if (left != null && left.length() > 0 && right != null && right.length() > 0) {
- admin.mergeRegions(Bytes.toBytesBinary(left), Bytes.toBytesBinary(right), false);
- }
- %> Merge request accepted. <%
- }
-%>
-
-
-<%
-} else {
-%>
-
-
+
+<%} else {
+ //Common tables
+ RegionStates states = master.getAssignmentManager().getRegionStates();
+ Map> regionStates = states.getRegionByStateOfTable(table.getName());
+ Map stateMap = new HashMap<>();
+ for (RegionState.State regionState : regionStates.keySet()) {
+ for (RegionInfo regionInfo : regionStates.get(regionState)) {
+ stateMap.put(regionInfo.getEncodedName(), regionState);
+ }
+ }
+ RegionLocator r = master.getConnection().getRegionLocator(table.getName());
+
+ try {
+%>
+Table Attributes
+
+
+ | Attribute Name |
+ Value |
+ Description |
+
+
+ | Enabled |
+ <%= master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED) %> |
+ Is the table enabled |
+
+
+ | Compaction |
+
+<%
+ if (master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED)) {
+ CompactionState compactionState = master.getCompactionState(table.getName());
+ %><%= compactionState==null?"UNKNOWN":compactionState %><%
+ } else {
+ %><%= CompactionState.NONE %><%
+ }
+%>
+ |
+ Is the table compacting |
+
+<% if (showFragmentation) { %>
+
+ | Fragmentation |
+ <%= frags.get(fqtn) != null ? frags.get(fqtn).intValue() + "%" : "n/a" %> |
+ How fragmented is the table. After a major compaction it is 0%. |
+
+<% } %>
+<%
+ if (quotasEnabled) {
+ TableName tn = TableName.valueOf(fqtn);
+ SpaceQuotaSnapshot masterSnapshot = null;
+ Quotas quota = QuotaTableUtil.getTableQuota(master.getConnection(), tn);
+ if (quota == null || !quota.hasSpace()) {
+ quota = QuotaTableUtil.getNamespaceQuota(master.getConnection(), tn.getNamespaceAsString());
+ if (quota != null) {
+ masterSnapshot = master.getQuotaObserverChore().getNamespaceQuotaSnapshots()
+ .get(tn.getNamespaceAsString());
}
- RegionLocator r = master.getConnection().getRegionLocator(table.getName());
- try { %>
- Table Attributes
-
-
- | Attribute Name |
- Value |
- Description |
-
-
- | Enabled |
- <%= master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED) %> |
- Is the table enabled |
-
-
- | Compaction |
-
- <%
- if (master.getTableStateManager().isTableState(table.getName(), TableState.State.ENABLED)) {
- CompactionState compactionState = master.getCompactionState(table.getName());
- %><%= compactionState==null?"UNKNOWN":compactionState %><%
- } else {
- %><%= CompactionState.NONE %><%
- }
- %>
- |
- Is the table compacting |
-
- <% if (showFragmentation) { %>
-
- | Fragmentation |
- <%= frags.get(fqtn) != null ? frags.get(fqtn).intValue() + "%" : "n/a" %> |
- How fragmented is the table. After a major compaction it is 0%. |
-
- <% } %>
- <%
- if (quotasEnabled) {
- TableName tn = TableName.valueOf(fqtn);
- SpaceQuotaSnapshot masterSnapshot = null;
- Quotas quota = QuotaTableUtil.getTableQuota(master.getConnection(), tn);
- if (quota == null || !quota.hasSpace()) {
- quota = QuotaTableUtil.getNamespaceQuota(master.getConnection(), tn.getNamespaceAsString());
- if (quota != null) {
- masterSnapshot = master.getQuotaObserverChore().getNamespaceQuotaSnapshots()
- .get(tn.getNamespaceAsString());
- }
- } else {
- masterSnapshot = master.getQuotaObserverChore().getTableQuotaSnapshots().get(tn);
- }
- if (quota != null && quota.hasSpace()) {
- SpaceQuota spaceQuota = quota.getSpace();
- %>
-
- | Space Quota |
-
-
-
- | Property |
- Value |
-
-
- | Limit |
- <%= StringUtils.byteDesc(spaceQuota.getSoftLimit()) %> |
-
-
- | Policy |
- <%= spaceQuota.getViolationPolicy() %> |
-
- <%
- if (masterSnapshot != null) {
- %>
-
- | Usage |
- <%= StringUtils.byteDesc(masterSnapshot.getUsage()) %> |
-
-
- | State |
- <%= masterSnapshot.getQuotaStatus().isInViolation() ? "In Violation" : "In Observance" %> |
-
- <%
- }
- %>
-
- |
- Information about a Space Quota on this table, if set. |
-
- <%
- }
- if (quota != null && quota.hasThrottle()) {
- List throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle());
- if (throttles.size() > 0) {
- %>
-
- | Throttle Quota |
-
-
-
- | Limit |
- Type |
- TimeUnit |
- Scope |
-
- <%
- for (ThrottleSettings throttle : throttles) {
- %>
-
- | <%= throttle.getSoftLimit() %> |
- <%= throttle.getThrottleType() %> |
- <%= throttle.getTimeUnit() %> |
- <%= throttle.getQuotaScope() %> |
-
- <%
- }
- %>
-
- |
- Information about a Throttle Quota on this table, if set. |
-
+ } else {
+ masterSnapshot = master.getQuotaObserverChore().getTableQuotaSnapshots().get(tn);
+ }
+ if (quota != null && quota.hasSpace()) {
+ SpaceQuota spaceQuota = quota.getSpace();
+%>
+
+ | Space Quota |
+
+
+
+ | Property |
+ Value |
+
+
+ | Limit |
+ <%= StringUtils.byteDesc(spaceQuota.getSoftLimit()) %> |
+
+
+ | Policy |
+ <%= spaceQuota.getViolationPolicy() %> |
+
+<%
+ if (masterSnapshot != null) {
+%>
+
+ | Usage |
+ <%= StringUtils.byteDesc(masterSnapshot.getUsage()) %> |
+
+
+ | State |
+ <%= masterSnapshot.getQuotaStatus().isInViolation() ? "In Violation" : "In Observance" %> |
+
+<%
+ }
+%>
+
+ |
+ Information about a Space Quota on this table, if set. |
+
+<%
+ }
+ if (quota != null && quota.hasThrottle()) {
+ List throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle());
+ if (throttles.size() > 0) {
+%>
+
+ | Throttle Quota |
+
+
+
+ | Limit |
+ Type |
+ TimeUnit |
+ Scope |
+
+<%
+ for (ThrottleSettings throttle : throttles) {
+%>
+
+ | <%= throttle.getSoftLimit() %> |
+ <%= throttle.getThrottleType() %> |
+ <%= throttle.getTimeUnit() %> |
+ <%= throttle.getQuotaScope() %> |
+
+<%
+ }
+%>
+
+ |
+ Information about a Throttle Quota on this table, if set. |
+
+<%
+ }
+ }
+ }
+%>
+
+Table Schema
+
+<%
+ColumnFamilyDescriptor[] families = table.getDescriptor().getColumnFamilies();
+Set familyKeySet = new HashSet<>();
+for (ColumnFamilyDescriptor family: families) {
+ familyKeySet.addAll(family.getValues().keySet());
+}
+%>
+
+ | Property \ Column Family Name |
+ <%
+ for (ColumnFamilyDescriptor family: families) {
+ %>
+
+ <%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %>
+ |
+ <% } %>
+
+ <%
+ for (Bytes familyKey: familyKeySet) {
+ %>
+
+ |
+ <%= StringEscapeUtils.escapeHtml4(familyKey.toString()) %>
+ |
<%
- }
- }
+ for (ColumnFamilyDescriptor family: families) {
+ String familyValue = "-";
+ if(family.getValues().containsKey(familyKey)){
+ familyValue = family.getValues().get(familyKey).toString();
}
%>
-
- Table Schema
-
- <%
- ColumnFamilyDescriptor[] families = table.getDescriptor().getColumnFamilies();
- Set familyKeySet = new HashSet<>();
- for (ColumnFamilyDescriptor family: families) {
- familyKeySet.addAll(family.getValues().keySet());
- }
- %>
-
- | Property \ Column Family Name |
- <%
- for (ColumnFamilyDescriptor family: families) {
- %>
-
- <%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %>
- |
- <% } %>
-
- <%
- for (Bytes familyKey: familyKeySet) {
- %>
-
- |
- <%= StringEscapeUtils.escapeHtml4(familyKey.toString()) %>
- |
- <%
- for (ColumnFamilyDescriptor family: families) {
- String familyValue = "-";
- if(family.getValues().containsKey(familyKey)){
- familyValue = family.getValues().get(familyKey).toString();
- }
- %>
-
- <%= StringEscapeUtils.escapeHtml4(familyValue) %>
- |
- <% } %>
-
- <% } %>
-
- <%
- long totalReadReq = 0;
- long totalWriteReq = 0;
- long totalSizeUncompressed = 0;
- long totalSize = 0;
- long totalStoreFileCount = 0;
- long totalMemSize = 0;
- long totalCompactingCells = 0;
- long totalCompactedCells = 0;
- long totalBlocksTotalWeight = 0;
- long totalBlocksLocalWeight = 0;
- long totalBlocksLocalWithSsdWeight = 0;
- String totalCompactionProgress = "";
- String totalMemSizeStr = ZEROMB;
- String totalSizeUncompressedStr = ZEROMB;
- String totalSizeStr = ZEROMB;
- String totalLocality = "";
- String totalLocalityForSsd = "";
- String urlRegionServer = null;
- Map regDistribution = new TreeMap<>();
- Map primaryRegDistribution = new TreeMap<>();
- List regions = r.getAllRegionLocations();
- Map regionsToLoad = new LinkedHashMap<>();
- Map regionsToServer = new LinkedHashMap<>();
- for (HRegionLocation hriEntry : regions) {
- RegionInfo regionInfo = hriEntry.getRegionInfo();
- ServerName addr = hriEntry.getServerName();
- regionsToServer.put(regionInfo, addr);
+
+ <%= StringEscapeUtils.escapeHtml4(familyValue) %>
+ |
+ <% } %>
+
+ <% } %>
+
+<%
+ long totalReadReq = 0;
+ long totalWriteReq = 0;
+ long totalSizeUncompressed = 0;
+ long totalSize = 0;
+ long totalStoreFileCount = 0;
+ long totalMemSize = 0;
+ long totalCompactingCells = 0;
+ long totalCompactedCells = 0;
+ long totalBlocksTotalWeight = 0;
+ long totalBlocksLocalWeight = 0;
+ long totalBlocksLocalWithSsdWeight = 0;
+ String totalCompactionProgress = "";
+ String totalMemSizeStr = ZEROMB;
+ String totalSizeUncompressedStr = ZEROMB;
+ String totalSizeStr = ZEROMB;
+ String totalLocality = "";
+ String totalLocalityForSsd = "";
+ String urlRegionServer = null;
+ Map regDistribution = new TreeMap<>();
+ Map primaryRegDistribution = new TreeMap<>();
+ List regions = r.getAllRegionLocations();
+ Map regionsToLoad = new LinkedHashMap<>();
+ Map regionsToServer = new LinkedHashMap<>();
+ for (HRegionLocation hriEntry : regions) {
+ RegionInfo regionInfo = hriEntry.getRegionInfo();
+ ServerName addr = hriEntry.getServerName();
+ regionsToServer.put(regionInfo, addr);
- if (addr != null) {
- ServerMetrics sl = master.getServerManager().getLoad(addr);
- if (sl != null) {
- RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName());
- regionsToLoad.put(regionInfo, regionMetrics);
- if (regionMetrics != null) {
- totalReadReq += regionMetrics.getReadRequestCount();
- totalWriteReq += regionMetrics.getWriteRequestCount();
- totalSizeUncompressed += regionMetrics.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
- totalSize += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
- totalStoreFileCount += regionMetrics.getStoreFileCount();
- totalMemSize += regionMetrics.getMemStoreSize().get(Size.Unit.MEGABYTE);
- totalStoreFileSizeMB += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
- totalCompactingCells += regionMetrics.getCompactingCellCount();
- totalCompactedCells += regionMetrics.getCompactedCellCount();
- totalBlocksTotalWeight += regionMetrics.getBlocksTotalWeight();
- totalBlocksLocalWeight += regionMetrics.getBlocksLocalWeight();
- totalBlocksLocalWithSsdWeight += regionMetrics.getBlocksLocalWithSsdWeight();
- } else {
- RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
- regionsToLoad.put(regionInfo, load0);
- }
- } else{
- RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
- regionsToLoad.put(regionInfo, load0);
- }
+ if (addr != null) {
+ ServerMetrics sl = master.getServerManager().getLoad(addr);
+ if (sl != null) {
+ RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName());
+ regionsToLoad.put(regionInfo, regionMetrics);
+ if (regionMetrics != null) {
+ totalReadReq += regionMetrics.getReadRequestCount();
+ totalWriteReq += regionMetrics.getWriteRequestCount();
+ totalSizeUncompressed += regionMetrics.getUncompressedStoreFileSize().get(Size.Unit.MEGABYTE);
+ totalSize += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
+ totalStoreFileCount += regionMetrics.getStoreFileCount();
+ totalMemSize += regionMetrics.getMemStoreSize().get(Size.Unit.MEGABYTE);
+ totalStoreFileSizeMB += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
+ totalCompactingCells += regionMetrics.getCompactingCellCount();
+ totalCompactedCells += regionMetrics.getCompactedCellCount();
+ totalBlocksTotalWeight += regionMetrics.getBlocksTotalWeight();
+ totalBlocksLocalWeight += regionMetrics.getBlocksLocalWeight();
+ totalBlocksLocalWithSsdWeight += regionMetrics.getBlocksLocalWithSsdWeight();
} else {
RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
regionsToLoad.put(regionInfo, load0);
}
+ } else{
+ RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
+ regionsToLoad.put(regionInfo, load0);
}
- if (totalSize > 0) {
- totalSizeStr = StringUtils.byteDesc(totalSize*1024l*1024);
- }
- if (totalSizeUncompressed > 0){
- totalSizeUncompressedStr = StringUtils.byteDesc(totalSizeUncompressed*1024l*1024);
- }
- if (totalMemSize > 0) {
- totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024);
- }
- if (totalCompactingCells > 0) {
- totalCompactionProgress = String.format("%.2f", 100 *
- ((float) totalCompactedCells / totalCompactingCells)) + "%";
- }
- if (totalBlocksTotalWeight > 0) {
- totalLocality = String.format("%.1f",
- ((float) totalBlocksLocalWeight / totalBlocksTotalWeight));
- totalLocalityForSsd = String.format("%.1f",
- ((float) totalBlocksLocalWithSsdWeight / totalBlocksTotalWeight));
- }
- if(regions != null && regions.size() > 0) { %>
- Table Regions
-
-
-
-
-
-
-
- | Name(<%= String.format("%,1d", regions.size())%>) |
- Region Server |
- ReadRequests (<%= String.format("%,1d", totalReadReq)%>) |
- WriteRequests (<%= String.format("%,1d", totalWriteReq)%>) |
- Uncompressed StoreFileSize (<%= totalSizeUncompressedStr %>) |
- StorefileSize (<%= totalSizeStr %>) |
- Num.Storefiles (<%= String.format("%,1d", totalStoreFileCount)%>) |
- MemSize (<%= totalMemSizeStr %>) |
- Start Key |
- End Key |
- Region State |
- <%
- if (withReplica) {
- %>
- ReplicaID |
- <%
- }
- %>
-
-
-
- <%
- List> entryList = new ArrayList<>(regionsToLoad.entrySet());
- numRegions = regions.size();
- int numRegionsRendered = 0;
- // render all regions
- if (numRegionsToRender < 0) {
- numRegionsToRender = numRegions;
+ } else {
+ RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
+ regionsToLoad.put(regionInfo, load0);
+ }
+ }
+ if (totalSize > 0) {
+ totalSizeStr = StringUtils.byteDesc(totalSize*1024l*1024);
+ }
+ if (totalSizeUncompressed > 0){
+ totalSizeUncompressedStr = StringUtils.byteDesc(totalSizeUncompressed*1024l*1024);
+ }
+ if (totalMemSize > 0) {
+ totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024);
+ }
+ if (totalCompactingCells > 0) {
+ totalCompactionProgress = String.format("%.2f", 100 *
+ ((float) totalCompactedCells / totalCompactingCells)) + "%";
+ }
+ if (totalBlocksTotalWeight > 0) {
+ totalLocality = String.format("%.1f",
+ ((float) totalBlocksLocalWeight / totalBlocksTotalWeight));
+ totalLocalityForSsd = String.format("%.1f",
+ ((float) totalBlocksLocalWithSsdWeight / totalBlocksTotalWeight));
+ }
+ if(regions != null && regions.size() > 0) { %>
+Table Regions
+
+
+
+
+
+
+
+ | Name(<%= String.format("%,1d", regions.size())%>) |
+ Region Server |
+ ReadRequests (<%= String.format("%,1d", totalReadReq)%>) |
+ WriteRequests (<%= String.format("%,1d", totalWriteReq)%>) |
+ Uncompressed StoreFileSize (<%= totalSizeUncompressedStr %>) |
+ StorefileSize (<%= totalSizeStr %>) |
+ Num.Storefiles (<%= String.format("%,1d", totalStoreFileCount)%>) |
+ MemSize (<%= totalMemSizeStr %>) |
+ Start Key |
+ End Key |
+ Region State |
+ ReplicaID |
+
+
+
+ <%
+ List> entryList = new ArrayList<>(regionsToLoad.entrySet());
+ numRegions = regions.size();
+ int numRegionsRendered = 0;
+ // render all regions
+ if (numRegionsToRender < 0) {
+ numRegionsToRender = numRegions;
+ }
+ for (Map.Entry hriEntry : entryList) {
+ RegionInfo regionInfo = hriEntry.getKey();
+ ServerName addr = regionsToServer.get(regionInfo);
+ RegionMetrics load = hriEntry.getValue();
+ String readReq = "N/A";
+ String writeReq = "N/A";
+ String regionSizeUncompressed = ZEROMB;
+ String regionSize = ZEROMB;
+ String fileCount = "N/A";
+ String memSize = ZEROMB;
+ String state = "N/A";
+ if (load != null) {
+ readReq = String.format("%,1d", load.getReadRequestCount());
+ writeReq = String.format("%,1d", load.getWriteRequestCount());
+ double rSize = load.getStoreFileSize().get(Size.Unit.BYTE);
+ if (rSize > 0) {
+ regionSize = StringUtils.byteDesc((long)rSize);
}
- for (Map.Entry hriEntry : entryList) {
- RegionInfo regionInfo = hriEntry.getKey();
- ServerName addr = regionsToServer.get(regionInfo);
- RegionMetrics load = hriEntry.getValue();
- String readReq = "N/A";
- String writeReq = "N/A";
- String regionSizeUncompressed = ZEROMB;
- String regionSize = ZEROMB;
- String fileCount = "N/A";
- String memSize = ZEROMB;
- String state = "N/A";
- if (load != null) {
- readReq = String.format("%,1d", load.getReadRequestCount());
- writeReq = String.format("%,1d", load.getWriteRequestCount());
- double rSize = load.getStoreFileSize().get(Size.Unit.BYTE);
- if (rSize > 0) {
- regionSize = StringUtils.byteDesc((long)rSize);
- }
- double rSizeUncompressed = load.getUncompressedStoreFileSize().get(Size.Unit.BYTE);
- if (rSizeUncompressed > 0) {
- regionSizeUncompressed = StringUtils.byteDesc((long)rSizeUncompressed);
- }
- fileCount = String.format("%,1d", load.getStoreFileCount());
- double mSize = load.getMemStoreSize().get(Size.Unit.BYTE);
- if (mSize > 0) {
- memSize = StringUtils.byteDesc((long)mSize);
- }
- }
- if (stateMap.containsKey(regionInfo.getEncodedName())) {
- state = stateMap.get(regionInfo.getEncodedName()).toString();
- }
- if (addr != null) {
- ServerMetrics sl = master.getServerManager().getLoad(addr);
- // This port might be wrong if RS actually ended up using something else.
- urlRegionServer =
- "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status";
- if(sl != null) {
- Integer i = regDistribution.get(addr);
- if (null == i) i = Integer.valueOf(0);
- regDistribution.put(addr, i + 1);
- if (withReplica && RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) {
- i = primaryRegDistribution.get(addr);
- if (null == i) i = Integer.valueOf(0);
- primaryRegDistribution.put(addr, i+1);
- }
- }
- }
- if (numRegionsRendered < numRegionsToRender) {
- numRegionsRendered++;
- %>
-
- | <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> |
- <%
- if (urlRegionServer != null) {
- %>
-
- <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %>
- |
- <%
- } else {
- %>
- not deployed |
- <%
- }
- %>
- <%= readReq%> |
- <%= writeReq%> |
- <%= regionSizeUncompressed%> |
- <%= regionSize%> |
- <%= fileCount%> |
- <%= memSize%> |
- <%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%> |
- <%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%> |
- <%= state%> |
- <%
- if (withReplica) {
- %>
- <%= regionInfo.getReplicaId() %> |
- <%
- }
- %>
-
- <% } %>
- <% } %>
-
-
- <% if (numRegions > numRegionsRendered) {
- String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
- %>
- This table has <%= numRegions %> regions in total, in order to improve the page load time,
- only <%= numRegionsRendered %> regions are displayed here, click
- here to see all regions.
- <% } %>
-
-
-
-
-
- | Name(<%= String.format("%,1d", regions.size())%>) |
- Region Server |
- Locality (<%= totalLocality %>) |
- LocalityForSsd (<%= totalLocalityForSsd %>) |
-
-
-
- <%
- numRegionsRendered = 0;
- for (Map.Entry hriEntry : entryList) {
- RegionInfo regionInfo = hriEntry.getKey();
- ServerName addr = regionsToServer.get(regionInfo);
- RegionMetrics load = hriEntry.getValue();
- float locality = 0.0f;
- float localityForSsd = 0.0f;
- String state = "N/A";
- if (load != null) {
- locality = load.getDataLocality();
- localityForSsd = load.getDataLocalityForSsd();
- }
- if (addr != null) {
- // This port might be wrong if RS actually ended up using something else.
- urlRegionServer =
- "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status";
- }
- if (numRegionsRendered < numRegionsToRender) {
- numRegionsRendered++;
- %>
-
- | <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> |
- <%
- if (urlRegionServer != null) {
- %>
-
- <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %>
- |
- <%
- } else {
- %>
- not deployed |
- <%
+ double rSizeUncompressed = load.getUncompressedStoreFileSize().get(Size.Unit.BYTE);
+ if (rSizeUncompressed > 0) {
+ regionSizeUncompressed = StringUtils.byteDesc((long)rSizeUncompressed);
}
- %>
- <%= locality%> |
- <%= localityForSsd%> |
-
- <% } %>
- <% } %>
-
-
-
-
-
-
-
- | Name(<%= String.format("%,1d", regions.size())%>) |
- Region Server |
- Num. Compacting Cells (<%= String.format("%,1d", totalCompactingCells)%>) |
- Num. Compacted Cells (<%= String.format("%,1d", totalCompactedCells)%>) |
- Remaining Cells (<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>) |
- Compaction Progress (<%= totalCompactionProgress %>) |
-
-
-
- <%
- numRegionsRendered = 0;
- for (Map.Entry hriEntry : entryList) {
- RegionInfo regionInfo = hriEntry.getKey();
- ServerName addr = regionsToServer.get(regionInfo);
- RegionMetrics load = hriEntry.getValue();
- long compactingCells = 0;
- long compactedCells = 0;
- String compactionProgress = "";
- if (load != null) {
- compactingCells = load.getCompactingCellCount();
- compactedCells = load.getCompactedCellCount();
- if (compactingCells > 0) {
- compactionProgress = String.format("%.2f", 100 * ((float)
- compactedCells / compactingCells)) + "%";
- }
- }
- if (addr != null) {
- // This port might be wrong if RS actually ended up using something else.
- urlRegionServer =
- "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status";
- }
- if (numRegionsRendered < numRegionsToRender) {
- numRegionsRendered++;
- %>
-
- | <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> |
- <%
- if (urlRegionServer != null) {
- %>
-
- <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %>
- |
- <%
- } else {
- %>
- not deployed |
- <%
+ fileCount = String.format("%,1d", load.getStoreFileCount());
+ double mSize = load.getMemStoreSize().get(Size.Unit.BYTE);
+ if (mSize > 0) {
+ memSize = StringUtils.byteDesc((long)mSize);
+ }
+ }
+
+ if (stateMap.containsKey(regionInfo.getEncodedName())) {
+ state = stateMap.get(regionInfo.getEncodedName()).toString();
+ }
+
+ if (addr != null) {
+ ServerMetrics sl = master.getServerManager().getLoad(addr);
+ if(sl != null) {
+ Integer i = regDistribution.get(addr);
+ if (null == i) i = Integer.valueOf(0);
+ regDistribution.put(addr, i + 1);
+ if (RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) {
+ i = primaryRegDistribution.get(addr);
+ if (null == i) i = Integer.valueOf(0);
+ primaryRegDistribution.put(addr, i+1);
}
- %>
- <%= String.format("%,1d", compactingCells)%> |
- <%= String.format("%,1d", compactedCells)%> |
- <%= String.format("%,1d", compactingCells - compactedCells)%> |
- <%= compactionProgress%> |
-
- <% } %>
- <% } %>
-
-
- <% if (numRegions > numRegionsRendered) {
- String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
- %>
- This table has <%= numRegions %> regions in total, in order to improve the page load time,
- only <%= numRegionsRendered %> regions are displayed here, click
- here to see all regions.
- <% } %>
-
-
+ }
+ }
+ if (numRegionsRendered < numRegionsToRender) {
+ numRegionsRendered++;
+ %>
+
+ | <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> |
+ <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %>
+ <%= readReq%> |
+ <%= writeReq%> |
+ <%= regionSizeUncompressed%> |
+ <%= regionSize%> |
+ <%= fileCount%> |
+ <%= memSize%> |
+ <%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%> |
+ <%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%> |
+ <%= state%> |
+ <%= regionInfo.getReplicaId() %> |
+
+ <% } %>
+ <% } %>
+
+
+ <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
- Regions by Region Server
- <%
- if (withReplica) {
- %>
- | Region Server | Region Count | Primary Region Count |
- <%
-} else {
-%>
- | Region Server | Region Count |
+
+
+
+
+ | Name(<%= String.format("%,1d", regions.size())%>) |
+ Region Server |
+ Locality (<%= totalLocality %>) |
+ LocalityForSsd (<%= totalLocalityForSsd %>) |
+
+
<%
- }
+ numRegionsRendered = 0;
+ for (Map.Entry hriEntry : entryList) {
+ RegionInfo regionInfo = hriEntry.getKey();
+ ServerName addr = regionsToServer.get(regionInfo);
+ RegionMetrics load = hriEntry.getValue();
+ float locality = 0.0f;
+ float localityForSsd = 0.0f;
+ String state = "N/A";
+ if (load != null) {
+ locality = load.getDataLocality();
+ localityForSsd = load.getDataLocalityForSsd();
+ }
+
+ if (numRegionsRendered < numRegionsToRender) {
+ numRegionsRendered++;
%>
+
+ | <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> |
+ <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %>
+ <%= locality%> |
+ <%= localityForSsd%> |
+
+ <% } %>
+ <% } %>
+
+
+ <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
+
+
+
+
+
+ | Name(<%= String.format("%,1d", regions.size())%>) |
+ Region Server |
+ Num. Compacting Cells (<%= String.format("%,1d", totalCompactingCells)%>) |
+ Num. Compacted Cells (<%= String.format("%,1d", totalCompactedCells)%>) |
+ Remaining Cells (<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>) |
+ Compaction Progress (<%= totalCompactionProgress %>) |
+
+
+
<%
- for (Map.Entry rdEntry : regDistribution.entrySet()) {
- ServerName addr = rdEntry.getKey();
- String url = "//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status";
+ numRegionsRendered = 0;
+ for (Map.Entry hriEntry : entryList) {
+ RegionInfo regionInfo = hriEntry.getKey();
+ ServerName addr = regionsToServer.get(regionInfo);
+ RegionMetrics load = hriEntry.getValue();
+ long compactingCells = 0;
+ long compactedCells = 0;
+ String compactionProgress = "";
+ if (load != null) {
+ compactingCells = load.getCompactingCellCount();
+ compactedCells = load.getCompactedCellCount();
+ if (compactingCells > 0) {
+ compactionProgress = String.format("%.2f", 100 * ((float)
+ compactedCells / compactingCells)) + "%";
+ }
+ }
+
+ if (numRegionsRendered < numRegionsToRender) {
+ numRegionsRendered++;
%>
- | <%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> |
- <%= rdEntry.getValue()%> |
- <%
- if (withReplica) {
- %>
- <%= primaryRegDistribution.get(addr)%> |
- <%
- }
- %>
+ <%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> |
+ <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %>
+ <%= String.format("%,1d", compactingCells)%> |
+ <%= String.format("%,1d", compactedCells)%> |
+ <%= String.format("%,1d", compactingCells - compactedCells)%> |
+ <%= compactionProgress%> |
<% } %>
+ <% } %>
- <% }
+ <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %>
+
+
+
+
+Regions by Region Server
+
+
+<% }
} catch(Exception ex) { %>
Unknown Issue with Regions
@@ -1296,41 +1261,6 @@
<% } %>
-<% }
-} catch(TableNotFoundException e) { %>
- <%
-} catch(IllegalArgumentException e) { %>
- <%
- }
-}
-else { // handle the case for fqtn is null or master is not initialized with error message + redirect
-%>
-
-<% } %>
@@ -1338,78 +1268,94 @@ else { // handle the case for fqtn is null or master is not initialized with err
diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp
new file mode 100644
index 000000000000..53a7d0cdbdbb
--- /dev/null
+++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/footer.jsp
@@ -0,0 +1,30 @@
+<%--
+/**
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+--%>
+
+
+
+
+
|