http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/continuous/CreateTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/CreateTable.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/CreateTable.java new file mode 100644 index 0000000..b8f2d8d --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/testing/core/continuous/CreateTable.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.testing.core.continuous; + +import java.util.Properties; +import java.util.SortedSet; +import java.util.TreeSet; + +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.testing.core.TestProps; +import org.apache.hadoop.io.Text; + +public class CreateTable { + + public static void main(String[] args) throws Exception { + + if (args.length != 1) { + System.err.println("Usage: CreateTable <propsPath>"); + System.exit(-1); + } + + Properties props = TestProps.loadFromFile(args[0]); + ContinuousEnv env = new ContinuousEnv(props); + + Connector conn = env.getAccumuloConnector(); + String tableName = env.getAccumuloTableName(); + if (conn.tableOperations().exists(tableName)) { + System.err.println("ERROR: Accumulo table '"+ tableName + "' already exists"); + System.exit(-1); + } + + int numTablets = Integer.parseInt(props.getProperty(TestProps.CI_COMMON_ACCUMULO_NUM_TABLETS)); + if (numTablets < 1) { + System.err.println("ERROR: numTablets < 1"); + System.exit(-1); + } + if (env.getRowMin() >= env.getRowMax()) { + System.err.println("ERROR: min >= max"); + System.exit(-1); + } + + conn.tableOperations().create(tableName); + + SortedSet<Text> splits = new TreeSet<>(); + int numSplits = numTablets - 1; + long distance = ((env.getRowMax() - env.getRowMin()) / numTablets) + 1; + long split = distance; + for (int i = 0; i < numSplits; i++) { + String s = String.format("%016x", split + env.getRowMin()); + while (s.charAt(s.length() - 1) == '0') { + s = s.substring(0, s.length() - 1); + } + splits.add(new Text(s)); + split += distance; + } + + conn.tableOperations().addSplits(tableName, splits); + System.out.println("Created Accumulo table '" + tableName + "' with " + numTablets + " tablets"); + } +}
http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/continuous/GenSplits.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/GenSplits.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/GenSplits.java deleted file mode 100644 index be9ef7a..0000000 --- a/core/src/main/java/org/apache/accumulo/testing/core/continuous/GenSplits.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.testing.core.continuous; - -import java.util.List; - -import com.beust.jcommander.JCommander; -import com.beust.jcommander.Parameter; -import com.beust.jcommander.ParameterException; - -/** - * - */ -public class GenSplits { - - static class Opts { - @Parameter(names = "--min", description = "minimum row") - long minRow = 0; - - @Parameter(names = "--max", description = "maximum row") - long maxRow = Long.MAX_VALUE; - - @Parameter(description = "<num tablets>") - List<String> args = null; - } - - public static void main(String[] args) { - - Opts opts = new Opts(); - JCommander jcommander = new JCommander(opts); - jcommander.setProgramName(GenSplits.class.getSimpleName()); - - try { - jcommander.parse(args); - } catch (ParameterException pe) { - System.err.println(pe.getMessage()); - jcommander.usage(); - System.exit(-1); - } - - if (opts.args == null || opts.args.size() != 1) { - jcommander.usage(); - System.exit(-1); - } - - int numTablets = Integer.parseInt(opts.args.get(0)); - - if (numTablets < 1) { - System.err.println("ERROR: numTablets < 1"); - System.exit(-1); - } - - if (opts.minRow >= opts.maxRow) { - System.err.println("ERROR: min >= max"); - System.exit(-1); - } - - int numSplits = numTablets - 1; - long distance = ((opts.maxRow - opts.minRow) / numTablets) + 1; - long split = distance; - for (int i = 0; i < numSplits; i++) { - - String s = String.format("%016x", split + opts.minRow); - - while (s.charAt(s.length() - 1) == '0') { - s = s.substring(0, s.length() - 1); - } - - System.out.println(s); - split += distance; - } - } -} http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/continuous/HistData.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/HistData.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/HistData.java deleted file mode 100644 index 2fff363..0000000 --- a/core/src/main/java/org/apache/accumulo/testing/core/continuous/HistData.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.testing.core.continuous; - -import java.io.Serializable; -import java.util.Objects; - -class HistData<T> implements Comparable<HistData<T>>, Serializable { - private static final long serialVersionUID = 1L; - - T bin; - long count; - - HistData(T bin) { - this.bin = bin; - count = 0; - } - - @Override - public int hashCode() { - return Objects.hashCode(bin) + Objects.hashCode(count); - } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object obj) { - return obj == this || (obj != null && obj instanceof HistData && 0 == compareTo((HistData<T>) obj)); - } - - @SuppressWarnings("unchecked") - @Override - public int compareTo(HistData<T> o) { - return ((Comparable<T>) bin).compareTo(o.bin); - } -} http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/continuous/Histogram.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/Histogram.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/Histogram.java deleted file mode 100644 index 0f1ba05..0000000 --- a/core/src/main/java/org/apache/accumulo/testing/core/continuous/Histogram.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.testing.core.continuous; - -import static java.nio.charset.StandardCharsets.UTF_8; - -import java.io.BufferedOutputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.PrintStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -public class Histogram<T> implements Serializable { - - private static final long serialVersionUID = 1L; - - protected long sum; - protected HashMap<T,HistData<T>> counts; - - public Histogram() { - sum = 0; - counts = new HashMap<>(); - } - - public void addPoint(T x) { - addPoint(x, 1); - } - - public void addPoint(T x, long y) { - - HistData<T> hd = counts.get(x); - if (hd == null) { - hd = new HistData<>(x); - counts.put(x, hd); - } - - hd.count += y; - sum += y; - } - - public long getCount(T x) { - HistData<T> hd = counts.get(x); - if (hd == null) - return 0; - return hd.count; - } - - public double getPercentage(T x) { - if (getSum() == 0) { - return 0; - } - return (double) getCount(x) / (double) getSum() * 100.0; - } - - public long getSum() { - return sum; - } - - public List<T> getKeysInCountSortedOrder() { - - ArrayList<HistData<T>> sortedCounts = new ArrayList<>(counts.values()); - - Collections.sort(sortedCounts, new Comparator<HistData<T>>() { - @Override - public int compare(HistData<T> o1, HistData<T> o2) { - if (o1.count < o2.count) - return -1; - if (o1.count > o2.count) - return 1; - return 0; - } - }); - - ArrayList<T> sortedKeys = new ArrayList<>(); - - for (Iterator<HistData<T>> iter = sortedCounts.iterator(); iter.hasNext();) { - HistData<T> hd = iter.next(); - sortedKeys.add(hd.bin); - } - - return sortedKeys; - } - - public void print(StringBuilder out) { - TreeSet<HistData<T>> sortedCounts = new TreeSet<>(counts.values()); - - int maxValueLen = 0; - - for (Iterator<HistData<T>> iter = sortedCounts.iterator(); iter.hasNext();) { - HistData<T> hd = iter.next(); - if (("" + hd.bin).length() > maxValueLen) { - maxValueLen = ("" + hd.bin).length(); - } - } - - double psum = 0; - - for (Iterator<HistData<T>> iter = sortedCounts.iterator(); iter.hasNext();) { - HistData<T> hd = iter.next(); - - psum += getPercentage(hd.bin); - - out.append(String.format(" %" + (maxValueLen + 1) + "s %,16d %6.2f%s %6.2f%s%n", hd.bin + "", hd.count, getPercentage(hd.bin), "%", psum, "%")); - } - out.append(String.format("%n %" + (maxValueLen + 1) + "s %,16d %n", "TOTAL", sum)); - } - - public void save(String file) throws IOException { - - FileOutputStream fos = new FileOutputStream(file); - BufferedOutputStream bos = new BufferedOutputStream(fos); - PrintStream ps = new PrintStream(bos, false, UTF_8.name()); - - TreeSet<HistData<T>> sortedCounts = new TreeSet<>(counts.values()); - for (Iterator<HistData<T>> iter = sortedCounts.iterator(); iter.hasNext();) { - HistData<T> hd = iter.next(); - ps.println(" " + hd.bin + " " + hd.count); - } - - ps.close(); - } - - public Set<T> getKeys() { - return counts.keySet(); - } - - public void clear() { - counts.clear(); - sum = 0; - } -} http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/continuous/PrintScanTimeHistogram.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/PrintScanTimeHistogram.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/PrintScanTimeHistogram.java deleted file mode 100644 index 7172f3a..0000000 --- a/core/src/main/java/org/apache/accumulo/testing/core/continuous/PrintScanTimeHistogram.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.testing.core.continuous; - -import static java.nio.charset.StandardCharsets.UTF_8; - -import java.io.BufferedReader; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class PrintScanTimeHistogram { - - private static final Logger log = LoggerFactory.getLogger(PrintScanTimeHistogram.class); - - public static void main(String[] args) throws Exception { - Histogram<String> srqHist = new Histogram<>(); - Histogram<String> fsrHist = new Histogram<>(); - - processFile(System.in, srqHist, fsrHist); - - StringBuilder report = new StringBuilder(); - report.append(String.format("%n *** Single row queries histogram *** %n")); - srqHist.print(report); - log.info("{}", report); - - report = new StringBuilder(); - report.append(String.format("%n *** Find start rows histogram *** %n")); - fsrHist.print(report); - log.info("{}", report); - } - - private static void processFile(InputStream ins, Histogram<String> srqHist, Histogram<String> fsrHist) throws FileNotFoundException, IOException { - String line; - BufferedReader in = new BufferedReader(new InputStreamReader(ins, UTF_8)); - - while ((line = in.readLine()) != null) { - - try { - String[] tokens = line.split(" "); - - String type = tokens[0]; - if (type.equals("SRQ")) { - long delta = Long.parseLong(tokens[3]); - String point = generateHistPoint(delta); - srqHist.addPoint(point); - } else if (type.equals("FSR")) { - long delta = Long.parseLong(tokens[3]); - String point = generateHistPoint(delta); - fsrHist.addPoint(point); - } - } catch (Exception e) { - log.error("Failed to process line '" + line + "'.", e); - } - } - - in.close(); - } - - private static String generateHistPoint(long delta) { - String point; - - if (delta / 1000.0 < .1) { - point = String.format("%07.2f", delta / 1000.0); - if (point.equals("0000.10")) - point = "0000.1x"; - } else if (delta / 1000.0 < 1.0) { - point = String.format("%06.1fx", delta / 1000.0); - if (point.equals("0001.0x")) - point = "0001.xx"; - } else { - point = String.format("%04.0f.xx", delta / 1000.0); - } - return point; - } - -} http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/continuous/TimeBinner.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/continuous/TimeBinner.java b/core/src/main/java/org/apache/accumulo/testing/core/continuous/TimeBinner.java index d43e2e5..843b251 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/continuous/TimeBinner.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/continuous/TimeBinner.java @@ -75,7 +75,7 @@ public class TimeBinner { BufferedReader in = new BufferedReader(new InputStreamReader(System.in, UTF_8)); - String line = null; + String line; HashMap<Long,DoubleWrapper> aggregation1 = new HashMap<>(); HashMap<Long,DoubleWrapper> aggregation2 = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Environment.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Environment.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Environment.java deleted file mode 100644 index 09d235e..0000000 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Environment.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.accumulo.testing.core.randomwalk; - -import static java.util.Objects.requireNonNull; - -import java.io.File; -import java.io.IOException; -import java.lang.management.ManagementFactory; -import java.util.Properties; -import java.util.concurrent.TimeUnit; - -import org.apache.accumulo.core.client.AccumuloException; -import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.BatchWriterConfig; -import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.Instance; -import org.apache.accumulo.core.client.MultiTableBatchWriter; -import org.apache.accumulo.core.client.ZooKeeperInstance; -import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.KerberosToken; -import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.testing.core.TestProps; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.security.UserGroupInformation; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * The test environment that is available for randomwalk tests. This includes configuration properties that are available to any randomwalk test and facilities - * for creating client-side objects. This class is not thread-safe. - */ -public class Environment { - - private static final Logger log = LoggerFactory.getLogger(Environment.class); - - private final Properties p; - private Instance instance = null; - private Connector connector = null; - private MultiTableBatchWriter mtbw = null; - - /** - * Creates a new test environment. - * - * @param p - * configuration properties - * @throws NullPointerException - * if p is null - */ - public Environment(Properties p) { - requireNonNull(p); - this.p = p; - } - - /** - * Gets a copy of the configuration properties. - * - * @return a copy of the configuration properties - */ - Properties copyConfigProperties() { - return new Properties(p); - } - - /** - * Gets a configuration property. - * - * @param key - * key - * @return property value - */ - public String getConfigProperty(String key) { - return p.getProperty(key); - } - - /** - * Gets the configured username. - * - * @return username - */ - public String getUserName() { - return p.getProperty(TestProps.ACCUMULO_USERNAME); - } - - /** - * Gets the configured password. - * - * @return password - */ - public String getPassword() { - return p.getProperty(TestProps.ACCUMULO_PASSWORD); - } - - /** - * Gets the configured keytab. - * - * @return path to keytab - */ - public String getKeytab() { - return p.getProperty(TestProps.ACCUMULO_KEYTAB); - } - - /** - * Gets this process's ID. - * - * @return pid - */ - public String getPid() { - return ManagementFactory.getRuntimeMXBean().getName().split("@")[0]; - } - - - public Configuration getHadoopConfiguration() { - Configuration config = new Configuration(); - config.set("mapreduce.framework.name", "yarn"); - // Setting below are required due to bundled jar breaking default config. - // See http://stackoverflow.com/questions/17265002/hadoop-no-filesystem-for-scheme-file - config.set("fs.hdfs.impl", org.apache.hadoop.hdfs.DistributedFileSystem.class.getName()); - config.set("fs.file.impl", org.apache.hadoop.fs.LocalFileSystem.class.getName()); - return config; - } - - /** - * Gets an authentication token based on the configured password. - * - * @return authentication token - */ - public AuthenticationToken getToken() { - String password = getPassword(); - if (null != password) { - return new PasswordToken(getPassword()); - } - String keytab = getKeytab(); - if (null != keytab) { - File keytabFile = new File(keytab); - if (!keytabFile.exists() || !keytabFile.isFile()) { - throw new IllegalArgumentException("Provided keytab is not a normal file: " + keytab); - } - try { - UserGroupInformation.loginUserFromKeytab(getUserName(), keytabFile.getAbsolutePath()); - return new KerberosToken(); - } catch (IOException e) { - throw new RuntimeException("Failed to login", e); - } - } - throw new IllegalArgumentException("Must provide password or keytab in configuration"); - } - - /** - * Gets an Accumulo instance object. The same instance is reused after the first call. - * - * @return instance - */ - public Instance getInstance() { - if (instance == null) { - String instance = p.getProperty(TestProps.ACCUMULO_INSTANCE); - String zookeepers = p.getProperty(TestProps.ZOOKEEPERS); - this.instance = new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(instance).withZkHosts(zookeepers)); - } - return instance; - } - - /** - * Gets an Accumulo connector. The same connector is reused after the first call. - * - * @return connector - */ - public Connector getConnector() throws AccumuloException, AccumuloSecurityException { - if (connector == null) { - connector = getInstance().getConnector(getUserName(), getToken()); - } - return connector; - } - - /** - * Gets a multitable batch writer. The same object is reused after the first call unless it is reset. - * - * @return multitable batch writer - * @throws NumberFormatException - * if any of the numeric batch writer configuration properties cannot be parsed - * @throws NumberFormatException - * if any configuration property cannot be parsed - */ - public MultiTableBatchWriter getMultiTableBatchWriter() throws AccumuloException, AccumuloSecurityException { - if (mtbw == null) { - long maxMem = Long.parseLong(p.getProperty(TestProps.RW_BW_MAX_MEM)); - long maxLatency = Long.parseLong(p.getProperty(TestProps.RW_BW_MAX_LATENCY)); - int numThreads = Integer.parseInt(p.getProperty(TestProps.RW_BW_NUM_THREADS)); - mtbw = getConnector().createMultiTableBatchWriter( - new BatchWriterConfig().setMaxMemory(maxMem).setMaxLatency(maxLatency, TimeUnit.MILLISECONDS).setMaxWriteThreads(numThreads)); - } - return mtbw; - } - - /** - * Checks if a multitable batch writer has been created by this wrapper. - * - * @return true if multitable batch writer is already created - */ - public boolean isMultiTableBatchWriterInitialized() { - return mtbw != null; - } - - /** - * Clears the multitable batch writer previously created and remembered by this wrapper. - */ - public void resetMultiTableBatchWriter() { - if (mtbw == null) - return; - if (!mtbw.isClosed()) { - log.warn("Setting non-closed MultiTableBatchWriter to null (leaking resources)"); - } - mtbw = null; - } -} http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Fixture.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Fixture.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Fixture.java index cfa0e52..5b48c12 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Fixture.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Fixture.java @@ -23,7 +23,7 @@ public abstract class Fixture { protected final Logger log = LoggerFactory.getLogger(this.getClass()); - public abstract void setUp(State state, Environment env) throws Exception; + public abstract void setUp(State state, RandWalkEnv env) throws Exception; - public abstract void tearDown(State state, Environment env) throws Exception; + public abstract void tearDown(State state, RandWalkEnv env) throws Exception; } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Framework.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Framework.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Framework.java index 0b647bb..43c66b4 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Framework.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Framework.java @@ -16,10 +16,10 @@ */ package org.apache.accumulo.testing.core.randomwalk; -import java.io.FileInputStream; import java.util.HashMap; import java.util.Properties; +import org.apache.accumulo.testing.core.TestProps; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ public class Framework { * @param startName * Full name of starting graph or test */ - public int run(String startName, State state, Environment env) { + public int run(String startName, State state, RandWalkEnv env) { try { Node node = getNode(startName); @@ -86,15 +86,12 @@ public class Framework { System.exit(-1); } - Properties props = new Properties(); - FileInputStream fis = new FileInputStream(args[0]); - props.load(fis); - fis.close(); + Properties props = TestProps.loadFromFile(args[0]); log.info("Running random walk test with module: " + args[1]); State state = new State(); - Environment env = new Environment(props); + RandWalkEnv env = new RandWalkEnv(props); getInstance().run(args[1], state, env); log.info("Test finished"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Module.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Module.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Module.java index 5cfa2e5..addc9b8 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Module.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Module.java @@ -66,7 +66,7 @@ public class Module extends Node { } @Override - public void visit(State state, Environment env, Properties props) { + public void visit(State state, RandWalkEnv env, Properties props) { String print; if ((print = props.getProperty("print")) != null) { switch (print) { @@ -98,7 +98,7 @@ public class Module extends Node { } @Override - public void visit(State state, Environment env, Properties props) throws Exception { + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { throw new Exception("You don't visit aliases!"); } @@ -185,7 +185,7 @@ public class Module extends Node { } @Override - public void visit(final State state, final Environment env, Properties props) throws Exception { + public void visit(final State state, final RandWalkEnv env, Properties props) throws Exception { int maxHops, maxSec; boolean teardown; @@ -321,7 +321,7 @@ public class Module extends Node { if (test) stopTimer(nextNode); } catch (Exception e) { - log.debug("Connector belongs to user: " + env.getConnector().whoami()); + log.debug("Connector belongs to user: " + env.getAccumuloConnector().whoami()); log.debug("Exception occured at: " + System.currentTimeMillis()); log.debug("Properties for node: " + nextNodeId); for (Entry<Object,Object> entry : nodeProps.entrySet()) { http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Node.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Node.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Node.java index ed6e82e..7d4e038 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Node.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/Node.java @@ -37,7 +37,7 @@ public abstract class Node { * @param env * test environment */ - public abstract void visit(State state, Environment env, Properties props) throws Exception; + public abstract void visit(State state, RandWalkEnv env, Properties props) throws Exception; @Override public boolean equals(Object o) { http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/RandWalkEnv.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/RandWalkEnv.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/RandWalkEnv.java new file mode 100644 index 0000000..0dd2176 --- /dev/null +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/RandWalkEnv.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.testing.core.randomwalk; + +import java.util.Properties; + +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.MultiTableBatchWriter; +import org.apache.accumulo.testing.core.TestEnv; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The test environment that is available for randomwalk tests. This includes configuration + * properties that are available to any randomwalk test and facilities for creating client-side + * objects. This class is not thread-safe. + */ +public class RandWalkEnv extends TestEnv { + + private static final Logger log = LoggerFactory.getLogger(RandWalkEnv.class); + + private MultiTableBatchWriter mtbw = null; + + /** + * Creates a new test environment. + * + * @param p configuration properties + */ + public RandWalkEnv(Properties p) { + super(p); + } + + /** + * Gets a multitable batch writer. The same object is reused after the first call unless it is reset. + * + * @return multitable batch writer + * @throws NumberFormatException + * if any of the numeric batch writer configuration properties cannot be parsed + * @throws NumberFormatException + * if any configuration property cannot be parsed + */ + public MultiTableBatchWriter getMultiTableBatchWriter() throws AccumuloException, AccumuloSecurityException { + if (mtbw == null) { + mtbw = getAccumuloConnector().createMultiTableBatchWriter(getBatchWriterConfig()); + } + return mtbw; + } + + /** + * Checks if a multitable batch writer has been created by this wrapper. + * + * @return true if multitable batch writer is already created + */ + public boolean isMultiTableBatchWriterInitialized() { + return mtbw != null; + } + + /** + * Clears the multitable batch writer previously created and remembered by this wrapper. + */ + public void resetMultiTableBatchWriter() { + if (mtbw == null) + return; + if (!mtbw.isClosed()) { + log.warn("Setting non-closed MultiTableBatchWriter to null (leaking resources)"); + } + mtbw = null; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkImportTest.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkImportTest.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkImportTest.java index 317a294..1f04cb8 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkImportTest.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkImportTest.java @@ -18,7 +18,7 @@ package org.apache.accumulo.testing.core.randomwalk.bulk; import java.util.Properties; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; /** @@ -30,7 +30,7 @@ public abstract class BulkImportTest extends BulkTest { public static final String SKIPPED_IMPORT = "skipped.import", TRUE = Boolean.TRUE.toString(), FALSE = Boolean.FALSE.toString(); @Override - public void visit(final State state, Environment env, Properties props) throws Exception { + public void visit(final State state, RandWalkEnv env, Properties props) throws Exception { /** * Each visit() is performed sequentially and then submitted to the threadpool which will have async execution. As long as we're checking the state and * making decisions about what to do before we submit something to the thread pool, we're fine. @@ -71,7 +71,7 @@ public abstract class BulkImportTest extends BulkTest { } } - private boolean shouldQueueMoreImports(State state, Environment env) throws Exception { + private boolean shouldQueueMoreImports(State state, RandWalkEnv env) throws Exception { // Only selectively import when it's BulkPlusOne. If we did a BulkPlusOne, // we must also do a BulkMinusOne to keep the table consistent if (getClass().equals(BulkPlusOne.class)) { http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkMinusOne.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkMinusOne.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkMinusOne.java index a9bb8f9..7b31d75 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkMinusOne.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkMinusOne.java @@ -19,7 +19,7 @@ package org.apache.accumulo.testing.core.randomwalk.bulk; import static java.nio.charset.StandardCharsets.UTF_8; import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; public class BulkMinusOne extends BulkImportTest { @@ -27,7 +27,7 @@ public class BulkMinusOne extends BulkImportTest { private static final Value negOne = new Value("-1".getBytes(UTF_8)); @Override - protected void runLater(State state, Environment env) throws Exception { + protected void runLater(State state, RandWalkEnv env) throws Exception { log.info("Decrementing"); BulkPlusOne.bulkLoadLots(log, state, env, negOne); } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkPlusOne.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkPlusOne.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkPlusOne.java index 32be88b..4ba7935 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkPlusOne.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkPlusOne.java @@ -31,7 +31,7 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.file.FileOperations; import org.apache.accumulo.core.file.FileSKVWriter; import org.apache.accumulo.core.file.rfile.RFile; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; @@ -57,7 +57,7 @@ public class BulkPlusOne extends BulkImportTest { private static final Value ONE = new Value("1".getBytes()); - static void bulkLoadLots(Logger log, State state, Environment env, Value value) throws Exception { + static void bulkLoadLots(Logger log, State state, RandWalkEnv env, Value value) throws Exception { final Path dir = new Path("/tmp", "bulk_" + UUID.randomUUID().toString()); final Path fail = new Path(dir.toString() + "_fail"); final DefaultConfiguration defaultConfiguration = AccumuloConfiguration.getDefaultConfiguration(); @@ -97,7 +97,7 @@ public class BulkPlusOne extends BulkImportTest { } f.close(); } - env.getConnector().tableOperations().importDirectory(Setup.getTableName(), dir.toString(), fail.toString(), true); + env.getAccumuloConnector().tableOperations().importDirectory(Setup.getTableName(), dir.toString(), fail.toString(), true); fs.delete(dir, true); FileStatus[] failures = fs.listStatus(fail); if (failures != null && failures.length > 0) { @@ -109,7 +109,7 @@ public class BulkPlusOne extends BulkImportTest { } @Override - protected void runLater(State state, Environment env) throws Exception { + protected void runLater(State state, RandWalkEnv env) throws Exception { log.info("Incrementing"); bulkLoadLots(log, state, env, ONE); } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkTest.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkTest.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkTest.java index 8695538..61fb8cf 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkTest.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/BulkTest.java @@ -18,14 +18,14 @@ package org.apache.accumulo.testing.core.randomwalk.bulk; import java.util.Properties; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public abstract class BulkTest extends Test { @Override - public void visit(final State state, final Environment env, Properties props) throws Exception { + public void visit(final State state, final RandWalkEnv env, Properties props) throws Exception { Setup.run(state, () -> { try { runLater(state, env); @@ -35,6 +35,6 @@ public abstract class BulkTest extends Test { }); } - abstract protected void runLater(State state, Environment env) throws Exception; + abstract protected void runLater(State state, RandWalkEnv env) throws Exception; } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Compact.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Compact.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Compact.java index 356a7c9..bca7547 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Compact.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Compact.java @@ -16,18 +16,18 @@ */ package org.apache.accumulo.testing.core.randomwalk.bulk; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.hadoop.io.Text; public class Compact extends SelectiveBulkTest { @Override - protected void runLater(State state, Environment env) throws Exception { + protected void runLater(State state, RandWalkEnv env) throws Exception { final Text[] points = Merge.getRandomTabletRange(state); final String rangeString = Merge.rangeToString(points); log.info("Compacting " + rangeString); - env.getConnector().tableOperations().compact(Setup.getTableName(), points[0], points[1], false, true); + env.getAccumuloConnector().tableOperations().compact(Setup.getTableName(), points[0], points[1], false, true); log.info("Compaction " + rangeString + " finished"); } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/ConsistencyCheck.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/ConsistencyCheck.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/ConsistencyCheck.java index eb21f30..71ff853 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/ConsistencyCheck.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/ConsistencyCheck.java @@ -25,20 +25,20 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.hadoop.io.Text; public class ConsistencyCheck extends SelectiveBulkTest { @Override - protected void runLater(State state, Environment env) throws Exception { + protected void runLater(State state, RandWalkEnv env) throws Exception { Random rand = (Random) state.get("rand"); Text row = Merge.getRandomRow(rand); log.info("Checking " + row); - String user = env.getConnector().whoami(); - Authorizations auths = env.getConnector().securityOperations().getUserAuthorizations(user); - try (Scanner scanner = new IsolatedScanner(env.getConnector().createScanner(Setup.getTableName(), auths))) { + String user = env.getAccumuloConnector().whoami(); + Authorizations auths = env.getAccumuloConnector().securityOperations().getUserAuthorizations(user); + try (Scanner scanner = new IsolatedScanner(env.getAccumuloConnector().createScanner(Setup.getTableName(), auths))) { scanner.setRange(new Range(row)); scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY); Value v = null; http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Merge.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Merge.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Merge.java index ebce171..dee6501 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Merge.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Merge.java @@ -19,17 +19,17 @@ package org.apache.accumulo.testing.core.randomwalk.bulk; import java.util.Arrays; import java.util.Random; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.hadoop.io.Text; public class Merge extends SelectiveBulkTest { @Override - protected void runLater(State state, Environment env) throws Exception { + protected void runLater(State state, RandWalkEnv env) throws Exception { Text[] points = getRandomTabletRange(state); log.info("merging " + rangeToString(points)); - env.getConnector().tableOperations().merge(Setup.getTableName(), points[0], points[1]); + env.getAccumuloConnector().tableOperations().merge(Setup.getTableName(), points[0], points[1]); log.info("merging " + rangeToString(points) + " complete"); } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveBulkTest.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveBulkTest.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveBulkTest.java index a708942..e4cc165 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveBulkTest.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveBulkTest.java @@ -18,7 +18,7 @@ package org.apache.accumulo.testing.core.randomwalk.bulk; import java.util.Properties; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; /** @@ -27,7 +27,7 @@ import org.apache.accumulo.testing.core.randomwalk.State; public abstract class SelectiveBulkTest extends BulkTest { @Override - public void visit(State state, Environment env, Properties props) throws Exception { + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { if (SelectiveQueueing.shouldQueueOperation(state, env)) { super.visit(state, env, props); } else { http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveQueueing.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveQueueing.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveQueueing.java index 59cf8aa..80882b5 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveQueueing.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/SelectiveQueueing.java @@ -19,7 +19,7 @@ package org.apache.accumulo.testing.core.randomwalk.bulk; import java.util.concurrent.ThreadPoolExecutor; import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,10 +30,10 @@ import org.slf4j.LoggerFactory; public class SelectiveQueueing { private static final Logger log = LoggerFactory.getLogger(SelectiveQueueing.class); - public static boolean shouldQueueOperation(State state, Environment env) throws Exception { + public static boolean shouldQueueOperation(State state, RandWalkEnv env) throws Exception { final ThreadPoolExecutor pool = (ThreadPoolExecutor) state.get("pool"); long queuedThreads = pool.getTaskCount() - pool.getActiveCount() - pool.getCompletedTaskCount(); - final Connector conn = env.getConnector(); + final Connector conn = env.getAccumuloConnector(); int numTservers = conn.instanceOperations().getTabletServers().size(); if (!shouldQueue(queuedThreads, numTservers)) { http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Setup.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Setup.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Setup.java index 635618f..c9ce9de 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Setup.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Setup.java @@ -27,7 +27,7 @@ import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.iterators.LongCombiner; import org.apache.accumulo.core.iterators.user.SummingCombiner; import org.apache.accumulo.core.util.SimpleThreadPool; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.hadoop.fs.FileSystem; @@ -38,14 +38,14 @@ public class Setup extends Test { static String tableName = null; @Override - public void visit(State state, Environment env, Properties props) throws Exception { + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { Random rand = new Random(); String hostname = InetAddress.getLocalHost().getHostName().replaceAll("[-.]", "_"); String pid = env.getPid(); tableName = String.format("bulk_%s_%s_%d", hostname, pid, System.currentTimeMillis()); log.info("Starting bulk test on " + tableName); - TableOperations tableOps = env.getConnector().tableOperations(); + TableOperations tableOps = env.getAccumuloConnector().tableOperations(); try { if (!tableOps.exists(getTableName())) { tableOps.create(getTableName()); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Split.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Split.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Split.java index 4ef212f..6a9270d 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Split.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Split.java @@ -20,21 +20,21 @@ import java.util.Random; import java.util.SortedSet; import java.util.TreeSet; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.hadoop.io.Text; public class Split extends SelectiveBulkTest { @Override - protected void runLater(State state, Environment env) throws Exception { + protected void runLater(State state, RandWalkEnv env) throws Exception { SortedSet<Text> splits = new TreeSet<>(); Random rand = (Random) state.get("rand"); int count = rand.nextInt(20); for (int i = 0; i < count; i++) splits.add(new Text(String.format(BulkPlusOne.FMT, (rand.nextLong() & 0x7fffffffffffffffl) % BulkPlusOne.LOTS))); log.info("splitting " + splits); - env.getConnector().tableOperations().addSplits(Setup.getTableName(), splits); + env.getAccumuloConnector().tableOperations().addSplits(Setup.getTableName(), splits); log.info("split for " + splits + " finished"); } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Verify.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Verify.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Verify.java index 57aeff3..885be06 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Verify.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/bulk/Verify.java @@ -31,7 +31,7 @@ import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.hadoop.io.Text; @@ -41,7 +41,7 @@ public class Verify extends Test { static byte[] zero = new byte[] {'0'}; @Override - public void visit(State state, Environment env, Properties props) throws Exception { + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { ThreadPoolExecutor threadPool = Setup.getThreadPool(state); threadPool.shutdown(); int lastSize = 0; @@ -58,9 +58,9 @@ public class Verify extends Test { return; } - String user = env.getConnector().whoami(); - Authorizations auths = env.getConnector().securityOperations().getUserAuthorizations(user); - Scanner scanner = env.getConnector().createScanner(Setup.getTableName(), auths); + String user = env.getAccumuloConnector().whoami(); + Authorizations auths = env.getAccumuloConnector().securityOperations().getUserAuthorizations(user); + Scanner scanner = env.getAccumuloConnector().createScanner(Setup.getTableName(), auths); scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY); for (Entry<Key,Value> entry : scanner) { byte[] value = entry.getValue().get(); @@ -100,7 +100,7 @@ public class Verify extends Test { } log.info("Test successful on table " + Setup.getTableName()); - env.getConnector().tableOperations().delete(Setup.getTableName()); + env.getAccumuloConnector().tableOperations().delete(Setup.getTableName()); } public static void main(String args[]) throws Exception { http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/AddSplits.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/AddSplits.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/AddSplits.java index 18e0980..f83f9e9 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/AddSplits.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/AddSplits.java @@ -26,7 +26,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; import org.apache.accumulo.core.metadata.MetadataTable; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.hadoop.io.Text; @@ -34,8 +34,8 @@ import org.apache.hadoop.io.Text; public class AddSplits extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchScan.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchScan.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchScan.java index 970e4df..26b3c27 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchScan.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchScan.java @@ -33,15 +33,15 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class BatchScan extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchWrite.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchWrite.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchWrite.java index 39afec0..536e4a9 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchWrite.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BatchWrite.java @@ -31,15 +31,15 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class BatchWrite extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BulkImport.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BulkImport.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BulkImport.java index 9c8eeb4..39a75c6 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BulkImport.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/BulkImport.java @@ -37,8 +37,7 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.file.blockfile.impl.CachableBlockFile; import org.apache.accumulo.core.file.rfile.RFile; import org.apache.accumulo.core.file.streams.PositionedOutputs; -import org.apache.accumulo.core.util.CachedConfiguration; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.hadoop.conf.Configuration; @@ -95,8 +94,8 @@ public class BulkImport extends Test { } @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangeAuthorizations.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangeAuthorizations.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangeAuthorizations.java index 542c61e..28747d6 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangeAuthorizations.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangeAuthorizations.java @@ -26,15 +26,15 @@ import java.util.Random; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.security.Authorizations; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class ChangeAuthorizations extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangePermissions.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangePermissions.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangePermissions.java index 173af6e..c830096 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangePermissions.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ChangePermissions.java @@ -30,15 +30,15 @@ import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class ChangePermissions extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CheckPermission.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CheckPermission.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CheckPermission.java index 4848423..12e4306 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CheckPermission.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CheckPermission.java @@ -25,15 +25,15 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.security.NamespacePermission; import org.apache.accumulo.core.security.SystemPermission; import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class CheckPermission extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CloneTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CloneTable.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CloneTable.java index 9697aee..8c4bd95 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CloneTable.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CloneTable.java @@ -27,15 +27,15 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class CloneTable extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Compact.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Compact.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Compact.java index cd2dc1a..4ecb34d 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Compact.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Compact.java @@ -23,7 +23,7 @@ import java.util.Random; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.hadoop.io.Text; @@ -31,8 +31,8 @@ import org.apache.hadoop.io.Text; public class Compact extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ConcurrentFixture.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ConcurrentFixture.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ConcurrentFixture.java index 388e439..ad2ae35 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ConcurrentFixture.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/ConcurrentFixture.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.Fixture; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.hadoop.io.Text; @@ -34,10 +34,10 @@ import org.apache.hadoop.io.Text; public class ConcurrentFixture extends Fixture { @Override - public void setUp(State state, Environment env) throws Exception {} + public void setUp(State state, RandWalkEnv env) throws Exception {} @Override - public void tearDown(State state, Environment env) throws Exception {} + public void tearDown(State state, RandWalkEnv env) throws Exception {} /** * http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Config.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Config.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Config.java index a640def..23106cf 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Config.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/Config.java @@ -23,7 +23,7 @@ import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.commons.math3.random.RandomDataGenerator; @@ -104,14 +104,14 @@ public class Config extends Test { // @formatter:on @Override - public void visit(State state, Environment env, Properties props) throws Exception { + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { // reset any previous setting Object lastSetting = state.getOkIfAbsent(LAST_SETTING); if (lastSetting != null) { int choice = Integer.parseInt(lastSetting.toString()); Property property = settings[choice].property; log.debug("Setting " + property.getKey() + " back to " + property.getDefaultValue()); - env.getConnector().instanceOperations().setProperty(property.getKey(), property.getDefaultValue()); + env.getAccumuloConnector().instanceOperations().setProperty(property.getKey(), property.getDefaultValue()); } lastSetting = state.getOkIfAbsent(LAST_TABLE_SETTING); if (lastSetting != null) { @@ -119,10 +119,10 @@ public class Config extends Test { String table = parts[0]; int choice = Integer.parseInt(parts[1]); Property property = tableSettings[choice].property; - if (env.getConnector().tableOperations().exists(table)) { + if (env.getAccumuloConnector().tableOperations().exists(table)) { log.debug("Setting " + property.getKey() + " on " + table + " back to " + property.getDefaultValue()); try { - env.getConnector().tableOperations().setProperty(table, property.getKey(), property.getDefaultValue()); + env.getAccumuloConnector().tableOperations().setProperty(table, property.getKey(), property.getDefaultValue()); } catch (AccumuloException ex) { if (ex.getCause() instanceof ThriftTableOperationException) { ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause(); @@ -139,10 +139,10 @@ public class Config extends Test { String namespace = parts[0]; int choice = Integer.parseInt(parts[1]); Property property = tableSettings[choice].property; - if (env.getConnector().namespaceOperations().exists(namespace)) { + if (env.getAccumuloConnector().namespaceOperations().exists(namespace)) { log.debug("Setting " + property.getKey() + " on " + namespace + " back to " + property.getDefaultValue()); try { - env.getConnector().namespaceOperations().setProperty(namespace, property.getKey(), property.getDefaultValue()); + env.getAccumuloConnector().namespaceOperations().setProperty(namespace, property.getKey(), property.getDefaultValue()); } catch (AccumuloException ex) { if (ex.getCause() instanceof ThriftTableOperationException) { ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause(); @@ -167,13 +167,13 @@ public class Config extends Test { } } - private void changeTableSetting(RandomDataGenerator random, State state, Environment env, Properties props) throws Exception { + private void changeTableSetting(RandomDataGenerator random, State state, RandWalkEnv env, Properties props) throws Exception { // pick a random property int choice = random.nextInt(0, tableSettings.length - 1); Setting setting = tableSettings[choice]; // pick a random table - SortedSet<String> tables = env.getConnector().tableOperations().list().tailSet("ctt").headSet("ctu"); + SortedSet<String> tables = env.getAccumuloConnector().tableOperations().list().tailSet("ctt").headSet("ctu"); if (tables.isEmpty()) return; String table = random.nextSample(tables, 1)[0].toString(); @@ -183,7 +183,7 @@ public class Config extends Test { state.set(LAST_TABLE_SETTING, table + "," + choice); log.debug("Setting " + setting.property.getKey() + " on table " + table + " to " + newValue); try { - env.getConnector().tableOperations().setProperty(table, setting.property.getKey(), "" + newValue); + env.getAccumuloConnector().tableOperations().setProperty(table, setting.property.getKey(), "" + newValue); } catch (AccumuloException ex) { if (ex.getCause() instanceof ThriftTableOperationException) { ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause(); @@ -194,13 +194,13 @@ public class Config extends Test { } } - private void changeNamespaceSetting(RandomDataGenerator random, State state, Environment env, Properties props) throws Exception { + private void changeNamespaceSetting(RandomDataGenerator random, State state, RandWalkEnv env, Properties props) throws Exception { // pick a random property int choice = random.nextInt(0, tableSettings.length - 1); Setting setting = tableSettings[choice]; // pick a random table - SortedSet<String> namespaces = env.getConnector().namespaceOperations().list().tailSet("nspc").headSet("nspd"); + SortedSet<String> namespaces = env.getAccumuloConnector().namespaceOperations().list().tailSet("nspc").headSet("nspd"); if (namespaces.isEmpty()) return; String namespace = random.nextSample(namespaces, 1)[0].toString(); @@ -210,7 +210,7 @@ public class Config extends Test { state.set(LAST_NAMESPACE_SETTING, namespace + "," + choice); log.debug("Setting " + setting.property.getKey() + " on namespace " + namespace + " to " + newValue); try { - env.getConnector().namespaceOperations().setProperty(namespace, setting.property.getKey(), "" + newValue); + env.getAccumuloConnector().namespaceOperations().setProperty(namespace, setting.property.getKey(), "" + newValue); } catch (AccumuloException ex) { if (ex.getCause() instanceof ThriftTableOperationException) { ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause(); @@ -221,7 +221,7 @@ public class Config extends Test { } } - private void changeSetting(RandomDataGenerator random, State state, Environment env, Properties props) throws Exception { + private void changeSetting(RandomDataGenerator random, State state, RandWalkEnv env, Properties props) throws Exception { // pick a random property int choice = random.nextInt(0, settings.length - 1); Setting setting = settings[choice]; @@ -229,7 +229,7 @@ public class Config extends Test { long newValue = random.nextLong(setting.min, setting.max); state.set(LAST_SETTING, "" + choice); log.debug("Setting " + setting.property.getKey() + " to " + newValue); - env.getConnector().instanceOperations().setProperty(setting.property.getKey(), "" + newValue); + env.getAccumuloConnector().instanceOperations().setProperty(setting.property.getKey(), "" + newValue); } } http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateNamespace.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateNamespace.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateNamespace.java index 71250d8..6c4ff3e 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateNamespace.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateNamespace.java @@ -22,15 +22,15 @@ import java.util.Random; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.NamespaceExistsException; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class CreateNamespace extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateTable.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateTable.java index 648732e..f9ec6ce 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateTable.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateTable.java @@ -25,15 +25,15 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableExistsException; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class CreateTable extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateUser.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateUser.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateUser.java index 708d48f..0db7b2b 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateUser.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/CreateUser.java @@ -23,14 +23,14 @@ import java.util.Random; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class CreateUser extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteNamespace.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteNamespace.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteNamespace.java index 7f564ae..e0ce1b2 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteNamespace.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteNamespace.java @@ -23,15 +23,15 @@ import java.util.Random; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.NamespaceNotEmptyException; import org.apache.accumulo.core.client.NamespaceNotFoundException; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; public class DeleteNamespace extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand"); http://git-wip-us.apache.org/repos/asf/accumulo-testing/blob/fc3ddfc4/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteRange.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteRange.java b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteRange.java index f8db0e7..cdbb36e 100644 --- a/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteRange.java +++ b/core/src/main/java/org/apache/accumulo/testing/core/randomwalk/concurrent/DeleteRange.java @@ -25,7 +25,7 @@ import java.util.Random; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; -import org.apache.accumulo.testing.core.randomwalk.Environment; +import org.apache.accumulo.testing.core.randomwalk.RandWalkEnv; import org.apache.accumulo.testing.core.randomwalk.State; import org.apache.accumulo.testing.core.randomwalk.Test; import org.apache.hadoop.io.Text; @@ -33,8 +33,8 @@ import org.apache.hadoop.io.Text; public class DeleteRange extends Test { @Override - public void visit(State state, Environment env, Properties props) throws Exception { - Connector conn = env.getConnector(); + public void visit(State state, RandWalkEnv env, Properties props) throws Exception { + Connector conn = env.getAccumuloConnector(); Random rand = (Random) state.get("rand");