HBASE-23278 Add a table-level compaction progress display on the UI (#816)
Signed-off-by: Guangxu Cheng <gxcheng@apache.org>
This commit is contained in:
parent
3ba71fe589
commit
e83bb205f4
|
@ -140,10 +140,7 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
try {
|
try {
|
||||||
table = master.getConnection().getTable(TableName.valueOf(fqtn));
|
table = master.getConnection().getTable(TableName.valueOf(fqtn));
|
||||||
if (table.getDescriptor().getRegionReplication() > 1) {
|
if (table.getDescriptor().getRegionReplication() > 1) {
|
||||||
tableHeader = "<h2>Table Regions</h2><table id=\"tableRegionTable\" class=\"tablesorter table table-striped\" style=\"table-layout: fixed; word-wrap: break-word;\"><thead><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></thead>";
|
|
||||||
withReplica = true;
|
withReplica = true;
|
||||||
} else {
|
|
||||||
tableHeader = "<h2>Table Regions</h2><table id=\"tableRegionTable\" class=\"tablesorter table table-striped\" style=\"table-layout: fixed; word-wrap: break-word;\"><thead><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></thead>";
|
|
||||||
}
|
}
|
||||||
if ( !readOnly && action != null ) {
|
if ( !readOnly && action != null ) {
|
||||||
%>
|
%>
|
||||||
|
@ -199,70 +196,161 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
<%
|
<%
|
||||||
if(fqtn.equals(TableName.META_TABLE_NAME.getNameAsString())) {
|
if(fqtn.equals(TableName.META_TABLE_NAME.getNameAsString())) {
|
||||||
%>
|
%>
|
||||||
<%= tableHeader %>
|
<h2>Table Regions</h2>
|
||||||
<tbody>
|
<div class="tabbable">
|
||||||
<%
|
<ul class="nav nav-pills">
|
||||||
// NOTE: Presumes meta with one or more replicas
|
<li class="active">
|
||||||
for (int j = 0; j < numMetaReplicas; j++) {
|
<a href="#metaTab_baseStats" data-toggle="tab">Base Stats</a>
|
||||||
RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica(
|
</li>
|
||||||
RegionInfoBuilder.FIRST_META_REGIONINFO, j);
|
<li class="">
|
||||||
ServerName metaLocation = MetaTableLocator.waitMetaRegionLocation(master.getZooKeeper(), j, 1);
|
<a href="#metaTab_compactStats" data-toggle="tab">Compactions</a>
|
||||||
for (int i = 0; i < 1; i++) {
|
</li>
|
||||||
String hostAndPort = "";
|
</ul>
|
||||||
String readReq = "N/A";
|
<div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">
|
||||||
String writeReq = "N/A";
|
<div class="tab-pane active" id="metaTab_baseStats">
|
||||||
String fileSize = ZEROMB;
|
<table id="tableRegionTable" class="tablesorter table table-striped">
|
||||||
String fileCount = "N/A";
|
<thead>
|
||||||
String memSize = ZEROMB;
|
<tr>
|
||||||
float locality = 0.0f;
|
<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>
|
||||||
|
<%
|
||||||
|
if (withReplica) {
|
||||||
|
%>
|
||||||
|
<th>ReplicaID</th>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
// NOTE: Presumes meta with one or more replicas
|
||||||
|
for (int j = 0; j < numMetaReplicas; j++) {
|
||||||
|
RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica(
|
||||||
|
RegionInfoBuilder.FIRST_META_REGIONINFO, j);
|
||||||
|
ServerName metaLocation = MetaTableLocator.waitMetaRegionLocation(master.getZooKeeper(), j, 1);
|
||||||
|
for (int i = 0; i < 1; i++) {
|
||||||
|
String hostAndPort = "";
|
||||||
|
String readReq = "N/A";
|
||||||
|
String writeReq = "N/A";
|
||||||
|
String fileSize = ZEROMB;
|
||||||
|
String fileCount = "N/A";
|
||||||
|
String memSize = ZEROMB;
|
||||||
|
float locality = 0.0f;
|
||||||
|
|
||||||
if (metaLocation != null) {
|
if (metaLocation != null) {
|
||||||
ServerMetrics sl = master.getServerManager().getLoad(metaLocation);
|
ServerMetrics sl = master.getServerManager().getLoad(metaLocation);
|
||||||
// The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely.
|
// The host name portion should be safe, but I don't know how we handle IDNs so err on the side of failing safely.
|
||||||
hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation);
|
hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation);
|
||||||
if (sl != null) {
|
if (sl != null) {
|
||||||
Map<byte[], RegionMetrics> map = sl.getRegionMetrics();
|
Map<byte[], RegionMetrics> map = sl.getRegionMetrics();
|
||||||
if (map.containsKey(meta.getRegionName())) {
|
if (map.containsKey(meta.getRegionName())) {
|
||||||
RegionMetrics load = map.get(meta.getRegionName());
|
RegionMetrics load = map.get(meta.getRegionName());
|
||||||
readReq = String.format("%,1d", load.getReadRequestCount());
|
readReq = String.format("%,1d", load.getReadRequestCount());
|
||||||
writeReq = String.format("%,1d", load.getWriteRequestCount());
|
writeReq = String.format("%,1d", load.getWriteRequestCount());
|
||||||
double rSize = load.getStoreFileSize().get(Size.Unit.BYTE);
|
double rSize = load.getStoreFileSize().get(Size.Unit.BYTE);
|
||||||
if (rSize > 0) {
|
if (rSize > 0) {
|
||||||
fileSize = StringUtils.byteDesc((long) rSize);
|
fileSize = StringUtils.byteDesc((long) rSize);
|
||||||
}
|
}
|
||||||
fileCount = String.format("%,1d", load.getStoreFileCount());
|
fileCount = String.format("%,1d", load.getStoreFileCount());
|
||||||
double mSize = load.getMemStoreSize().get(Size.Unit.BYTE);
|
double mSize = load.getMemStoreSize().get(Size.Unit.BYTE);
|
||||||
if (mSize > 0) {
|
if (mSize > 0) {
|
||||||
memSize = StringUtils.byteDesc((long)mSize);
|
memSize = StringUtils.byteDesc((long)mSize);
|
||||||
}
|
}
|
||||||
locality = load.getDataLocality();
|
locality = load.getDataLocality();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= escapeXml(meta.getRegionNameAsString()) %></td>
|
<td><%= escapeXml(meta.getRegionNameAsString()) %></td>
|
||||||
<td><a href="http://<%= hostAndPort %>/rs-status/"><%= StringEscapeUtils.escapeHtml4(hostAndPort) %></a></td>
|
<td><a href="http://<%= hostAndPort %>/rs-status/"><%= StringEscapeUtils.escapeHtml4(hostAndPort) %></a></td>
|
||||||
<td><%= readReq%></td>
|
<td><%= readReq%></td>
|
||||||
<td><%= writeReq%></td>
|
<td><%= writeReq%></td>
|
||||||
<td><%= fileSize%></td>
|
<td><%= fileSize%></td>
|
||||||
<td><%= fileCount%></td>
|
<td><%= fileCount%></td>
|
||||||
<td><%= memSize%></td>
|
<td><%= memSize%></td>
|
||||||
<td><%= locality%></td>
|
<td><%= locality%></td>
|
||||||
<td><%= escapeXml(Bytes.toString(meta.getStartKey())) %></td>
|
<td><%= escapeXml(Bytes.toString(meta.getStartKey())) %></td>
|
||||||
<td><%= escapeXml(Bytes.toString(meta.getEndKey())) %></td>
|
<td><%= escapeXml(Bytes.toString(meta.getEndKey())) %></td>
|
||||||
<%
|
<%
|
||||||
if (withReplica) {
|
if (withReplica) {
|
||||||
%>
|
%>
|
||||||
<td><%= meta.getReplicaId() %></td>
|
<td><%= meta.getReplicaId() %></td>
|
||||||
<%
|
<%
|
||||||
}
|
}
|
||||||
%>
|
%>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
<%} %>
|
<%} %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="metaTab_compactStats">
|
||||||
|
<table id="metaTableCompactStatsTable" class="tablesorter table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name</th>
|
||||||
|
<th>Region Server</th>
|
||||||
|
<th>Num. Compacting Cells</th>
|
||||||
|
<th>Num. Compacted Cells</th>
|
||||||
|
<th>Remaining Cells</th>
|
||||||
|
<th>Compaction Progress</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
// NOTE: Presumes meta with one or more replicas
|
||||||
|
for (int j = 0; j < numMetaReplicas; j++) {
|
||||||
|
RegionInfo meta = RegionReplicaUtil.getRegionInfoForReplica(
|
||||||
|
RegionInfoBuilder.FIRST_META_REGIONINFO, j);
|
||||||
|
ServerName metaLocation = MetaTableLocator.waitMetaRegionLocation(master.getZooKeeper(), j, 1);
|
||||||
|
for (int i = 0; i < 1; i++) {
|
||||||
|
String hostAndPort = "";
|
||||||
|
long compactingCells = 0;
|
||||||
|
long compactedCells = 0;
|
||||||
|
String compactionProgress = "";
|
||||||
|
|
||||||
|
if (metaLocation != null) {
|
||||||
|
ServerMetrics sl = master.getServerManager().getLoad(metaLocation);
|
||||||
|
hostAndPort = URLEncoder.encode(metaLocation.getHostname()) + ":" + master.getRegionServerInfoPort(metaLocation);
|
||||||
|
if (sl != null) {
|
||||||
|
Map<byte[], RegionMetrics> map = sl.getRegionMetrics();
|
||||||
|
if (map.containsKey(meta.getRegionName())) {
|
||||||
|
RegionMetrics load = map.get(meta.getRegionName());
|
||||||
|
compactingCells = load.getCompactingCellCount();
|
||||||
|
compactedCells = load.getCompactedCellCount();
|
||||||
|
if (compactingCells > 0) {
|
||||||
|
compactionProgress = String.format("%.2f", 100 * ((float)
|
||||||
|
compactedCells / compactingCells)) + "%";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<td><%= escapeXml(meta.getRegionNameAsString()) %></td>
|
||||||
|
<td><a href="http://<%= hostAndPort %>/rs-status/"><%= StringEscapeUtils.escapeHtml4(hostAndPort) %></a></td>
|
||||||
|
<td><%= String.format("%,1d", compactingCells)%></td>
|
||||||
|
<td><%= String.format("%,1d", compactedCells)%></td>
|
||||||
|
<td><%= String.format("%,1d", compactingCells - compactedCells)%></td>
|
||||||
|
<td><%= compactionProgress%></td>
|
||||||
|
</tr>
|
||||||
|
<% } %>
|
||||||
|
<%} %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<%} else {
|
<%} else {
|
||||||
RegionStates states = master.getAssignmentManager().getRegionStates();
|
RegionStates states = master.getAssignmentManager().getRegionStates();
|
||||||
Map<RegionState.State, List<RegionInfo>> regionStates = states.getRegionByStateOfTable(table.getName());
|
Map<RegionState.State, List<RegionInfo>> regionStates = states.getRegionByStateOfTable(table.getName());
|
||||||
|
@ -446,9 +534,11 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
long totalSize = 0;
|
long totalSize = 0;
|
||||||
long totalStoreFileCount = 0;
|
long totalStoreFileCount = 0;
|
||||||
long totalMemSize = 0;
|
long totalMemSize = 0;
|
||||||
|
long totalCompactingCells = 0;
|
||||||
|
long totalCompactedCells = 0;
|
||||||
|
String totalCompactionProgress = "";
|
||||||
String totalMemSizeStr = ZEROMB;
|
String totalMemSizeStr = ZEROMB;
|
||||||
String totalSizeStr = ZEROMB;
|
String totalSizeStr = ZEROMB;
|
||||||
String urlRegionServer = null;
|
|
||||||
Map<ServerName, Integer> regDistribution = new TreeMap<>();
|
Map<ServerName, Integer> regDistribution = new TreeMap<>();
|
||||||
Map<ServerName, Integer> primaryRegDistribution = new TreeMap<>();
|
Map<ServerName, Integer> primaryRegDistribution = new TreeMap<>();
|
||||||
List<HRegionLocation> regions = r.getAllRegionLocations();
|
List<HRegionLocation> regions = r.getAllRegionLocations();
|
||||||
|
@ -464,13 +554,15 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
if (sl != null) {
|
if (sl != null) {
|
||||||
RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName());
|
RegionMetrics regionMetrics = sl.getRegionMetrics().get(regionInfo.getRegionName());
|
||||||
regionsToLoad.put(regionInfo, regionMetrics);
|
regionsToLoad.put(regionInfo, regionMetrics);
|
||||||
if(regionMetrics != null) {
|
if (regionMetrics != null) {
|
||||||
totalReadReq += regionMetrics.getReadRequestCount();
|
totalReadReq += regionMetrics.getReadRequestCount();
|
||||||
totalWriteReq += regionMetrics.getWriteRequestCount();
|
totalWriteReq += regionMetrics.getWriteRequestCount();
|
||||||
totalSize += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
|
totalSize += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
|
||||||
totalStoreFileCount += regionMetrics.getStoreFileCount();
|
totalStoreFileCount += regionMetrics.getStoreFileCount();
|
||||||
totalMemSize += regionMetrics.getMemStoreSize().get(Size.Unit.MEGABYTE);
|
totalMemSize += regionMetrics.getMemStoreSize().get(Size.Unit.MEGABYTE);
|
||||||
totalStoreFileSizeMB += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
|
totalStoreFileSizeMB += regionMetrics.getStoreFileSize().get(Size.Unit.MEGABYTE);
|
||||||
|
totalCompactingCells += regionMetrics.getCompactingCellCount();
|
||||||
|
totalCompactedCells += regionMetrics.getCompactedCellCount();
|
||||||
} else {
|
} else {
|
||||||
RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
|
RegionMetrics load0 = getEmptyRegionMetrics(regionInfo);
|
||||||
regionsToLoad.put(regionInfo, load0);
|
regionsToLoad.put(regionInfo, load0);
|
||||||
|
@ -490,134 +582,225 @@ if (fqtn != null && master.isInitialized()) {
|
||||||
if (totalMemSize > 0) {
|
if (totalMemSize > 0) {
|
||||||
totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024);
|
totalMemSizeStr = StringUtils.byteDesc(totalMemSize*1024l*1024);
|
||||||
}
|
}
|
||||||
|
if (totalCompactingCells > 0) {
|
||||||
|
totalCompactionProgress = String.format("%.2f", 100 *
|
||||||
|
((float) totalCompactedCells / totalCompactingCells)) + "%";
|
||||||
|
}
|
||||||
|
|
||||||
if(regions != null && regions.size() > 0) { %>
|
if(regions != null && regions.size() > 0) { %>
|
||||||
<h2>Table Regions</h2>
|
<h2>Table Regions</h2>
|
||||||
<table id="regionServerDetailsTable" class="tablesorter table table-striped">
|
<div class="tabbable">
|
||||||
<thead>
|
<ul class="nav nav-pills">
|
||||||
<tr>
|
<li class="active">
|
||||||
<th>Name(<%= String.format("%,1d", regions.size())%>)</th>
|
<a href="#tab_baseStats" data-toggle="tab">Base Stats</a>
|
||||||
<th>Region Server</th>
|
</li>
|
||||||
<th>ReadRequests<br>(<%= String.format("%,1d", totalReadReq)%>)</th>
|
<li class="">
|
||||||
<th>WriteRequests<br>(<%= String.format("%,1d", totalWriteReq)%>)</th>
|
<a href="#tab_compactStats" data-toggle="tab">Compactions</a>
|
||||||
<th>StorefileSize<br>(<%= totalSizeStr %>)</th>
|
</li>
|
||||||
<th>Num.Storefiles<br>(<%= String.format("%,1d", totalStoreFileCount)%>)</th>
|
</ul>
|
||||||
<th>MemSize<br>(<%= totalMemSizeStr %>)</th>
|
<div class="tab-content" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">
|
||||||
<th>Locality</th>
|
<div class="tab-pane active" id="tab_baseStats">
|
||||||
<th>Start Key</th>
|
<table id="regionServerDetailsTable" class="tablesorter table table-striped">
|
||||||
<th>End Key</th>
|
<thead>
|
||||||
<th>Region State</th>
|
<tr>
|
||||||
<%
|
<th>Name(<%= String.format("%,1d", regions.size())%>)</th>
|
||||||
if (withReplica) {
|
<th>Region Server</th>
|
||||||
%>
|
<th>ReadRequests<br>(<%= String.format("%,1d", totalReadReq)%>)</th>
|
||||||
<th>ReplicaID</th>
|
<th>WriteRequests<br>(<%= String.format("%,1d", totalWriteReq)%>)</th>
|
||||||
<%
|
<th>StorefileSize<br>(<%= totalSizeStr %>)</th>
|
||||||
}
|
<th>Num.Storefiles<br>(<%= String.format("%,1d", totalStoreFileCount)%>)</th>
|
||||||
%>
|
<th>MemSize<br>(<%= totalMemSizeStr %>)</th>
|
||||||
</thead>
|
<th>Locality</th>
|
||||||
</tr>
|
<th>Start Key</th>
|
||||||
<tbody>
|
<th>End Key</th>
|
||||||
|
<th>Region State</th>
|
||||||
|
<%
|
||||||
|
if (withReplica) {
|
||||||
|
%>
|
||||||
|
<th>ReplicaID</th>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
List<Map.Entry<RegionInfo, RegionMetrics>> entryList = new ArrayList<>(regionsToLoad.entrySet());
|
||||||
|
numRegions = regions.size();
|
||||||
|
int numRegionsRendered = 0;
|
||||||
|
// render all regions
|
||||||
|
if (numRegionsToRender < 0) {
|
||||||
|
numRegionsToRender = numRegions;
|
||||||
|
}
|
||||||
|
for (Map.Entry<RegionInfo, RegionMetrics> hriEntry : entryList) {
|
||||||
|
RegionInfo regionInfo = hriEntry.getKey();
|
||||||
|
ServerName addr = regionsToServer.get(regionInfo);
|
||||||
|
RegionMetrics load = hriEntry.getValue();
|
||||||
|
String urlRegionServer = null;
|
||||||
|
String readReq = "N/A";
|
||||||
|
String writeReq = "N/A";
|
||||||
|
String regionSize = ZEROMB;
|
||||||
|
String fileCount = "N/A";
|
||||||
|
String memSize = ZEROMB;
|
||||||
|
float locality = 0.0f;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
fileCount = String.format("%,1d", load.getStoreFileCount());
|
||||||
|
double mSize = load.getMemStoreSize().get(Size.Unit.BYTE);
|
||||||
|
if (mSize > 0) {
|
||||||
|
memSize = StringUtils.byteDesc((long)mSize);
|
||||||
|
}
|
||||||
|
locality = load.getDataLocality();
|
||||||
|
}
|
||||||
|
|
||||||
<%
|
if (stateMap.containsKey(regionInfo.getEncodedName())) {
|
||||||
List<Map.Entry<RegionInfo, RegionMetrics>> entryList = new ArrayList<>(regionsToLoad.entrySet());
|
state = stateMap.get(regionInfo.getEncodedName()).toString();
|
||||||
numRegions = regions.size();
|
}
|
||||||
int numRegionsRendered = 0;
|
|
||||||
// render all regions
|
|
||||||
if (numRegionsToRender < 0) {
|
|
||||||
numRegionsToRender = numRegions;
|
|
||||||
}
|
|
||||||
for (Map.Entry<RegionInfo, RegionMetrics> hriEntry : entryList) {
|
|
||||||
RegionInfo regionInfo = hriEntry.getKey();
|
|
||||||
ServerName addr = regionsToServer.get(regionInfo);
|
|
||||||
RegionMetrics load = hriEntry.getValue();
|
|
||||||
String readReq = "N/A";
|
|
||||||
String writeReq = "N/A";
|
|
||||||
String regionSize = ZEROMB;
|
|
||||||
String fileCount = "N/A";
|
|
||||||
String memSize = ZEROMB;
|
|
||||||
float locality = 0.0f;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
fileCount = String.format("%,1d", load.getStoreFileCount());
|
|
||||||
double mSize = load.getMemStoreSize().get(Size.Unit.BYTE);
|
|
||||||
if (mSize > 0) {
|
|
||||||
memSize = StringUtils.byteDesc((long)mSize);
|
|
||||||
}
|
|
||||||
locality = load.getDataLocality();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stateMap.containsKey(regionInfo.getEncodedName())) {
|
if (addr != null) {
|
||||||
state = stateMap.get(regionInfo.getEncodedName()).toString();
|
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++;
|
||||||
|
%>
|
||||||
|
<tr>
|
||||||
|
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td>
|
||||||
|
<%
|
||||||
|
if (urlRegionServer != null) {
|
||||||
|
%>
|
||||||
|
<td>
|
||||||
|
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
|
||||||
|
</td>
|
||||||
|
<%
|
||||||
|
} else {
|
||||||
|
%>
|
||||||
|
<td class="undeployed-region">not deployed</td>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
<td><%= readReq%></td>
|
||||||
|
<td><%= writeReq%></td>
|
||||||
|
<td><%= regionSize%></td>
|
||||||
|
<td><%= fileCount%></td>
|
||||||
|
<td><%= memSize%></td>
|
||||||
|
<td><%= locality%></td>
|
||||||
|
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%></td>
|
||||||
|
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%></td>
|
||||||
|
<td><%= state%></td>
|
||||||
|
<%
|
||||||
|
if (withReplica) {
|
||||||
|
%>
|
||||||
|
<td><%= regionInfo.getReplicaId() %></td>
|
||||||
|
<%
|
||||||
|
}
|
||||||
|
%>
|
||||||
|
</tr>
|
||||||
|
<% } %>
|
||||||
|
<% } %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% if (numRegions > numRegionsRendered) {
|
||||||
|
String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
|
||||||
|
%>
|
||||||
|
<p>This table has <b><%= numRegions %></b> regions in total, in order to improve the page load time,
|
||||||
|
only <b><%= numRegionsRendered %></b> regions are displayed here, <a href="<%= allRegionsUrl %>">click
|
||||||
|
here</a> to see all regions.</p>
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="tab_compactStats">
|
||||||
|
<table id="tableCompactStatsTable" class="tablesorter table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Name(<%= String.format("%,1d", regions.size())%>)</th>
|
||||||
|
<th>Region Server</th>
|
||||||
|
<th>Num. Compacting Cells<br>(<%= String.format("%,1d", totalCompactingCells)%>)</th>
|
||||||
|
<th>Num. Compacted Cells<br>(<%= String.format("%,1d", totalCompactedCells)%>)</th>
|
||||||
|
<th>Remaining Cells<br>(<%= String.format("%,1d", totalCompactingCells-totalCompactedCells)%>)</th>
|
||||||
|
<th>Compaction Progress<br>(<%= totalCompactionProgress %>)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<%
|
||||||
|
numRegionsRendered = 0;
|
||||||
|
for (Map.Entry<RegionInfo, RegionMetrics> hriEntry : entryList) {
|
||||||
|
RegionInfo regionInfo = hriEntry.getKey();
|
||||||
|
ServerName addr = regionsToServer.get(regionInfo);
|
||||||
|
RegionMetrics load = hriEntry.getValue();
|
||||||
|
String urlRegionServer = null;
|
||||||
|
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) {
|
if (addr != null) {
|
||||||
ServerMetrics sl = master.getServerManager().getLoad(addr);
|
// This port might be wrong if RS actually ended up using something else.
|
||||||
// This port might be wrong if RS actually ended up using something else.
|
urlRegionServer =
|
||||||
urlRegionServer =
|
"//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status";
|
||||||
"//" + URLEncoder.encode(addr.getHostname()) + ":" + master.getRegionServerInfoPort(addr) + "/rs-status";
|
}
|
||||||
if(sl != null) {
|
|
||||||
Integer i = regDistribution.get(addr);
|
if (numRegionsRendered < numRegionsToRender) {
|
||||||
if (null == i) i = Integer.valueOf(0);
|
numRegionsRendered++;
|
||||||
regDistribution.put(addr, i + 1);
|
%>
|
||||||
if (withReplica && RegionReplicaUtil.isDefaultReplica(regionInfo.getReplicaId())) {
|
<tr>
|
||||||
i = primaryRegDistribution.get(addr);
|
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td>
|
||||||
if (null == i) i = Integer.valueOf(0);
|
<%
|
||||||
primaryRegDistribution.put(addr, i+1);
|
if (urlRegionServer != null) {
|
||||||
}
|
%>
|
||||||
}
|
<td>
|
||||||
}
|
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
|
||||||
if (numRegionsRendered < numRegionsToRender) {
|
</td>
|
||||||
numRegionsRendered++;
|
<%
|
||||||
%>
|
} else {
|
||||||
<tr>
|
%>
|
||||||
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getRegionName())) %></td>
|
<td class="undeployed-region">not deployed</td>
|
||||||
<%
|
<%
|
||||||
if (urlRegionServer != null) {
|
}
|
||||||
%>
|
%>
|
||||||
<td>
|
<td><%= String.format("%,1d", compactingCells)%></td>
|
||||||
<a href="<%= urlRegionServer %>"><%= addr == null? "-": StringEscapeUtils.escapeHtml4(addr.getHostname().toString()) + ":" + master.getRegionServerInfoPort(addr) %></a>
|
<td><%= String.format("%,1d", compactedCells)%></td>
|
||||||
</td>
|
<td><%= String.format("%,1d", compactingCells - compactedCells)%></td>
|
||||||
<%
|
<td><%= compactionProgress%></td>
|
||||||
} else {
|
</tr>
|
||||||
%>
|
<% } %>
|
||||||
<td class="undeployed-region">not deployed</td>
|
<% } %>
|
||||||
<%
|
</tbody>
|
||||||
}
|
</table>
|
||||||
%>
|
<% if (numRegions > numRegionsRendered) {
|
||||||
<td><%= readReq%></td>
|
String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
|
||||||
<td><%= writeReq%></td>
|
%>
|
||||||
<td><%= regionSize%></td>
|
<p>This table has <b><%= numRegions %></b> regions in total, in order to improve the page load time,
|
||||||
<td><%= fileCount%></td>
|
only <b><%= numRegionsRendered %></b> regions are displayed here, <a href="<%= allRegionsUrl %>">click
|
||||||
<td><%= memSize%></td>
|
here</a> to see all regions.</p>
|
||||||
<td><%= locality%></td>
|
<% } %>
|
||||||
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getStartKey()))%></td>
|
</div>
|
||||||
<td><%= escapeXml(Bytes.toStringBinary(regionInfo.getEndKey()))%></td>
|
</div>
|
||||||
<td><%= state%></td>
|
</div>
|
||||||
<%
|
|
||||||
if (withReplica) {
|
|
||||||
%>
|
|
||||||
<td><%= regionInfo.getReplicaId() %></td>
|
|
||||||
<%
|
|
||||||
}
|
|
||||||
%>
|
|
||||||
</tr>
|
|
||||||
<% } %>
|
|
||||||
<% } %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
<% if (numRegions > numRegionsRendered) {
|
|
||||||
String allRegionsUrl = "?name=" + URLEncoder.encode(fqtn,"UTF-8") + "&numRegions=all";
|
|
||||||
%>
|
|
||||||
<p>This table has <b><%= numRegions %></b> regions in total, in order to improve the page load time,
|
|
||||||
only <b><%= numRegionsRendered %></b> regions are displayed here, <a href="<%= allRegionsUrl %>">click
|
|
||||||
here</a> to see all regions.</p>
|
|
||||||
<% } %>
|
|
||||||
<h2>Regions by Region Server</h2>
|
<h2>Regions by Region Server</h2>
|
||||||
<%
|
<%
|
||||||
if (withReplica) {
|
if (withReplica) {
|
||||||
|
@ -851,6 +1034,20 @@ $(document).ready(function()
|
||||||
6: {sorter: 'filesize'}
|
6: {sorter: 'filesize'}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
$("#tableCompactStatsTable").tablesorter({
|
||||||
|
headers: {
|
||||||
|
2: {sorter: 'separator'},
|
||||||
|
3: {sorter: 'separator'},
|
||||||
|
4: {sorter: 'separator'}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("#metaTableCompactStatsTable").tablesorter({
|
||||||
|
headers: {
|
||||||
|
2: {sorter: 'separator'},
|
||||||
|
3: {sorter: 'separator'},
|
||||||
|
4: {sorter: 'separator'}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue