Skip to content

Commit

Permalink
Revert "HBASE-23994:Add WebUI to Canary (apache#1292)"
Browse files Browse the repository at this point in the history
This reverts commit daf79de.
  • Loading branch information
ndimiduk authored and thangTang committed Apr 16, 2020
1 parent 891b029 commit 94a633d
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 437 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import java.io.Closeable;
import java.io.IOException;
import java.net.BindException;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -40,7 +39,6 @@
import java.util.TreeSet;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -83,7 +81,6 @@
import org.apache.hadoop.hbase.client.TableDescriptor;
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
import org.apache.hadoop.hbase.filter.FirstKeyOnlyFilter;
import org.apache.hadoop.hbase.http.InfoServer;
import org.apache.hadoop.hbase.tool.CanaryTool.RegionTask.TaskType;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
Expand Down Expand Up @@ -125,37 +122,6 @@
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.TOOLS)
public class CanaryTool implements Tool, Canary {
public static final String HBASE_CANARY_INFO_PORT = "hbase.canary.info.port";

public static final int DEFAULT_CANARY_INFOPORT = 16050;

public static final String HBASE_CANARY_INFO_BINDADDRESS = "hbase.canary.info.bindAddress";

private InfoServer infoServer;

private void putUpWebUI() throws IOException {
int port = conf.getInt(HBASE_CANARY_INFO_PORT, DEFAULT_CANARY_INFOPORT);
// -1 is for disabling info server
if (port < 0) {
return;
}
if (zookeeperMode) {
LOG.info("WebUI is not supported in Zookeeper mode");
} else if (regionServerMode) {
LOG.info("WebUI is not supported in RegionServer mode");
} else {
String addr = conf.get(HBASE_CANARY_INFO_BINDADDRESS, "0.0.0.0");
try {
infoServer = new InfoServer("canary", addr, port, false, conf);
infoServer.addUnprivilegedServlet("canary", "/canary-status", CanaryStatusServlet.class);
infoServer.setAttribute("sink", this.sink);
infoServer.start();
LOG.info("Bind Canary http info server to {}:{} ", addr, port);
} catch (BindException e) {
LOG.warn("Failed binding Canary http info server to {}:{}", addr, port, e);
}
}
}

@Override
public int checkRegions(String[] targets) throws Exception {
Expand Down Expand Up @@ -307,53 +273,17 @@ public void publishReadTiming(String znode, String server, long msTime) {
public static class RegionStdOutSink extends StdOutSink {
private Map<String, LongAdder> perTableReadLatency = new HashMap<>();
private LongAdder writeLatency = new LongAdder();
private final ConcurrentMap<String, List<RegionTaskResult>> regionMap =
new ConcurrentHashMap<>();
private ConcurrentMap<ServerName, LongAdder> perServerFailuresCount =
new ConcurrentHashMap<>();
private ConcurrentMap<String, LongAdder> perTableFailuresCount = new ConcurrentHashMap<>();

public ConcurrentMap<ServerName, LongAdder> getPerServerFailuresCount() {
return perServerFailuresCount;
}

public ConcurrentMap<String, LongAdder> getPerTableFailuresCount() {
return perTableFailuresCount;
}

public void resetFailuresCountDetails() {
perServerFailuresCount.clear();
perTableFailuresCount.clear();
}

private void incFailuresCountDetails(ServerName serverName, RegionInfo region) {
perServerFailuresCount.compute(serverName, (server, count) -> {
if (count == null) {
count = new LongAdder();
}
count.increment();
return count;
});
perTableFailuresCount.compute(region.getTable().getNameAsString(), (tableName, count) -> {
if (count == null) {
count = new LongAdder();
}
count.increment();
return count;
});
}
private final Map<String, List<RegionTaskResult>> regionMap = new ConcurrentHashMap<>();

public void publishReadFailure(ServerName serverName, RegionInfo region, Exception e) {
incReadFailureCount();
incFailuresCountDetails(serverName, region);
LOG.error("Read from {} on serverName={} failed",
region.getRegionNameAsString(), serverName, e);
}

public void publishReadFailure(ServerName serverName, RegionInfo region,
ColumnFamilyDescriptor column, Exception e) {
incReadFailureCount();
incFailuresCountDetails(serverName, region);
LOG.error("Read from {} on serverName={}, columnFamily={} failed",
region.getRegionNameAsString(), serverName,
column.getNameAsString(), e);
Expand All @@ -374,14 +304,12 @@ public void publishReadTiming(ServerName serverName, RegionInfo region,

public void publishWriteFailure(ServerName serverName, RegionInfo region, Exception e) {
incWriteFailureCount();
incFailuresCountDetails(serverName, region);
LOG.error("Write to {} on {} failed", region.getRegionNameAsString(), serverName, e);
}

public void publishWriteFailure(ServerName serverName, RegionInfo region,
ColumnFamilyDescriptor column, Exception e) {
incWriteFailureCount();
incFailuresCountDetails(serverName, region);
LOG.error("Write to {} on {} {} failed", region.getRegionNameAsString(), serverName,
column.getNameAsString(), e);
}
Expand Down Expand Up @@ -417,7 +345,7 @@ public LongAdder getWriteLatency() {
return this.writeLatency;
}

public ConcurrentMap<String, List<RegionTaskResult>> getRegionMap() {
public Map<String, List<RegionTaskResult>> getRegionMap() {
return this.regionMap;
}

Expand Down Expand Up @@ -980,7 +908,6 @@ public int run(String[] args) throws Exception {
System.arraycopy(args, index, monitorTargets, 0, length);
}

putUpWebUI();
if (zookeeperMode) {
return checkZooKeeper();
} else if (regionServerMode) {
Expand Down Expand Up @@ -1425,7 +1352,6 @@ public void run() {
try {
List<Future<Void>> taskFutures = new LinkedList<>();
RegionStdOutSink regionSink = this.getSink();
regionSink.resetFailuresCountDetails();
if (this.targets != null && this.targets.length > 0) {
String[] tables = generateMonitorTables(this.targets);
// Check to see that each table name passed in the -readTableTimeouts argument is also
Expand Down
20 changes: 0 additions & 20 deletions hbase-server/src/main/resources/hbase-webapps/canary/canary.jsp

This file was deleted.

Loading

0 comments on commit 94a633d

Please sign in to comment.