This is an automated email from the ASF dual-hosted git repository. mwalch pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git
The following commit(s) were added to refs/heads/master by this push: new a84249c Update ClientOpts (#65) a84249c is described below commit a84249c353bbc8b921ef2d85a28256bdb528fa07 Author: Mike Walch <mwa...@apache.org> AuthorDate: Thu Mar 14 18:47:35 2019 -0400 Update ClientOpts (#65) * Reduce the number of options * Create clients using Accumulo.newClient() * Remove use MapReduce opts from Accumulo --- contrib/import-control.xml | 1 - .../apache/accumulo/testing/cli/ClientOpts.java | 100 +++++++++------------ .../testing/continuous/UndefinedAnalyzer.java | 3 +- .../testing/ingest/BulkImportDirectory.java | 7 +- .../apache/accumulo/testing/ingest/TestIngest.java | 9 +- .../accumulo/testing/ingest/VerifyIngest.java | 7 +- .../apache/accumulo/testing/mapreduce/RowHash.java | 14 +-- .../accumulo/testing/mapreduce/TeraSortIngest.java | 17 ++-- .../accumulo/testing/merkle/cli/CompareTables.java | 3 +- .../testing/merkle/cli/ComputeRootHash.java | 3 +- .../testing/merkle/cli/GenerateHashes.java | 3 +- .../testing/merkle/cli/ManualComparison.java | 3 +- .../testing/merkle/ingest/RandomWorkload.java | 3 +- .../accumulo/testing/randomwalk/bulk/Verify.java | 3 +- .../accumulo/testing/randomwalk/shard/Merge.java | 4 +- .../org/apache/accumulo/testing/stress/Scan.java | 3 +- .../org/apache/accumulo/testing/stress/Write.java | 3 +- 17 files changed, 93 insertions(+), 93 deletions(-) diff --git a/contrib/import-control.xml b/contrib/import-control.xml index df7f39d..60eae35 100644 --- a/contrib/import-control.xml +++ b/contrib/import-control.xml @@ -42,7 +42,6 @@ <allow class="org.apache.accumulo.core.metadata.MetadataTable"/> <allow class="org.apache.accumulo.core.replication.ReplicationTable"/> <allow class="org.apache.accumulo.core.spi.scan.HintScanPrioritizer"/> - <allow class="org.apache.accumulo.hadoopImpl.mapreduce.lib.MapReduceClientOnRequiredTable"/> <allow class="org.apache.accumulo.core.clientImpl.TabletServerBatchWriter"/> <allow class="org.apache.accumulo.core.util.SimpleThreadPool"/> <allow class="org.apache.accumulo.core.util.FastFormat"/> diff --git a/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java b/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java index 2689b97..3cd7823 100644 --- a/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java +++ b/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java @@ -24,10 +24,13 @@ import java.io.InputStream; import java.net.URL; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.Properties; -import org.apache.accumulo.core.client.Accumulo; -import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.conf.ClientProperty; import org.apache.accumulo.core.conf.ConfigurationTypeHelper; @@ -38,6 +41,7 @@ import org.apache.log4j.Logger; import com.beust.jcommander.IStringConverter; import com.beust.jcommander.Parameter; +import com.beust.jcommander.converters.IParameterSplitter; public class ClientOpts extends Help { @@ -82,27 +86,24 @@ public class ClientOpts extends Help { } } - @Parameter(names = {"-u", "--user"}, description = "Connection user") - private String principal = null; + public static class NullSplitter implements IParameterSplitter { + @Override + public List<String> split(String value) { + return Collections.singletonList(value); + } + } - @Parameter(names = "-p", converter = PasswordConverter.class, description = "Connection password") - private Password password = null; + @Parameter(names = {"-u", "--user"}, description = "Connection user") + public String principal = null; @Parameter(names = "--password", converter = PasswordConverter.class, description = "Enter the connection password", password = true) private Password securePassword = null; public AuthenticationToken getToken() { - return ClientProperty.getAuthenticationToken(getClientProperties()); + return ClientProperty.getAuthenticationToken(getClientProps()); } - @Parameter(names = {"-z", "--keepers"}, - description = "Comma separated list of zookeeper hosts (host:port,host:port)") - protected String zookeepers = null; - - @Parameter(names = {"-i", "--instance"}, description = "The name of the accumulo instance") - protected String instance = null; - @Parameter(names = {"-auths", "--auths"}, converter = AuthConverter.class, description = "the authorizations to use when reading or writing") public Authorizations auths = Authorizations.EMPTY; @@ -110,16 +111,14 @@ public class ClientOpts extends Help { @Parameter(names = "--debug", description = "turn on TRACE-level log messages") public boolean debug = false; - @Parameter(names = "--ssl", description = "Connect to accumulo over SSL") - private boolean sslEnabled = false; - - @Parameter(names = "--sasl", description = "Connecto to Accumulo using SASL (supports Kerberos)") - private boolean saslEnabled = false; - - @Parameter(names = "--config-file", description = "Read the given client config file. " + @Parameter(names = {"-c", "--config-file"}, description = "Read the given client config file. " + "If omitted, the classpath will be searched for file named accumulo-client.properties") private String clientConfigFile = null; + @Parameter(names = "-o", splitter = NullSplitter.class, description = "Overrides property in " + + "accumulo-client.properties. Expected format: -o <key>=<value>") + private List<String> overrides = new ArrayList<>(); + public void startDebugLogging() { if (debug) Logger.getLogger("org.apache.accumulo.testing").setLevel(Level.TRACE); @@ -128,8 +127,24 @@ public class ClientOpts extends Help { @Parameter(names = "--trace", description = "turn on distributed tracing") public boolean trace = false; - @Parameter(names = "--keytab", description = "Kerberos keytab on the local filesystem") - private String keytabPath = null; + public Map<String,String> getOverrides() { + Map<String,String> config = new HashMap<>(); + for (String prop : overrides) { + String[] propArgs = prop.split("=", 2); + if (propArgs.length == 2) { + String key = propArgs[0].trim(); + String value = propArgs[1].trim(); + if (key.isEmpty() || value.isEmpty()) { + throw new IllegalArgumentException("Invalid command line -o option: " + prop); + } else { + config.put(key, value); + } + } else { + throw new IllegalArgumentException("Invalid command line -o option: " + prop); + } + } + return config; + } @Override public void parseArgs(String programName, String[] args, Object... others) { @@ -139,25 +154,6 @@ public class ClientOpts extends Help { private Properties cachedProps = null; - public String getPrincipal() { - return ClientProperty.AUTH_PRINCIPAL.getValue(getClientProperties()); - } - - public void setPrincipal(String principal) { - this.principal = principal; - } - - public void setClientProperties(Properties clientProps) { - this.cachedProps = clientProps; - } - - /** - * @return {@link AccumuloClient} that must be closed by user - */ - public AccumuloClient createClient() { - return Accumulo.newClient().from(getClientProperties()).build(); - } - public String getClientConfigFile() { if (clientConfigFile == null) { URL clientPropsUrl = ClientOpts.class.getClassLoader() @@ -169,34 +165,20 @@ public class ClientOpts extends Help { return clientConfigFile; } - public Properties getClientProperties() { + public Properties getClientProps() { if (cachedProps == null) { cachedProps = new Properties(); if (getClientConfigFile() != null) { cachedProps = toProperties(Paths.get(getClientConfigFile())); } - if (saslEnabled) { - cachedProps.setProperty(ClientProperty.SASL_ENABLED.getKey(), "true"); - } - if (sslEnabled) { - cachedProps.setProperty(ClientProperty.SSL_ENABLED.getKey(), "true"); - } if (principal != null) { cachedProps.setProperty(ClientProperty.AUTH_PRINCIPAL.getKey(), principal); } - if (zookeepers != null) { - cachedProps.setProperty(ClientProperty.INSTANCE_ZOOKEEPERS.getKey(), zookeepers); - } - if (instance != null) { - cachedProps.setProperty(ClientProperty.INSTANCE_NAME.getKey(), instance); - } if (securePassword != null) { ClientProperty.setPassword(cachedProps, securePassword.toString()); - } else if (password != null) { - ClientProperty.setPassword(cachedProps, password.toString()); - } else if (keytabPath != null) { - ClientProperty.setKerberosKeytab(cachedProps, keytabPath); } + getOverrides().forEach(cachedProps::put); + ClientProperty.validate(cachedProps); } return cachedProps; } diff --git a/src/main/java/org/apache/accumulo/testing/continuous/UndefinedAnalyzer.java b/src/main/java/org/apache/accumulo/testing/continuous/UndefinedAnalyzer.java index 1c61bdb..ebf42dc 100644 --- a/src/main/java/org/apache/accumulo/testing/continuous/UndefinedAnalyzer.java +++ b/src/main/java/org/apache/accumulo/testing/continuous/UndefinedAnalyzer.java @@ -33,6 +33,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.data.Key; @@ -264,7 +265,7 @@ public class UndefinedAnalyzer { } } - try (AccumuloClient client = opts.createClient(); + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build(); BatchScanner bscanner = client.createBatchScanner(opts.tableName, opts.auths)) { List<Range> refs = new ArrayList<>(); diff --git a/src/main/java/org/apache/accumulo/testing/ingest/BulkImportDirectory.java b/src/main/java/org/apache/accumulo/testing/ingest/BulkImportDirectory.java index a75364c..2b3a2c3 100644 --- a/src/main/java/org/apache/accumulo/testing/ingest/BulkImportDirectory.java +++ b/src/main/java/org/apache/accumulo/testing/ingest/BulkImportDirectory.java @@ -18,6 +18,8 @@ package org.apache.accumulo.testing.ingest; import java.io.IOException; +import org.apache.accumulo.core.client.Accumulo; +import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; @@ -48,7 +50,8 @@ public class BulkImportDirectory { opts.parseArgs(BulkImportDirectory.class.getName(), args); fs.delete(new Path(opts.failures), true); fs.mkdirs(new Path(opts.failures)); - opts.createClient().tableOperations().importDirectory(opts.tableName, opts.source, - opts.failures, false); + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { + client.tableOperations().importDirectory(opts.tableName, opts.source, opts.failures, false); + } } } diff --git a/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java b/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java index a478659..7241578 100644 --- a/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java +++ b/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java @@ -24,6 +24,7 @@ import java.util.Random; import java.util.Set; import java.util.TreeSet; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; @@ -35,6 +36,7 @@ import org.apache.accumulo.core.client.rfile.RFile; import org.apache.accumulo.core.client.rfile.RFileWriter; import org.apache.accumulo.core.client.security.SecurityErrorCode; import org.apache.accumulo.core.clientImpl.TabletServerBatchWriter; +import org.apache.accumulo.core.conf.ClientProperty; import org.apache.accumulo.core.data.ConstraintViolationSummary; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; @@ -174,12 +176,12 @@ public class TestIngest { } } - public static void main(String[] args) throws Exception { + public static void main(String[] args) { Opts opts = new Opts(); opts.parseArgs(TestIngest.class.getName(), args); - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { if (opts.debug) Logger.getLogger(TabletServerBatchWriter.class.getName()).setLevel(Level.TRACE); @@ -215,7 +217,8 @@ public class TestIngest { } else { bw = client.createBatchWriter(opts.tableName); - client.securityOperations().changeUserAuthorizations(opts.getPrincipal(), AUTHS); + String principal = ClientProperty.AUTH_PRINCIPAL.getValue(opts.getClientProps()); + client.securityOperations().changeUserAuthorizations(principal, AUTHS); } Text labBA = new Text(opts.columnVisibility.getExpression()); diff --git a/src/main/java/org/apache/accumulo/testing/ingest/VerifyIngest.java b/src/main/java/org/apache/accumulo/testing/ingest/VerifyIngest.java index 9b01bc1..c403beb 100644 --- a/src/main/java/org/apache/accumulo/testing/ingest/VerifyIngest.java +++ b/src/main/java/org/apache/accumulo/testing/ingest/VerifyIngest.java @@ -21,11 +21,13 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.Random; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; +import org.apache.accumulo.core.conf.ClientProperty; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.PartialKey; import org.apache.accumulo.core.data.Range; @@ -59,7 +61,7 @@ public class VerifyIngest { public static void main(String[] args) throws Exception { Opts opts = new Opts(); opts.parseArgs(VerifyIngest.class.getName(), args); - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { if (opts.trace) { String name = VerifyIngest.class.getSimpleName(); DistributedTrace.enable(); @@ -80,7 +82,8 @@ public class VerifyIngest { byte[][] bytevals = TestIngest.generateValues(opts.dataSize); Authorizations labelAuths = new Authorizations("L1", "L2", "G1", "GROUP2"); - client.securityOperations().changeUserAuthorizations(opts.getPrincipal(), labelAuths); + String principal = ClientProperty.AUTH_PRINCIPAL.getValue(opts.getClientProps()); + client.securityOperations().changeUserAuthorizations(principal, labelAuths); int expectedRow = opts.startRow; int expectedCol = 0; diff --git a/src/main/java/org/apache/accumulo/testing/mapreduce/RowHash.java b/src/main/java/org/apache/accumulo/testing/mapreduce/RowHash.java index f3a7328..dca7128 100644 --- a/src/main/java/org/apache/accumulo/testing/mapreduce/RowHash.java +++ b/src/main/java/org/apache/accumulo/testing/mapreduce/RowHash.java @@ -27,7 +27,7 @@ import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.hadoop.mapreduce.AccumuloInputFormat; import org.apache.accumulo.hadoop.mapreduce.AccumuloOutputFormat; -import org.apache.accumulo.hadoopImpl.mapreduce.lib.MapReduceClientOnRequiredTable; +import org.apache.accumulo.testing.cli.ClientOpts; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.io.MD5Hash; @@ -57,9 +57,11 @@ public class RowHash extends Configured implements Tool { public void setup(Context job) {} } - private static class Opts extends MapReduceClientOnRequiredTable { + private static class Opts extends ClientOpts { @Parameter(names = "--column", required = true) String column; + @Parameter(names = {"-t", "--table"}, required = true, description = "table to use") + String tableName; } @Override @@ -79,11 +81,11 @@ public class RowHash extends Configured implements Tool { if (cf.getLength() > 0) cols = Collections.singleton(new IteratorSetting.Column(cf, cq)); - AccumuloInputFormat.configure().clientProperties(opts.getClientProperties()) - .table(opts.getTableName()).auths(opts.auths).fetchColumns(cols).store(job); + AccumuloInputFormat.configure().clientProperties(opts.getClientProps()).table(opts.tableName) + .auths(opts.auths).fetchColumns(cols).store(job); - AccumuloOutputFormat.configure().clientProperties(opts.getClientProperties()) - .defaultTable(opts.getTableName()).createTables(true).store(job); + AccumuloOutputFormat.configure().clientProperties(opts.getClientProps()) + .defaultTable(opts.tableName).createTables(true).store(job); job.setMapperClass(HashDataMapper.class); job.setMapOutputKeyClass(Text.class); diff --git a/src/main/java/org/apache/accumulo/testing/mapreduce/TeraSortIngest.java b/src/main/java/org/apache/accumulo/testing/mapreduce/TeraSortIngest.java index e2fa4f5..cd47e1e 100644 --- a/src/main/java/org/apache/accumulo/testing/mapreduce/TeraSortIngest.java +++ b/src/main/java/org/apache/accumulo/testing/mapreduce/TeraSortIngest.java @@ -25,11 +25,10 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import org.apache.accumulo.core.client.BatchWriterConfig; -import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.hadoopImpl.mapreduce.lib.MapReduceClientOnRequiredTable; +import org.apache.accumulo.hadoop.mapreduce.AccumuloOutputFormat; +import org.apache.accumulo.testing.cli.ClientOpts; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.io.LongWritable; @@ -356,7 +355,9 @@ public class TeraSortIngest extends Configured implements Tool { ToolRunner.run(new Configuration(), new TeraSortIngest(), args); } - static class Opts extends MapReduceClientOnRequiredTable { + static class Opts extends ClientOpts { + @Parameter(names = {"-t", "--table"}, required = true, description = "table to use") + String tableName; @Parameter(names = "--count", description = "number of rows to ingest", required = true) long numRows; @Parameter(names = {"-nk", "--minKeySize"}, description = "miniumum key size", required = true) @@ -387,9 +388,9 @@ public class TeraSortIngest extends Configured implements Tool { job.setNumReduceTasks(0); job.setOutputFormatClass(AccumuloOutputFormat.class); - opts.setAccumuloConfigs(job); - BatchWriterConfig bwConfig = new BatchWriterConfig().setMaxMemory(10L * 1000 * 1000); - AccumuloOutputFormat.setBatchWriterOptions(job, bwConfig); + + AccumuloOutputFormat.configure().clientProperties(opts.getClientProps()).createTables(true) + .defaultTable(opts.tableName); Configuration conf = job.getConfiguration(); conf.setLong(NUMROWS, opts.numRows); @@ -397,7 +398,7 @@ public class TeraSortIngest extends Configured implements Tool { conf.setInt("cloudgen.maxkeylength", opts.maxKeyLength); conf.setInt("cloudgen.minvaluelength", opts.minValueLength); conf.setInt("cloudgen.maxvaluelength", opts.maxValueLength); - conf.set("cloudgen.tablename", opts.getTableName()); + conf.set("cloudgen.tablename", opts.tableName); if (args.length > 10) conf.setInt(NUMSPLITS, opts.splits); diff --git a/src/main/java/org/apache/accumulo/testing/merkle/cli/CompareTables.java b/src/main/java/org/apache/accumulo/testing/merkle/cli/CompareTables.java index 3d1111e..180a785 100644 --- a/src/main/java/org/apache/accumulo/testing/merkle/cli/CompareTables.java +++ b/src/main/java/org/apache/accumulo/testing/merkle/cli/CompareTables.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; @@ -98,7 +99,7 @@ public class CompareTables { private Map<String,String> computeAllHashes() throws AccumuloException, AccumuloSecurityException, TableExistsException, NoSuchAlgorithmException, TableNotFoundException, FileNotFoundException { - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { final Map<String,String> hashesByTable = new HashMap<>(); for (String table : opts.getTables()) { diff --git a/src/main/java/org/apache/accumulo/testing/merkle/cli/ComputeRootHash.java b/src/main/java/org/apache/accumulo/testing/merkle/cli/ComputeRootHash.java index 7d06a6e..8cccb24 100644 --- a/src/main/java/org/apache/accumulo/testing/merkle/cli/ComputeRootHash.java +++ b/src/main/java/org/apache/accumulo/testing/merkle/cli/ComputeRootHash.java @@ -22,6 +22,7 @@ import java.util.Collections; import java.util.List; import java.util.Map.Entry; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; @@ -53,7 +54,7 @@ public class ComputeRootHash { private byte[] getHash(ComputeRootHashOpts opts) throws TableNotFoundException, NoSuchAlgorithmException { - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { return getHash(client, opts.tableName, opts.hashName); } } diff --git a/src/main/java/org/apache/accumulo/testing/merkle/cli/GenerateHashes.java b/src/main/java/org/apache/accumulo/testing/merkle/cli/GenerateHashes.java index 9b21037..11010bf 100644 --- a/src/main/java/org/apache/accumulo/testing/merkle/cli/GenerateHashes.java +++ b/src/main/java/org/apache/accumulo/testing/merkle/cli/GenerateHashes.java @@ -32,6 +32,7 @@ import java.util.TreeSet; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; @@ -137,7 +138,7 @@ public class GenerateHashes { public void run(GenerateHashesOpts opts) throws TableNotFoundException, AccumuloSecurityException, AccumuloException, NoSuchAlgorithmException, FileNotFoundException { - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { Collection<Range> ranges = getRanges(client, opts.tableName, opts.getSplitsFile()); run(client, opts.tableName, opts.getOutputTableName(), opts.getHashName(), opts.getNumThreads(), opts.isIteratorPushdown(), ranges); diff --git a/src/main/java/org/apache/accumulo/testing/merkle/cli/ManualComparison.java b/src/main/java/org/apache/accumulo/testing/merkle/cli/ManualComparison.java index 49129fe..ee8b1b0 100644 --- a/src/main/java/org/apache/accumulo/testing/merkle/cli/ManualComparison.java +++ b/src/main/java/org/apache/accumulo/testing/merkle/cli/ManualComparison.java @@ -19,6 +19,7 @@ package org.apache.accumulo.testing.merkle.cli; import java.util.Iterator; import java.util.Map.Entry; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; @@ -46,7 +47,7 @@ public class ManualComparison { ManualComparisonOpts opts = new ManualComparisonOpts(); opts.parseArgs("ManualComparison", args); - try (AccumuloClient client = opts.createClient(); + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build(); Scanner s1 = client.createScanner(opts.table1, Authorizations.EMPTY); Scanner s2 = client.createScanner(opts.table2, Authorizations.EMPTY)) { Iterator<Entry<Key,Value>> iter1 = s1.iterator(), iter2 = s2.iterator(); diff --git a/src/main/java/org/apache/accumulo/testing/merkle/ingest/RandomWorkload.java b/src/main/java/org/apache/accumulo/testing/merkle/ingest/RandomWorkload.java index 1c61249..1fdd41d 100644 --- a/src/main/java/org/apache/accumulo/testing/merkle/ingest/RandomWorkload.java +++ b/src/main/java/org/apache/accumulo/testing/merkle/ingest/RandomWorkload.java @@ -18,6 +18,7 @@ package org.apache.accumulo.testing.merkle.ingest; import java.util.Random; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.data.Mutation; @@ -58,7 +59,7 @@ public class RandomWorkload { } public void run(RandomWorkloadOpts opts) throws Exception { - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { run(client, opts.tableName, opts.numRecords, opts.rowMax, opts.cfMax, opts.cqMax, opts.deletePercent); } diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java index c5e5b1a..ac469ad 100644 --- a/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java +++ b/src/main/java/org/apache/accumulo/testing/randomwalk/bulk/Verify.java @@ -25,6 +25,7 @@ import java.util.Properties; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.RowIterator; import org.apache.accumulo.core.client.Scanner; @@ -116,7 +117,7 @@ public class Verify extends Test { public static void main(String args[]) throws Exception { Opts opts = new Opts(); opts.parseArgs(Verify.class.getName(), args); - try (AccumuloClient client = opts.createClient()) { + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build()) { Scanner scanner = client.createScanner(opts.tableName, opts.auths); scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY); Text startBadRow = null; diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Merge.java b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Merge.java index 0420eb0..91917ee 100644 --- a/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Merge.java +++ b/src/main/java/org/apache/accumulo/testing/randomwalk/shard/Merge.java @@ -21,7 +21,6 @@ import java.util.Properties; import java.util.SortedSet; import java.util.TreeSet; -import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.testing.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.randomwalk.State; import org.apache.accumulo.testing.randomwalk.Test; @@ -38,8 +37,7 @@ public class Merge extends Test { log.debug("merging " + indexTableName); env.getAccumuloClient().tableOperations().merge(indexTableName, null, null); org.apache.accumulo.core.util.Merge merge = new org.apache.accumulo.core.util.Merge(); - merge.mergomatic((AccumuloClient) env.getAccumuloClient(), indexTableName, null, null, - 256 * 1024 * 1024, true); + merge.mergomatic(env.getAccumuloClient(), indexTableName, null, null, 256 * 1024 * 1024, true); splits = env.getAccumuloClient().tableOperations().listSplits(indexTableName); if (splits.size() > splitSet.size()) { // throw an excpetion so that test will die an no further changes to diff --git a/src/main/java/org/apache/accumulo/testing/stress/Scan.java b/src/main/java/org/apache/accumulo/testing/stress/Scan.java index 01dc842..93dfb2a 100644 --- a/src/main/java/org/apache/accumulo/testing/stress/Scan.java +++ b/src/main/java/org/apache/accumulo/testing/stress/Scan.java @@ -20,6 +20,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.Random; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; @@ -38,7 +39,7 @@ public class Scan { ScanOpts opts = new ScanOpts(); opts.parseArgs(Scan.class.getName(), args); - try (AccumuloClient client = opts.createClient(); + try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build(); Scanner scanner = client.createScanner(opts.tableName, new Authorizations())) { if (opts.isolate) { scanner.enableIsolation(); diff --git a/src/main/java/org/apache/accumulo/testing/stress/Write.java b/src/main/java/org/apache/accumulo/testing/stress/Write.java index 2b92b59..6a86f4b 100644 --- a/src/main/java/org/apache/accumulo/testing/stress/Write.java +++ b/src/main/java/org/apache/accumulo/testing/stress/Write.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.testing.stress; +import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; @@ -28,7 +29,7 @@ public class Write { opts.check(); - try (AccumuloClient c = opts.createClient()) { + try (AccumuloClient c = Accumulo.newClient().from(opts.getClientProps()).build()) { if (opts.clear_table && c.tableOperations().exists(opts.tableName)) { try {