HBASE-26397 Display the excluded datanodes on regionserver UI (#3990)
Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
parent
65c5ea63e8
commit
6a060adc8b
|
@ -18,6 +18,7 @@
|
|||
|
||||
package org.apache.hadoop.hbase.regionserver;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
|
||||
/**
|
||||
|
@ -80,6 +81,11 @@ public interface MetricsRegionServerWrapper {
|
|||
*/
|
||||
long getWALFileSize();
|
||||
|
||||
/**
|
||||
* Get the excluded datanodes in the cache of this region server.
|
||||
*/
|
||||
List<String> getWALExcludeDNs();
|
||||
|
||||
/**
|
||||
* Get the number of WAL files with slow appends for this region server.
|
||||
*/
|
||||
|
|
|
@ -153,11 +153,17 @@ MetricsRegionServerWrapper mWrap;
|
|||
<tr>
|
||||
<th>Num. WAL Files</th>
|
||||
<th>Size. WAL Files</th>
|
||||
<th>WAL exclude DNs</th>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><% mWrap.getNumWALFiles() %></td>
|
||||
<td><% TraditionalBinaryPrefix.long2String(mWrap.getWALFileSize(), "B", 1) %></td>
|
||||
<td>
|
||||
<%for String exclude: mWrap.getWALExcludeDNs() %>
|
||||
<% exclude %><br>
|
||||
</%for>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</%def>
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.apache.hadoop.hbase.regionserver;
|
|||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.OptionalDouble;
|
||||
|
@ -27,6 +28,7 @@ import java.util.OptionalLong;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
|
||||
|
@ -36,6 +38,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
|
|||
import org.apache.hadoop.hbase.ServerName;
|
||||
import org.apache.hadoop.hbase.io.ByteBuffAllocator;
|
||||
import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
|
||||
import org.apache.hadoop.hbase.io.asyncfs.monitor.ExcludeDatanodeManager;
|
||||
import org.apache.hadoop.hbase.io.hfile.BlockCache;
|
||||
import org.apache.hadoop.hbase.io.hfile.CacheStats;
|
||||
import org.apache.hadoop.hbase.io.hfile.CombinedBlockCache;
|
||||
|
@ -129,10 +132,13 @@ class MetricsRegionServerWrapperImpl
|
|||
*/
|
||||
private DFSHedgedReadMetrics dfsHedgedReadMetrics;
|
||||
|
||||
private final ExcludeDatanodeManager excludeDatanodeManager;
|
||||
|
||||
public MetricsRegionServerWrapperImpl(final HRegionServer regionServer) {
|
||||
this.regionServer = regionServer;
|
||||
initBlockCache();
|
||||
initMobFileCache();
|
||||
this.excludeDatanodeManager = this.regionServer.getWalFactory().getExcludeDatanodeManager();
|
||||
|
||||
this.period = regionServer.getConfiguration().getLong(HConstants.REGIONSERVER_METRICS_PERIOD,
|
||||
HConstants.DEFAULT_REGIONSERVER_METRICS_PERIOD);
|
||||
|
@ -397,6 +403,17 @@ class MetricsRegionServerWrapperImpl
|
|||
return walFileSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWALExcludeDNs() {
|
||||
if (excludeDatanodeManager == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return excludeDatanodeManager.getExcludeDNs().entrySet()
|
||||
.stream()
|
||||
.map(e -> e.getKey().toString() + ", " + e.getValue())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNumWALSlowAppend() {
|
||||
return metricsWALSource.getSlowAppendCount();
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
package org.apache.hadoop.hbase.regionserver;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrapper {
|
||||
|
||||
@Override
|
||||
|
@ -365,6 +368,11 @@ public class MetricsRegionServerWrapperStub implements MetricsRegionServerWrappe
|
|||
return 1024000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWALExcludeDNs() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getNumWALSlowAppend() {
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue