From 3b3cb5d9eb018fe41a5bae44d4c505fe88e49d82 Mon Sep 17 00:00:00 2001 From: Beata Sudi Date: Mon, 9 Dec 2019 10:24:19 +0100 Subject: [PATCH 1/5] HBASE-18382 add transport type info into Thrift UI (#880) Signed-off-by: Wellington Chevreuil Signed-off-by: Bharath Vissapragada Signed-off-by: Viraj Jasani (cherry picked from commit 82e155eb26cddd642e151d9276e2f4f281b4df88) --- .../resources/hbase-webapps/thrift/thrift.jsp | 38 +++++++++++++------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp index dea591230995..6b308fc2a2dc 100644 --- a/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp +++ b/hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp @@ -32,9 +32,14 @@ String serverType = (String)getServletContext().getAttribute("hbase.thrift.serve long startcode = conf.getLong("startcode", System.currentTimeMillis()); String listenPort = conf.get("hbase.regionserver.thrift.port", "9090"); ImplType implType = ImplType.getServerImpl(conf); -String framed = implType.isAlwaysFramed() - ? "true" : conf.get("hbase.regionserver.thrift.framed", "false"); -String compact = conf.get("hbase.regionserver.thrift.compact", "false"); + +String transport = + (implType.isAlwaysFramed() || + conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard"; +String protocol = + conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary"; +String qop = conf.get("hbase.thrift.security.qop", "None"); + %> @@ -54,12 +59,15 @@ String compact = conf.get("hbase.regionserver.thrift.compact", "false"); + +<%} 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

+ + + + + + + + + + + + + + + + +<% if (showFragmentation) { %> + + + + + +<% } %> +<% + 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 NameValueDescription
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
Fragmentation<%= frags.get(fqtn) != null ? frags.get(fqtn).intValue() + "%" : "n/a" %>How fragmented is the table. After a major compaction it is 0%.
- - - - - - - - - - - - - - - - <% if (showFragmentation) { %> - - - - - - <% } %> - <% - 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(); - %> - - - - - - <% - } - if (quota != null && quota.hasThrottle()) { - List throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle()); - if (throttles.size() > 0) { - %> - - - - - + } else { + masterSnapshot = master.getQuotaObserverChore().getTableQuotaSnapshots().get(tn); + } + if (quota != null && quota.hasSpace()) { + SpaceQuota spaceQuota = quota.getSpace(); +%> + + + + + +<% + } + if (quota != null && quota.hasThrottle()) { + List throttles = QuotaSettingsFactory.fromTableThrottles(table.getName(), quota.getThrottle()); + if (throttles.size() > 0) { +%> + + + + + +<% + } + } + } +%> +
Attribute NameValueDescription
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
Fragmentation<%= frags.get(fqtn) != null ? frags.get(fqtn).intValue() + "%" : "n/a" %>How fragmented is the table. After a major compaction it is 0%.
Space Quota - - - - - - - - - - - - - - <% - if (masterSnapshot != null) { - %> - - - - - - - - - <% - } - %> -
PropertyValue
Limit<%= StringUtils.byteDesc(spaceQuota.getSoftLimit()) %>
Policy<%= spaceQuota.getViolationPolicy() %>
Usage<%= StringUtils.byteDesc(masterSnapshot.getUsage()) %>
State<%= masterSnapshot.getQuotaStatus().isInViolation() ? "In Violation" : "In Observance" %>
-
Information about a Space Quota on this table, if set.
Throttle Quota - - - - - - - - <% - for (ThrottleSettings throttle : throttles) { - %> - - - - - - - <% - } - %> -
LimitTypeTimeUnitScope
<%= throttle.getSoftLimit() %><%= throttle.getThrottleType() %><%= throttle.getTimeUnit() %><%= throttle.getQuotaScope() %>
-
Information about a Throttle Quota on this table, if set.
Space Quota + + + + + + + + + + + + + +<% + if (masterSnapshot != null) { +%> + + + + + + + + +<% + } +%> +
PropertyValue
Limit<%= StringUtils.byteDesc(spaceQuota.getSoftLimit()) %>
Policy<%= spaceQuota.getViolationPolicy() %>
Usage<%= StringUtils.byteDesc(masterSnapshot.getUsage()) %>
State<%= masterSnapshot.getQuotaStatus().isInViolation() ? "In Violation" : "In Observance" %>
+
Information about a Space Quota on this table, if set.
Throttle Quota + + + + + + + +<% + for (ThrottleSettings throttle : throttles) { +%> + + + + + + +<% + } +%> +
LimitTypeTimeUnitScope
<%= 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()); +} +%> + + + <% + for (ColumnFamilyDescriptor family: families) { + %> + + <% } %> + + <% + for (Bytes familyKey: familyKeySet) { + %> + + <% - } - } + for (ColumnFamilyDescriptor family: families) { + String familyValue = "-"; + if(family.getValues().containsKey(familyKey)){ + familyValue = family.getValues().get(familyKey).toString(); } %> -
Property \ Column Family Name + <%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %> +
+ <%= StringEscapeUtils.escapeHtml4(familyKey.toString()) %> +
-

Table Schema

- - <% - ColumnFamilyDescriptor[] families = table.getDescriptor().getColumnFamilies(); - Set familyKeySet = new HashSet<>(); - for (ColumnFamilyDescriptor family: families) { - familyKeySet.addAll(family.getValues().keySet()); - } - %> - - - <% - for (ColumnFamilyDescriptor family: families) { - %> - - <% } %> - - <% - for (Bytes familyKey: familyKeySet) { - %> - - - <% - for (ColumnFamilyDescriptor family: families) { - String familyValue = "-"; - if(family.getValues().containsKey(familyKey)){ - familyValue = family.getValues().get(familyKey).toString(); - } - %> - - <% } %> - - <% } %> -
Property \ Column Family Name - <%= StringEscapeUtils.escapeHtml4(family.getNameAsString()) %> -
- <%= StringEscapeUtils.escapeHtml4(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

-
- -
-
- - - - - - - - - - - - - - - <% - if (withReplica) { - %> - - <% - } - %> - - - - <% - 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 ServerReadRequests
(<%= String.format("%,1d", totalReadReq)%>)
WriteRequests
(<%= String.format("%,1d", totalWriteReq)%>)
Uncompressed StoreFileSize
(<%= totalSizeUncompressedStr %>)
StorefileSize
(<%= totalSizeStr %>)
Num.Storefiles
(<%= String.format("%,1d", totalStoreFileCount)%>)
MemSize
(<%= totalMemSizeStr %>)
Start KeyEnd KeyRegion StateReplicaID
+ + + + + + + + + + + + + + + + + + <% + 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++; - %> - - - <% - if (urlRegionServer != null) { - %> - - <% - } else { - %> - - <% - } - %> - - - - - - - - - - <% - if (withReplica) { - %> - - <% - } - %> - - <% } %> - <% } %> - -
Name(<%= String.format("%,1d", regions.size())%>)Region ServerReadRequests
(<%= String.format("%,1d", totalReadReq)%>)
WriteRequests
(<%= String.format("%,1d", totalWriteReq)%>)
Uncompressed StoreFileSize
(<%= totalSizeUncompressedStr %>)
StorefileSize
(<%= totalSizeStr %>)
Num.Storefiles
(<%= String.format("%,1d", totalStoreFileCount)%>)
MemSize
(<%= totalMemSizeStr %>)
Start KeyEnd KeyRegion StateReplicaID
<%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> - not deployed<%= readReq%><%= writeReq%><%= regionSizeUncompressed%><%= regionSize%><%= fileCount%><%= memSize%><%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%><%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%><%= state%><%= 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.

