HBASE-20307 LoadTestTool prints too much zookeeper logging (Colin Garcia)

This commit is contained in:
Andrew Purtell 2018-09-07 15:09:09 -07:00
parent c3419be003
commit 9af7bc6204
No known key found for this signature in database
GPG Key ID: 8597754DD5365CCD
1 changed files with 11 additions and 1 deletions

View File

@ -36,7 +36,10 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Admin;
@ -113,6 +116,8 @@ public class LoadTestTool extends AbstractHBaseTool {
protected static final String OPT_USAGE_COMPRESSION = "Compression type, " + protected static final String OPT_USAGE_COMPRESSION = "Compression type, " +
"one of " + Arrays.toString(Compression.Algorithm.values()); "one of " + Arrays.toString(Compression.Algorithm.values());
protected static final String OPT_VERBOSE = "verbose";
public static final String OPT_BLOOM = "bloom"; public static final String OPT_BLOOM = "bloom";
public static final String OPT_COMPRESSION = "compression"; public static final String OPT_COMPRESSION = "compression";
public static final String OPT_DEFERRED_LOG_FLUSH = "deferredlogflush"; public static final String OPT_DEFERRED_LOG_FLUSH = "deferredlogflush";
@ -186,7 +191,7 @@ public class LoadTestTool extends AbstractHBaseTool {
protected long startKey, endKey; protected long startKey, endKey;
protected boolean isWrite, isRead, isUpdate; protected boolean isVerbose, isWrite, isRead, isUpdate;
protected boolean deferredLogFlush; protected boolean deferredLogFlush;
// Column family options // Column family options
@ -314,6 +319,7 @@ public class LoadTestTool extends AbstractHBaseTool {
@Override @Override
protected void addOptions() { protected void addOptions() {
addOptNoArg("v", OPT_VERBOSE, "Will display a full readout of logs, including ZooKeeper");
addOptWithArg(OPT_ZK_QUORUM, "ZK quorum as comma-separated host names " + addOptWithArg(OPT_ZK_QUORUM, "ZK quorum as comma-separated host names " +
"without port numbers"); "without port numbers");
addOptWithArg(OPT_ZK_PARENT_NODE, "name of parent znode in zookeeper"); addOptWithArg(OPT_ZK_PARENT_NODE, "name of parent znode in zookeeper");
@ -416,6 +422,7 @@ public class LoadTestTool extends AbstractHBaseTool {
families = HFileTestUtil.DEFAULT_COLUMN_FAMILIES; families = HFileTestUtil.DEFAULT_COLUMN_FAMILIES;
} }
isVerbose = cmd.hasOption(OPT_VERBOSE);
isWrite = cmd.hasOption(OPT_WRITE); isWrite = cmd.hasOption(OPT_WRITE);
isRead = cmd.hasOption(OPT_READ); isRead = cmd.hasOption(OPT_READ);
isUpdate = cmd.hasOption(OPT_UPDATE); isUpdate = cmd.hasOption(OPT_UPDATE);
@ -565,6 +572,9 @@ public class LoadTestTool extends AbstractHBaseTool {
@Override @Override
protected int doWork() throws IOException { protected int doWork() throws IOException {
if (!isVerbose) {
LogManager.getLogger(ZooKeeper.class.getName()).setLevel(Level.WARN);
}
if (numTables > 1) { if (numTables > 1) {
return parallelLoadTables(); return parallelLoadTables();
} else { } else {