HBASE-15219 Revert pending verification of test result
This commit is contained in:
parent
85e1d9a109
commit
454e45f50d
|
@ -94,11 +94,9 @@ import org.apache.hadoop.util.ToolRunner;
|
||||||
public final class Canary implements Tool {
|
public final class Canary implements Tool {
|
||||||
// Sink interface used by the canary to outputs information
|
// Sink interface used by the canary to outputs information
|
||||||
public interface Sink {
|
public interface Sink {
|
||||||
public long getReadFailureCount();
|
|
||||||
public void publishReadFailure(HRegionInfo region, Exception e);
|
public void publishReadFailure(HRegionInfo region, Exception e);
|
||||||
public void publishReadFailure(HRegionInfo region, HColumnDescriptor column, Exception e);
|
public void publishReadFailure(HRegionInfo region, HColumnDescriptor column, Exception e);
|
||||||
public void publishReadTiming(HRegionInfo region, HColumnDescriptor column, long msTime);
|
public void publishReadTiming(HRegionInfo region, HColumnDescriptor column, long msTime);
|
||||||
public long getWriteFailureCount();
|
|
||||||
public void publishWriteFailure(HRegionInfo region, Exception e);
|
public void publishWriteFailure(HRegionInfo region, Exception e);
|
||||||
public void publishWriteFailure(HRegionInfo region, HColumnDescriptor column, Exception e);
|
public void publishWriteFailure(HRegionInfo region, HColumnDescriptor column, Exception e);
|
||||||
public void publishWriteTiming(HRegionInfo region, HColumnDescriptor column, long msTime);
|
public void publishWriteTiming(HRegionInfo region, HColumnDescriptor column, long msTime);
|
||||||
|
@ -113,23 +111,13 @@ public final class Canary implements Tool {
|
||||||
// Simple implementation of canary sink that allows to plot on
|
// Simple implementation of canary sink that allows to plot on
|
||||||
// file or standard output timings or failures.
|
// file or standard output timings or failures.
|
||||||
public static class StdOutSink implements Sink {
|
public static class StdOutSink implements Sink {
|
||||||
protected AtomicLong readFailureCount = new AtomicLong(0),
|
|
||||||
writeFailureCount = new AtomicLong(0);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getReadFailureCount() {
|
|
||||||
return readFailureCount.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishReadFailure(HRegionInfo region, Exception e) {
|
public void publishReadFailure(HRegionInfo region, Exception e) {
|
||||||
readFailureCount.incrementAndGet();
|
|
||||||
LOG.error(String.format("read from region %s failed", region.getRegionNameAsString()), e);
|
LOG.error(String.format("read from region %s failed", region.getRegionNameAsString()), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishReadFailure(HRegionInfo region, HColumnDescriptor column, Exception e) {
|
public void publishReadFailure(HRegionInfo region, HColumnDescriptor column, Exception e) {
|
||||||
readFailureCount.incrementAndGet();
|
|
||||||
LOG.error(String.format("read from region %s column family %s failed",
|
LOG.error(String.format("read from region %s column family %s failed",
|
||||||
region.getRegionNameAsString(), column.getNameAsString()), e);
|
region.getRegionNameAsString(), column.getNameAsString()), e);
|
||||||
}
|
}
|
||||||
|
@ -140,20 +128,13 @@ public final class Canary implements Tool {
|
||||||
region.getRegionNameAsString(), column.getNameAsString(), msTime));
|
region.getRegionNameAsString(), column.getNameAsString(), msTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getWriteFailureCount() {
|
|
||||||
return writeFailureCount.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishWriteFailure(HRegionInfo region, Exception e) {
|
public void publishWriteFailure(HRegionInfo region, Exception e) {
|
||||||
writeFailureCount.incrementAndGet();
|
|
||||||
LOG.error(String.format("write to region %s failed", region.getRegionNameAsString()), e);
|
LOG.error(String.format("write to region %s failed", region.getRegionNameAsString()), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishWriteFailure(HRegionInfo region, HColumnDescriptor column, Exception e) {
|
public void publishWriteFailure(HRegionInfo region, HColumnDescriptor column, Exception e) {
|
||||||
writeFailureCount.incrementAndGet();
|
|
||||||
LOG.error(String.format("write to region %s column family %s failed",
|
LOG.error(String.format("write to region %s column family %s failed",
|
||||||
region.getRegionNameAsString(), column.getNameAsString()), e);
|
region.getRegionNameAsString(), column.getNameAsString()), e);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +150,6 @@ public final class Canary implements Tool {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publishReadFailure(String table, String server) {
|
public void publishReadFailure(String table, String server) {
|
||||||
readFailureCount.incrementAndGet();
|
|
||||||
LOG.error(String.format("Read from table:%s on region server:%s", table, server));
|
LOG.error(String.format("Read from table:%s on region server:%s", table, server));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +435,6 @@ public final class Canary implements Tool {
|
||||||
private boolean regionServerMode = false;
|
private boolean regionServerMode = false;
|
||||||
private boolean regionServerAllRegions = false;
|
private boolean regionServerAllRegions = false;
|
||||||
private boolean writeSniffing = false;
|
private boolean writeSniffing = false;
|
||||||
private boolean treatFailureAsError = false;
|
|
||||||
private TableName writeTableName = DEFAULT_WRITE_TABLE_NAME;
|
private TableName writeTableName = DEFAULT_WRITE_TABLE_NAME;
|
||||||
|
|
||||||
private ExecutorService executor; // threads to retrieve data from regionservers
|
private ExecutorService executor; // threads to retrieve data from regionservers
|
||||||
|
@ -519,8 +498,6 @@ public final class Canary implements Tool {
|
||||||
this.regionServerAllRegions = true;
|
this.regionServerAllRegions = true;
|
||||||
} else if(cmd.equals("-writeSniffing")) {
|
} else if(cmd.equals("-writeSniffing")) {
|
||||||
this.writeSniffing = true;
|
this.writeSniffing = true;
|
||||||
} else if(cmd.equals("-treatFailureAsError")) {
|
|
||||||
this.treatFailureAsError = true;
|
|
||||||
} else if (cmd.equals("-e")) {
|
} else if (cmd.equals("-e")) {
|
||||||
this.useRegExp = true;
|
this.useRegExp = true;
|
||||||
} else if (cmd.equals("-t")) {
|
} else if (cmd.equals("-t")) {
|
||||||
|
@ -625,7 +602,7 @@ public final class Canary implements Tool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.failOnError && monitor.finalCheckForErrors()) {
|
if (this.failOnError && monitor.hasError()) {
|
||||||
monitorThread.interrupt();
|
monitorThread.interrupt();
|
||||||
return monitor.errorCode;
|
return monitor.errorCode;
|
||||||
}
|
}
|
||||||
|
@ -661,7 +638,6 @@ public final class Canary implements Tool {
|
||||||
" default is true");
|
" default is true");
|
||||||
System.err.println(" -t <N> timeout for a check, default is 600000 (milisecs)");
|
System.err.println(" -t <N> timeout for a check, default is 600000 (milisecs)");
|
||||||
System.err.println(" -writeSniffing enable the write sniffing in canary");
|
System.err.println(" -writeSniffing enable the write sniffing in canary");
|
||||||
System.err.println(" -treatFailureAsError treats read / write failure as error");
|
|
||||||
System.err.println(" -writeTable The table used for write sniffing."
|
System.err.println(" -writeTable The table used for write sniffing."
|
||||||
+ " Default is hbase:canary");
|
+ " Default is hbase:canary");
|
||||||
System.err
|
System.err
|
||||||
|
@ -689,12 +665,11 @@ public final class Canary implements Tool {
|
||||||
if (this.regionServerMode) {
|
if (this.regionServerMode) {
|
||||||
monitor =
|
monitor =
|
||||||
new RegionServerMonitor(connection, monitorTargets, this.useRegExp,
|
new RegionServerMonitor(connection, monitorTargets, this.useRegExp,
|
||||||
(ExtendedSink) this.sink, this.executor, this.regionServerAllRegions,
|
(ExtendedSink) this.sink, this.executor, this.regionServerAllRegions);
|
||||||
this.treatFailureAsError);
|
|
||||||
} else {
|
} else {
|
||||||
monitor =
|
monitor =
|
||||||
new RegionMonitor(connection, monitorTargets, this.useRegExp, this.sink, this.executor,
|
new RegionMonitor(connection, monitorTargets, this.useRegExp, this.sink, this.executor,
|
||||||
this.writeSniffing, this.writeTableName, this.treatFailureAsError);
|
this.writeSniffing, this.writeTableName);
|
||||||
}
|
}
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
|
@ -706,7 +681,6 @@ public final class Canary implements Tool {
|
||||||
protected Admin admin;
|
protected Admin admin;
|
||||||
protected String[] targets;
|
protected String[] targets;
|
||||||
protected boolean useRegExp;
|
protected boolean useRegExp;
|
||||||
protected boolean treatFailureAsError;
|
|
||||||
protected boolean initialized = false;
|
protected boolean initialized = false;
|
||||||
|
|
||||||
protected boolean done = false;
|
protected boolean done = false;
|
||||||
|
@ -722,27 +696,18 @@ public final class Canary implements Tool {
|
||||||
return errorCode != 0;
|
return errorCode != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean finalCheckForErrors() {
|
|
||||||
if (errorCode != 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return treatFailureAsError &&
|
|
||||||
(sink.getReadFailureCount() > 0 || sink.getWriteFailureCount() > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
if (this.admin != null) this.admin.close();
|
if (this.admin != null) this.admin.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Monitor(Connection connection, String[] monitorTargets, boolean useRegExp, Sink sink,
|
protected Monitor(Connection connection, String[] monitorTargets, boolean useRegExp, Sink sink,
|
||||||
ExecutorService executor, boolean treatFailureAsError) {
|
ExecutorService executor) {
|
||||||
if (null == connection) throw new IllegalArgumentException("connection shall not be null");
|
if (null == connection) throw new IllegalArgumentException("connection shall not be null");
|
||||||
|
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
this.targets = monitorTargets;
|
this.targets = monitorTargets;
|
||||||
this.useRegExp = useRegExp;
|
this.useRegExp = useRegExp;
|
||||||
this.treatFailureAsError = treatFailureAsError;
|
|
||||||
this.sink = sink;
|
this.sink = sink;
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
@ -782,9 +747,8 @@ public final class Canary implements Tool {
|
||||||
private int checkPeriod;
|
private int checkPeriod;
|
||||||
|
|
||||||
public RegionMonitor(Connection connection, String[] monitorTargets, boolean useRegExp,
|
public RegionMonitor(Connection connection, String[] monitorTargets, boolean useRegExp,
|
||||||
Sink sink, ExecutorService executor, boolean writeSniffing, TableName writeTableName,
|
Sink sink, ExecutorService executor, boolean writeSniffing, TableName writeTableName) {
|
||||||
boolean treatFailureAsError) {
|
super(connection, monitorTargets, useRegExp, sink, executor);
|
||||||
super(connection, monitorTargets, useRegExp, sink, executor, treatFailureAsError);
|
|
||||||
Configuration conf = connection.getConfiguration();
|
Configuration conf = connection.getConfiguration();
|
||||||
this.writeSniffing = writeSniffing;
|
this.writeSniffing = writeSniffing;
|
||||||
this.writeTableName = writeTableName;
|
this.writeTableName = writeTableName;
|
||||||
|
@ -1028,9 +992,8 @@ public final class Canary implements Tool {
|
||||||
private boolean allRegions;
|
private boolean allRegions;
|
||||||
|
|
||||||
public RegionServerMonitor(Connection connection, String[] monitorTargets, boolean useRegExp,
|
public RegionServerMonitor(Connection connection, String[] monitorTargets, boolean useRegExp,
|
||||||
ExtendedSink sink, ExecutorService executor, boolean allRegions,
|
ExtendedSink sink, ExecutorService executor, boolean allRegions) {
|
||||||
boolean treatFailureAsError) {
|
super(connection, monitorTargets, useRegExp, sink, executor);
|
||||||
super(connection, monitorTargets, useRegExp, sink, executor, treatFailureAsError);
|
|
||||||
this.allRegions = allRegions;
|
this.allRegions = allRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,7 +1088,7 @@ public final class Canary implements Tool {
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
this.errorCode = ERROR_EXIT_CODE;
|
this.errorCode = ERROR_EXIT_CODE;
|
||||||
LOG.error("Sniff regionserver interrupted!", e);
|
LOG.error("Sniff regionserver failed!", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,6 @@ Usage: bin/hbase org.apache.hadoop.hbase.tool.Canary [opts] [table1 [table2]...]
|
||||||
-f <B> stop whole program if first error occurs, default is true
|
-f <B> stop whole program if first error occurs, default is true
|
||||||
-t <N> timeout for a check, default is 600000 (milliseconds)
|
-t <N> timeout for a check, default is 600000 (milliseconds)
|
||||||
-writeSniffing enable the write sniffing in canary
|
-writeSniffing enable the write sniffing in canary
|
||||||
-treatFailureAsError treats read / write failure as error
|
|
||||||
-writeTable The table used for write sniffing. Default is hbase:canary
|
-writeTable The table used for write sniffing. Default is hbase:canary
|
||||||
-D<configProperty>=<value> assigning or override the configuration params
|
-D<configProperty>=<value> assigning or override the configuration params
|
||||||
----
|
----
|
||||||
|
@ -216,16 +215,6 @@ $ ${HBASE_HOME}/bin/hbase canary -writeSniffing -writeTable ns:canary
|
||||||
The default value size of each put is 10 bytes and you can set it by the config key:
|
The default value size of each put is 10 bytes and you can set it by the config key:
|
||||||
`hbase.canary.write.value.size`.
|
`hbase.canary.write.value.size`.
|
||||||
|
|
||||||
==== Treat read / write failure as error
|
|
||||||
|
|
||||||
By default, the canary tool only logs read failure, due to e.g. RetriesExhaustedException,
|
|
||||||
while returning normal exit code. To treat read / write failure as error, you can run canary
|
|
||||||
with the `-treatFailureAsError` option. When enabled, read / write failure would result in error
|
|
||||||
exit code.
|
|
||||||
----
|
|
||||||
$ ${HBASE_HOME}/bin/hbase canary --treatFailureAsError
|
|
||||||
----
|
|
||||||
|
|
||||||
==== Running Canary in a Kerberos-enabled Cluster
|
==== Running Canary in a Kerberos-enabled Cluster
|
||||||
|
|
||||||
To run Canary in a Kerberos-enabled cluster, configure the following two properties in _hbase-site.xml_:
|
To run Canary in a Kerberos-enabled cluster, configure the following two properties in _hbase-site.xml_:
|
||||||
|
|
Loading…
Reference in New Issue