- <% } %> -
-
- - - - - - - - - - - <% - 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++; - %> - - - <% - if (urlRegionServer != null) { - %> - - <% - } else { - %> - - <% + double rSizeUncompressed = load.getUncompressedStoreFileSize().get(Size.Unit.BYTE); + if (rSizeUncompressed > 0) { + regionSizeUncompressed = StringUtils.byteDesc((long)rSizeUncompressed); } - %> - - - - <% } %> - <% } %> - -
Name(<%= String.format("%,1d", regions.size())%>)Region ServerLocality
(<%= totalLocality %>)
LocalityForSsd
(<%= totalLocalityForSsd %>)
<%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> - not deployed<%= locality%><%= localityForSsd%>
-
-
- - - - - - - - - - - - - <% - 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++; - %> - - - <% - if (urlRegionServer != null) { - %> - - <% - } else { - %> - - <% + 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); } - %> - - - - - - <% } %> - <% } %> - -
Name(<%= String.format("%,1d", regions.size())%>)Region ServerNum. Compacting Cells
(<%= String.format("%,1d", totalCompactingCells)%>)
Num. Compacted Cells
(<%= String.format("%,1d", totalCompactedCells)%>)
Remaining Cells
(<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>)
Compaction Progress
(<%= totalCompactionProgress %>)
<%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %> - <%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %> - not deployed<%= 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) { - %> - - <% -} else { -%> -
Region ServerRegion CountPrimary Region Count
+
+
Region ServerRegion Count
+ + + + + + + + <% - } + 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++; %> + + + <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + + + + <% } %> + <% } %> + +
Name(<%= String.format("%,1d", regions.size())%>)Region ServerLocality
(<%= totalLocality %>)
LocalityForSsd
(<%= totalLocalityForSsd %>)
<%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %><%= locality%><%= localityForSsd%>
+ <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %> + +
+ + + + + + + + + + + + <% - 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++; %> - - - <% - if (withReplica) { - %> - - <% - } - %> + + <%= buildRegionDeployedServerTag(regionInfo, master, regionsToServer) %> + + + + <% } %> + <% } %>
Name(<%= String.format("%,1d", regions.size())%>)Region ServerNum. Compacting Cells
(<%= String.format("%,1d", totalCompactingCells)%>)
Num. Compacted Cells
(<%= String.format("%,1d", totalCompactedCells)%>)
Remaining Cells
(<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>)
Compaction Progress
(<%= totalCompactionProgress %>)
<%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %><%= rdEntry.getValue()%><%= primaryRegDistribution.get(addr)%><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %><%= String.format("%,1d", compactingCells)%><%= String.format("%,1d", compactedCells)%><%= String.format("%,1d", compactingCells - compactedCells)%><%= compactionProgress%>
- <% } + <%= moreRegionsToRender(numRegionsRendered, numRegions, fqtn) %> +
+ + + +

Regions by Region Server

+ + + + + + + + + <% + for (Map.Entry rdEntry : regDistribution.entrySet()) { + ServerName addr = rdEntry.getKey(); + String url = "//" + URLEncoder.encode(addr.getHostname()) + ":" + + master.getRegionServerInfoPort(addr) + "/rs-status"; + %> + + + + + + <% } %> + +
Region ServerRegion CountPrimary Region Count
<%= StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + + ":" + master.getRegionServerInfoPort(addr) %><%= rdEntry.getValue()%><%= primaryRegDistribution.get(addr) == null ? 0 : primaryRegDistribution.get(addr)%>
+ +<% } } catch(Exception ex) { %> Unknown Issue with Regions
@@ -1296,41 +1258,6 @@ <% } %>
-<% } -} catch(TableNotFoundException e) { %> -
-
- -
-


-

Go Back -

<% -} catch(IllegalArgumentException e) { %> -
-
- -
-


-

Go Back -

<% - } -} -else { // handle the case for fqtn is null or master is not initialized with error message + redirect -%> -
-
- -
-


- -

-<% } %> @@ -1338,78 +1265,90 @@ else { // handle the case for fqtn is null or master is not initialized with err From 9e4d233f46c3e563e7dc0aa5977f145cfc7e42a3 Mon Sep 17 00:00:00 2001 From: Akshay Sudheer <74921542+AkshayTSudheer@users.noreply.github.com> Date: Wed, 3 Mar 2021 09:38:55 +0530 Subject: [PATCH 4/5] HBASE-25402 Sorting order by start key or end key is not considering empty start key/end key (#2955) Signed-off-by: Duo Zhang Signed-off-by: Pankaj Kumar (cherry picked from commit 157200ef8375a91905efb3589393f2ef2b58b970) --- .../hadoop/hbase/tmpl/regionserver/RSStatusTmpl.jamon | 7 ++++++- .../src/main/resources/hbase-webapps/master/table.jsp | 8 ++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) 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 a2dc825c2cfb..7aee8a38d5b0 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -1311,7 +1311,9 @@ $(document).ready(function() 3: {sorter: 'separator'}, 4: {sorter: 'filesize'}, 5: {sorter: 'separator'}, - 6: {sorter: 'filesize'} + 6: {sorter: 'filesize'}, + 7: {empty: 'emptyMin'}, + 8: {empty: 'emptyMax'} } }); $("#metaTableBaseStatsTable").tablesorter({ @@ -1320,7 +1322,9 @@ $(document).ready(function() 3: {sorter: 'separator'}, 4: {sorter: 'filesize'}, 5: {sorter: 'separator'}, - 6: {sorter: 'filesize'} + 6: {sorter: 'filesize'}, + 7: {empty: 'emptyMin'}, + 8: {empty: 'emptyMax'} } }); $("#tableLocalityStatsTable").tablesorter({ From 59d05d608c414e77a75a223fcf824fcc4c280e9f Mon Sep 17 00:00:00 2001 From: Peng Lu Date: Thu, 5 Sep 2024 20:07:36 +0800 Subject: [PATCH 5/5] HBASE-28778 NPE may occur when opening master-status or table.jsp or procedure.jsp while Master is initializing (#6152) Signed-off-by: Duo Zhang (cherry picked from commit 3caaf2d739106b56ab94a0561e730ff35802610d) --- .../resources/hbase-webapps/master/table.jsp | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) 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 7aee8a38d5b0..f9b6120196cf 100644 --- a/hbase-server/src/main/resources/hbase-webapps/master/table.jsp +++ b/hbase-server/src/main/resources/hbase-webapps/master/table.jsp @@ -147,11 +147,32 @@ 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 = master.getConnection().getTable(TableName.valueOf(fqtn)); boolean showFragmentation = conf.getBoolean("hbase.master.ui.fragmentation.enabled", false); @@ -200,24 +221,6 @@ final MetaBrowser metaBrowser = new MetaBrowser(connection, request); %> - - - - -<% // handle the case for fqtn is null or master is not initialized with error message + redirect - if (fqtn == null || ! master.isInitialized()) { %> -
-
- -
-


- -

-<% return; - } %> - <% // unknow table if (! admin.tableExists(TableName.valueOf(fqtn)).get()) { %>