You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mw...@apache.org on 2017/01/10 15:37:52 UTC
[6/9] accumulo git commit: ACCUMULO-4510 Removing random walk test
code
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java
deleted file mode 100644
index 97fec75..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java
+++ /dev/null
@@ -1,148 +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.test.randomwalk.bulk;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.accumulo.core.cli.ClientOnRequiredTable;
-import org.apache.accumulo.core.client.RowIterator;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-import org.apache.hadoop.io.Text;
-
-public class Verify extends Test {
-
- static byte[] zero = new byte[] {'0'};
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- ThreadPoolExecutor threadPool = Setup.getThreadPool(state);
- threadPool.shutdown();
- int lastSize = 0;
- while (!threadPool.isTerminated()) {
- int size = threadPool.getQueue().size() + threadPool.getActiveCount();
- log.info("Waiting for " + size + " nodes to complete");
- if (size != lastSize)
- makingProgress();
- lastSize = size;
- threadPool.awaitTermination(10, TimeUnit.SECONDS);
- }
- if (!"true".equals(state.get("bulkImportSuccess"))) {
- log.info("Not verifying bulk import test due to import failures");
- return;
- }
-
- String user = env.getConnector().whoami();
- Authorizations auths = env.getConnector().securityOperations().getUserAuthorizations(user);
- Scanner scanner = env.getConnector().createScanner(Setup.getTableName(), auths);
- scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY);
- for (Entry<Key,Value> entry : scanner) {
- byte[] value = entry.getValue().get();
- if (!Arrays.equals(value, zero)) {
- throw new Exception("Bad key at " + entry);
- }
- }
-
- scanner.clearColumns();
- scanner.fetchColumnFamily(BulkPlusOne.MARKER_CF);
- RowIterator rowIter = new RowIterator(scanner);
-
- while (rowIter.hasNext()) {
- Iterator<Entry<Key,Value>> row = rowIter.next();
- long prev = 0;
- Text rowText = null;
- while (row.hasNext()) {
- Entry<Key,Value> entry = row.next();
-
- if (rowText == null)
- rowText = entry.getKey().getRow();
-
- long curr = Long.parseLong(entry.getKey().getColumnQualifier().toString());
-
- if (curr - 1 != prev)
- throw new Exception("Bad marker count " + entry.getKey() + " " + entry.getValue() + " " + prev);
-
- if (!entry.getValue().toString().equals("1"))
- throw new Exception("Bad marker value " + entry.getKey() + " " + entry.getValue());
-
- prev = curr;
- }
-
- if (BulkPlusOne.counter.get() != prev) {
- throw new Exception("Row " + rowText + " does not have all markers " + BulkPlusOne.counter.get() + " " + prev);
- }
- }
-
- log.info("Test successful on table " + Setup.getTableName());
- env.getConnector().tableOperations().delete(Setup.getTableName());
- }
-
- public static void main(String args[]) throws Exception {
- ClientOnRequiredTable opts = new ClientOnRequiredTable();
- opts.parseArgs(Verify.class.getName(), args);
- Scanner scanner = opts.getConnector().createScanner(opts.getTableName(), opts.auths);
- scanner.fetchColumnFamily(BulkPlusOne.CHECK_COLUMN_FAMILY);
- Text startBadRow = null;
- Text lastBadRow = null;
- Value currentBadValue = null;
- for (Entry<Key,Value> entry : scanner) {
- // System.out.println("Entry: " + entry);
- byte[] value = entry.getValue().get();
- if (!Arrays.equals(value, zero)) {
- if (currentBadValue == null || entry.getValue().equals(currentBadValue)) {
- // same value, keep skipping ahead
- lastBadRow = new Text(entry.getKey().getRow());
- if (startBadRow == null)
- startBadRow = lastBadRow;
- } else {
- // new bad value, report
- report(startBadRow, lastBadRow, currentBadValue);
- startBadRow = lastBadRow = new Text(entry.getKey().getRow());
- }
- currentBadValue = new Value(entry.getValue());
- } else {
- // end of bad range, report
- if (startBadRow != null) {
- report(startBadRow, lastBadRow, currentBadValue);
- }
- startBadRow = lastBadRow = null;
- currentBadValue = null;
- }
- }
- if (startBadRow != null) {
- report(startBadRow, lastBadRow, currentBadValue);
- }
- }
-
- private static void report(Text startBadRow, Text lastBadRow, Value value) {
- System.out.println("Bad value " + new String(value.get(), UTF_8));
- System.out.println(" Range [" + startBadRow + " -> " + lastBadRow + "]");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
deleted file mode 100644
index dc040a6..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/AddSplits.java
+++ /dev/null
@@ -1,62 +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.test.randomwalk.concurrent;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-import java.util.TreeSet;
-
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-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();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
- tableNames = new ArrayList<>(tableNames);
- tableNames.add(MetadataTable.NAME);
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- TreeSet<Text> splits = new TreeSet<>();
-
- for (int i = 0; i < rand.nextInt(10) + 1; i++)
- splits.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
-
- try {
- conn.tableOperations().addSplits(tableName, splits);
- log.debug("Added " + splits.size() + " splits " + tableName);
- } catch (TableNotFoundException e) {
- log.debug("AddSplits " + tableName + " failed, doesnt exist");
- } catch (TableOfflineException e) {
- log.debug("AddSplits " + tableName + " failed, offline");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Apocalypse.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Apocalypse.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Apocalypse.java
deleted file mode 100644
index b2d3d50..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Apocalypse.java
+++ /dev/null
@@ -1,34 +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.test.randomwalk.concurrent;
-
-import java.util.Properties;
-
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class Apocalypse extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Process exec = Runtime.getRuntime().exec(new String[] {System.getenv("ACCUMULO_HOME") + "/test/system/randomwalk/bin/apocalypse.sh"});
- if (exec.waitFor() != 0)
- throw new RuntimeException("apocalypse.sh returned a non-zero response: " + exec.exitValue());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchScan.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchScan.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchScan.java
deleted file mode 100644
index 111e6c7..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchScan.java
+++ /dev/null
@@ -1,84 +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.test.randomwalk.concurrent;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.BatchScanner;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.TableDeletedException;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.TableOfflineException;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class BatchScan extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- try {
- BatchScanner bs = conn.createBatchScanner(tableName, Authorizations.EMPTY, 3);
- List<Range> ranges = new ArrayList<>();
- for (int i = 0; i < rand.nextInt(2000) + 1; i++)
- ranges.add(new Range(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
-
- bs.setRanges(ranges);
-
- try {
- Iterator<Entry<Key,Value>> iter = bs.iterator();
- while (iter.hasNext())
- iter.next();
- } finally {
- bs.close();
- }
-
- log.debug("Wrote to " + tableName);
- } catch (TableNotFoundException e) {
- log.debug("BatchScan " + tableName + " failed, doesnt exist");
- } catch (TableDeletedException tde) {
- log.debug("BatchScan " + tableName + " failed, table deleted");
- } catch (TableOfflineException e) {
- log.debug("BatchScan " + tableName + " failed, offline");
- } catch (RuntimeException e) {
- if (e.getCause() instanceof AccumuloSecurityException) {
- log.debug("BatchScan " + tableName + " failed, permission error");
- } else {
- throw e;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java
deleted file mode 100644
index 76f5cbd..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java
+++ /dev/null
@@ -1,82 +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.test.randomwalk.concurrent;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.TableDeletedException;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class BatchWrite extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- try {
- BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
- try {
- int numRows = rand.nextInt(100000);
- for (int i = 0; i < numRows; i++) {
- Mutation m = new Mutation(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl));
- long val = rand.nextLong() & 0x7fffffffffffffffl;
- for (int j = 0; j < 10; j++) {
- m.put("cf", "cq" + j, new Value(String.format("%016x", val).getBytes(UTF_8)));
- }
-
- bw.addMutation(m);
- }
- } finally {
- bw.close();
- }
-
- log.debug("Wrote to " + tableName);
- } catch (TableNotFoundException e) {
- log.debug("BatchWrite " + tableName + " failed, doesnt exist");
- } catch (TableOfflineException e) {
- log.debug("BatchWrite " + tableName + " failed, offline");
- } catch (MutationsRejectedException mre) {
- if (mre.getCause() instanceof TableDeletedException)
- log.debug("BatchWrite " + tableName + " failed, table deleted");
- else if (mre.getCause() instanceof TableOfflineException)
- log.debug("BatchWrite " + tableName + " failed, offline");
- else
- throw mre;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
deleted file mode 100644
index 0e5e439..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java
+++ /dev/null
@@ -1,151 +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.test.randomwalk.concurrent;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-import java.util.TreeSet;
-
-import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.TableOfflineException;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.data.ColumnUpdate;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Mutation;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.Path;
-
-public class BulkImport extends Test {
-
- public static class RFileBatchWriter implements BatchWriter {
-
- RFile.Writer writer;
-
- public RFileBatchWriter(Configuration conf, FileSystem fs, String file) throws IOException {
- AccumuloConfiguration aconf = AccumuloConfiguration.getDefaultConfiguration();
- CachableBlockFile.Writer cbw = new CachableBlockFile.Writer(PositionedOutputs.wrap(fs.create(new Path(file), false,
- conf.getInt("io.file.buffer.size", 4096), (short) conf.getInt("dfs.replication", 3), conf.getLong("dfs.block.size", 1 << 26))), "gz", conf, aconf);
- writer = new RFile.Writer(cbw, 100000);
- writer.startDefaultLocalityGroup();
- }
-
- @Override
- public void addMutation(Mutation m) throws MutationsRejectedException {
- List<ColumnUpdate> updates = m.getUpdates();
- for (ColumnUpdate cu : updates) {
- Key key = new Key(m.getRow(), cu.getColumnFamily(), cu.getColumnQualifier(), cu.getColumnVisibility(), 42, false, false);
- Value val = new Value(cu.getValue(), false);
-
- try {
- writer.append(key, val);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- @Override
- public void addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException {
- for (Mutation mutation : iterable)
- addMutation(mutation);
- }
-
- @Override
- public void flush() throws MutationsRejectedException {}
-
- @Override
- public void close() throws MutationsRejectedException {
- try {
- writer.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- }
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- Configuration conf = CachedConfiguration.getInstance();
- FileSystem fs = FileSystem.get(conf);
-
- String bulkDir = "/tmp/concurrent_bulk/b_" + String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl);
-
- fs.mkdirs(new Path(bulkDir));
- fs.mkdirs(new Path(bulkDir + "_f"));
-
- try {
- BatchWriter bw = new RFileBatchWriter(conf, fs, bulkDir + "/file01.rf");
- try {
- TreeSet<Long> rows = new TreeSet<>();
- int numRows = rand.nextInt(100000);
- for (int i = 0; i < numRows; i++) {
- rows.add(rand.nextLong() & 0x7fffffffffffffffl);
- }
-
- for (Long row : rows) {
- Mutation m = new Mutation(String.format("%016x", row));
- long val = rand.nextLong() & 0x7fffffffffffffffl;
- for (int j = 0; j < 10; j++) {
- m.put("cf", "cq" + j, new Value(String.format("%016x", val).getBytes(UTF_8)));
- }
-
- bw.addMutation(m);
- }
- } finally {
- bw.close();
- }
-
- conn.tableOperations().importDirectory(tableName, bulkDir, bulkDir + "_f", rand.nextBoolean());
-
- log.debug("BulkImported to " + tableName);
- } catch (TableNotFoundException e) {
- log.debug("BulkImport " + tableName + " failed, doesnt exist");
- } catch (TableOfflineException toe) {
- log.debug("BulkImport " + tableName + " failed, offline");
- } finally {
- fs.delete(new Path(bulkDir), true);
- fs.delete(new Path(bulkDir + "_f"), true);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangeAuthorizations.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangeAuthorizations.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangeAuthorizations.java
deleted file mode 100644
index 646c415..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangeAuthorizations.java
+++ /dev/null
@@ -1,63 +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.test.randomwalk.concurrent;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class ChangeAuthorizations extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> userNames = (List<String>) state.get("users");
-
- String userName = userNames.get(rand.nextInt(userNames.size()));
- try {
- List<byte[]> auths = new ArrayList<>(conn.securityOperations().getUserAuthorizations(userName).getAuthorizations());
-
- if (rand.nextBoolean()) {
- String authorization = String.format("a%d", rand.nextInt(5000));
- log.debug("adding authorization " + authorization);
- auths.add(authorization.getBytes(UTF_8));
- } else {
- if (auths.size() > 0) {
- log.debug("removing authorization " + new String(auths.remove(0), UTF_8));
- }
- }
- conn.securityOperations().changeUserAuthorizations(userName, new Authorizations(auths));
- } catch (AccumuloSecurityException ex) {
- log.debug("Unable to change user authorizations: " + ex.getCause());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
deleted file mode 100644
index 7e8f789..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ChangePermissions.java
+++ /dev/null
@@ -1,156 +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.test.randomwalk.concurrent;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class ChangePermissions extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> userNames = (List<String>) state.get("users");
- String userName = userNames.get(rand.nextInt(userNames.size()));
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- @SuppressWarnings("unchecked")
- List<String> namespaces = (List<String>) state.get("namespaces");
- String namespace = namespaces.get(rand.nextInt(namespaces.size()));
-
- try {
- int dice = rand.nextInt(3);
- if (dice == 0)
- changeSystemPermission(conn, rand, userName);
- else if (dice == 1)
- changeTablePermission(conn, rand, userName, tableName);
- else if (dice == 2)
- changeNamespacePermission(conn, rand, userName, namespace);
- } catch (AccumuloSecurityException ex) {
- log.debug("Unable to change user permissions: " + ex.getCause());
- } catch (AccumuloException ex) {
- Throwable cause = ex.getCause();
- if (cause != null && cause instanceof ThriftTableOperationException) {
- ThriftTableOperationException toe = (ThriftTableOperationException) cause.getCause();
- if (toe.type == TableOperationExceptionType.NAMESPACE_NOTFOUND) {
- log.debug("Unable to change user permissions: " + toe);
- return;
- }
- }
- }
- }
-
- private void changeTablePermission(Connector conn, Random rand, String userName, String tableName) throws AccumuloException, AccumuloSecurityException {
-
- EnumSet<TablePermission> perms = EnumSet.noneOf(TablePermission.class);
- for (TablePermission p : TablePermission.values()) {
- if (conn.securityOperations().hasTablePermission(userName, tableName, p))
- perms.add(p);
- }
-
- EnumSet<TablePermission> more = EnumSet.allOf(TablePermission.class);
- more.removeAll(perms);
-
- if (rand.nextBoolean() && more.size() > 0) {
- List<TablePermission> moreList = new ArrayList<>(more);
- TablePermission choice = moreList.get(rand.nextInt(moreList.size()));
- log.debug("adding permission " + choice);
- conn.securityOperations().grantTablePermission(userName, tableName, choice);
- } else {
- if (perms.size() > 0) {
- List<TablePermission> permList = new ArrayList<>(perms);
- TablePermission choice = permList.get(rand.nextInt(permList.size()));
- log.debug("removing permission " + choice);
- conn.securityOperations().revokeTablePermission(userName, tableName, choice);
- }
- }
- }
-
- private void changeSystemPermission(Connector conn, Random rand, String userName) throws AccumuloException, AccumuloSecurityException {
- EnumSet<SystemPermission> perms = EnumSet.noneOf(SystemPermission.class);
- for (SystemPermission p : SystemPermission.values()) {
- if (conn.securityOperations().hasSystemPermission(userName, p))
- perms.add(p);
- }
-
- EnumSet<SystemPermission> more = EnumSet.allOf(SystemPermission.class);
- more.removeAll(perms);
- more.remove(SystemPermission.GRANT);
-
- if (rand.nextBoolean() && more.size() > 0) {
- List<SystemPermission> moreList = new ArrayList<>(more);
- SystemPermission choice = moreList.get(rand.nextInt(moreList.size()));
- log.debug("adding permission " + choice);
- conn.securityOperations().grantSystemPermission(userName, choice);
- } else {
- if (perms.size() > 0) {
- List<SystemPermission> permList = new ArrayList<>(perms);
- SystemPermission choice = permList.get(rand.nextInt(permList.size()));
- log.debug("removing permission " + choice);
- conn.securityOperations().revokeSystemPermission(userName, choice);
- }
- }
- }
-
- private void changeNamespacePermission(Connector conn, Random rand, String userName, String namespace) throws AccumuloException, AccumuloSecurityException {
-
- EnumSet<NamespacePermission> perms = EnumSet.noneOf(NamespacePermission.class);
- for (NamespacePermission p : NamespacePermission.values()) {
- if (conn.securityOperations().hasNamespacePermission(userName, namespace, p))
- perms.add(p);
- }
-
- EnumSet<NamespacePermission> more = EnumSet.allOf(NamespacePermission.class);
- more.removeAll(perms);
-
- if (rand.nextBoolean() && more.size() > 0) {
- List<NamespacePermission> moreList = new ArrayList<>(more);
- NamespacePermission choice = moreList.get(rand.nextInt(moreList.size()));
- log.debug("adding permission " + choice);
- conn.securityOperations().grantNamespacePermission(userName, namespace, choice);
- } else {
- if (perms.size() > 0) {
- List<NamespacePermission> permList = new ArrayList<>(perms);
- NamespacePermission choice = permList.get(rand.nextInt(permList.size()));
- log.debug("removing permission " + choice);
- conn.securityOperations().revokeNamespacePermission(userName, namespace, choice);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckPermission.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckPermission.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckPermission.java
deleted file mode 100644
index d759fef..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CheckPermission.java
+++ /dev/null
@@ -1,70 +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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class CheckPermission extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> userNames = (List<String>) state.get("users");
- String userName = userNames.get(rand.nextInt(userNames.size()));
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- @SuppressWarnings("unchecked")
- List<String> namespaces = (List<String>) state.get("namespaces");
- String namespace = namespaces.get(rand.nextInt(namespaces.size()));
-
- try {
- int dice = rand.nextInt(2);
- if (dice == 0) {
- log.debug("Checking systerm permission " + userName);
- conn.securityOperations().hasSystemPermission(userName, SystemPermission.values()[rand.nextInt(SystemPermission.values().length)]);
- } else if (dice == 1) {
- log.debug("Checking table permission " + userName + " " + tableName);
- conn.securityOperations().hasTablePermission(userName, tableName, TablePermission.values()[rand.nextInt(TablePermission.values().length)]);
- } else if (dice == 2) {
- log.debug("Checking namespace permission " + userName + " " + namespace);
- conn.securityOperations().hasNamespacePermission(userName, namespace, NamespacePermission.values()[rand.nextInt(NamespacePermission.values().length)]);
- }
-
- } catch (AccumuloSecurityException ex) {
- log.debug("Unable to check permissions: " + ex.getCause());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java
deleted file mode 100644
index 90ad14a..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CloneTable.java
+++ /dev/null
@@ -1,66 +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.test.randomwalk.concurrent;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloException;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class CloneTable extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String srcTableName = tableNames.get(rand.nextInt(tableNames.size()));
- String newTableName = tableNames.get(rand.nextInt(tableNames.size()));
- boolean flush = rand.nextBoolean();
-
- try {
- log.debug("Cloning table " + srcTableName + " " + newTableName + " " + flush);
- conn.tableOperations().clone(srcTableName, newTableName, flush, new HashMap<String,String>(), new HashSet<String>());
- } catch (TableExistsException e) {
- log.debug("Clone " + srcTableName + " failed, " + newTableName + " exists");
- } catch (TableNotFoundException e) {
- log.debug("Clone " + srcTableName + " failed, doesnt exist");
- } catch (IllegalArgumentException e) {
- log.debug("Clone: " + e.toString());
- } catch (AccumuloException e) {
- Throwable cause = e.getCause();
- if (cause != null && cause instanceof NamespaceNotFoundException)
- log.debug("Clone: " + srcTableName + " to " + newTableName + " failed, namespace not found");
- else
- throw e;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
deleted file mode 100644
index d0f1010..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Compact.java
+++ /dev/null
@@ -1,57 +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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-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();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- List<Text> range = ConcurrentFixture.generateRange(rand);
-
- try {
- boolean wait = rand.nextBoolean();
- conn.tableOperations().compact(tableName, range.get(0), range.get(1), false, wait);
- log.debug((wait ? "compacted " : "initiated compaction ") + tableName + " from " + range.get(0) + " to " + range.get(1));
- } catch (TableNotFoundException tne) {
- log.debug("compact " + tableName + " from " + range.get(0) + " to " + range.get(1) + " failed, doesnt exist");
- } catch (TableOfflineException toe) {
- log.debug("compact " + tableName + " from " + range.get(0) + " to " + range.get(1) + " failed, offline");
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
deleted file mode 100644
index 403a66a..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ConcurrentFixture.java
+++ /dev/null
@@ -1,73 +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.test.randomwalk.concurrent;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.Fixture;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.hadoop.io.Text;
-
-/**
- * When multiple instance of this test suite are run, all instances will operate on the same set of table names.
- *
- *
- */
-
-public class ConcurrentFixture extends Fixture {
-
- @Override
- public void setUp(State state, Environment env) throws Exception {}
-
- @Override
- public void tearDown(State state, Environment env) throws Exception {}
-
- /**
- *
- * @param rand
- * A Random to use
- * @return A two element list with first being smaller than the second, but either value (or both) can be null
- */
- public static List<Text> generateRange(Random rand) {
- ArrayList<Text> toRet = new ArrayList<>(2);
-
- long firstLong = rand.nextLong();
-
- long secondLong = rand.nextLong();
- Text first = null, second = null;
-
- // Having all negative values = null might be too frequent
- if (firstLong >= 0)
- first = new Text(String.format("%016x", firstLong & 0x7fffffffffffffffl));
- if (secondLong >= 0)
- second = new Text(String.format("%016x", secondLong & 0x7fffffffffffffffl));
-
- if (first != null && second != null && first.compareTo(second) > 0) {
- Text swap = first;
- first = second;
- second = swap;
- }
-
- toRet.add(first);
- toRet.add(second);
-
- return toRet;
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
deleted file mode 100644
index b05e08c..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Config.java
+++ /dev/null
@@ -1,235 +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.test.randomwalk.concurrent;
-
-import java.util.Properties;
-import java.util.SortedSet;
-
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-import org.apache.commons.math3.random.RandomDataGenerator;
-
-public class Config extends Test {
-
- private static final String LAST_SETTING = "lastSetting";
-
- private static final String LAST_TABLE_SETTING = "lastTableSetting";
-
- private static final String LAST_NAMESPACE_SETTING = "lastNamespaceSetting";
-
- static class Setting {
- public Property property;
- public long min;
- public long max;
-
- public Setting(Property property, long min, long max) {
- this.property = property;
- this.min = min;
- this.max = max;
- }
- }
-
- static Setting s(Property property, long min, long max) {
- return new Setting(property, min, max);
- }
-
- // @formatter:off
- Setting[] settings = {
- s(Property.TSERV_BLOOM_LOAD_MAXCONCURRENT, 1, 10),
- s(Property.TSERV_BULK_PROCESS_THREADS, 1, 10),
- s(Property.TSERV_BULK_RETRY, 1, 10),
- s(Property.TSERV_BULK_TIMEOUT, 10, 600),
- s(Property.TSERV_BULK_ASSIGNMENT_THREADS, 1, 10),
- s(Property.TSERV_DATACACHE_SIZE, 0, 1000000000L),
- s(Property.TSERV_INDEXCACHE_SIZE, 0, 1000000000L),
- s(Property.TSERV_CLIENT_TIMEOUT, 100, 10000),
- s(Property.TSERV_MAJC_MAXCONCURRENT, 1, 10),
- s(Property.TSERV_MAJC_DELAY, 100, 10000),
- s(Property.TSERV_MAJC_THREAD_MAXOPEN, 3, 100),
- s(Property.TSERV_MINC_MAXCONCURRENT, 1, 10),
- s(Property.TSERV_DEFAULT_BLOCKSIZE, 100000, 10000000L),
- s(Property.TSERV_MAX_IDLE, 10000, 500 * 1000),
- s(Property.TSERV_MAXMEM, 1000000, 3 * 1024 * 1024 * 1024L),
- s(Property.TSERV_READ_AHEAD_MAXCONCURRENT, 1, 25),
- s(Property.TSERV_MIGRATE_MAXCONCURRENT, 1, 10),
- s(Property.TSERV_TOTAL_MUTATION_QUEUE_MAX, 10000, 1024 * 1024),
- s(Property.TSERV_RECOVERY_MAX_CONCURRENT, 1, 100),
- s(Property.TSERV_SCAN_MAX_OPENFILES, 10, 1000),
- s(Property.TSERV_THREADCHECK, 100, 10000),
- s(Property.TSERV_MINTHREADS, 1, 100),
- s(Property.TSERV_SESSION_MAXIDLE, 100, 5 * 60 * 1000),
- s(Property.TSERV_SORT_BUFFER_SIZE, 1024 * 1024, 1024 * 1024 * 1024L),
- s(Property.TSERV_TABLET_SPLIT_FINDMIDPOINT_MAXOPEN, 5, 100),
- s(Property.TSERV_WAL_BLOCKSIZE, 1024 * 1024, 1024 * 1024 * 1024 * 10L),
- s(Property.TSERV_WORKQ_THREADS, 1, 10),
- s(Property.MASTER_BULK_THREADPOOL_SIZE, 1, 10),
- s(Property.MASTER_BULK_RETRIES, 1, 10),
- s(Property.MASTER_BULK_TIMEOUT, 10, 600),
- s(Property.MASTER_FATE_THREADPOOL_SIZE, 1, 100),
- s(Property.MASTER_RECOVERY_DELAY, 0, 100),
- s(Property.MASTER_LEASE_RECOVERY_WAITING_PERIOD, 0, 10),
- s(Property.MASTER_RECOVERY_MAXTIME, 10, 1000),
- s(Property.MASTER_THREADCHECK, 100, 10000),
- s(Property.MASTER_MINTHREADS, 1, 200),};
-
- Setting[] tableSettings = {
- s(Property.TABLE_MAJC_RATIO, 1, 10),
- s(Property.TABLE_MAJC_COMPACTALL_IDLETIME, 100, 10 * 60 * 60 * 1000L),
- s(Property.TABLE_SPLIT_THRESHOLD, 10 * 1024, 10L * 1024 * 1024 * 1024),
- s(Property.TABLE_MINC_COMPACT_IDLETIME, 100, 100 * 60 * 60 * 1000L),
- s(Property.TABLE_SCAN_MAXMEM, 10 * 1024, 10 * 1024 * 1024),
- s(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE, 10 * 1024, 10 * 1024 * 1024L),
- s(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX, 10 * 1024, 10 * 1024 * 1024L),
- s(Property.TABLE_FILE_REPLICATION, 0, 5),
- s(Property.TABLE_FILE_MAX, 2, 50),};
- // @formatter:on
-
- @Override
- public void visit(State state, Environment 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());
- }
- lastSetting = state.getOkIfAbsent(LAST_TABLE_SETTING);
- if (lastSetting != null) {
- String parts[] = lastSetting.toString().split(",");
- String table = parts[0];
- int choice = Integer.parseInt(parts[1]);
- Property property = tableSettings[choice].property;
- if (env.getConnector().tableOperations().exists(table)) {
- log.debug("Setting " + property.getKey() + " on " + table + " back to " + property.getDefaultValue());
- try {
- env.getConnector().tableOperations().setProperty(table, property.getKey(), property.getDefaultValue());
- } catch (AccumuloException ex) {
- if (ex.getCause() instanceof ThriftTableOperationException) {
- ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause();
- if (ttoe.type == TableOperationExceptionType.NOTFOUND)
- return;
- }
- throw ex;
- }
- }
- }
- lastSetting = state.getOkIfAbsent(LAST_NAMESPACE_SETTING);
- if (lastSetting != null) {
- String parts[] = lastSetting.toString().split(",");
- String namespace = parts[0];
- int choice = Integer.parseInt(parts[1]);
- Property property = tableSettings[choice].property;
- if (env.getConnector().namespaceOperations().exists(namespace)) {
- log.debug("Setting " + property.getKey() + " on " + namespace + " back to " + property.getDefaultValue());
- try {
- env.getConnector().namespaceOperations().setProperty(namespace, property.getKey(), property.getDefaultValue());
- } catch (AccumuloException ex) {
- if (ex.getCause() instanceof ThriftTableOperationException) {
- ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause();
- if (ttoe.type == TableOperationExceptionType.NAMESPACE_NOTFOUND)
- return;
- }
- throw ex;
- }
- }
- }
- state.remove(LAST_SETTING);
- state.remove(LAST_TABLE_SETTING);
- state.remove(LAST_NAMESPACE_SETTING);
- RandomDataGenerator random = new RandomDataGenerator();
- int dice = random.nextInt(0, 2);
- if (dice == 0) {
- changeTableSetting(random, state, env, props);
- } else if (dice == 1) {
- changeNamespaceSetting(random, state, env, props);
- } else {
- changeSetting(random, state, env, props);
- }
- }
-
- private void changeTableSetting(RandomDataGenerator random, State state, Environment 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");
- if (tables.isEmpty())
- return;
- String table = random.nextSample(tables, 1)[0].toString();
-
- // generate a random value
- long newValue = random.nextLong(setting.min, setting.max);
- 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);
- } catch (AccumuloException ex) {
- if (ex.getCause() instanceof ThriftTableOperationException) {
- ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause();
- if (ttoe.type == TableOperationExceptionType.NOTFOUND)
- return;
- }
- throw ex;
- }
- }
-
- private void changeNamespaceSetting(RandomDataGenerator random, State state, Environment 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");
- if (namespaces.isEmpty())
- return;
- String namespace = random.nextSample(namespaces, 1)[0].toString();
-
- // generate a random value
- long newValue = random.nextLong(setting.min, setting.max);
- 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);
- } catch (AccumuloException ex) {
- if (ex.getCause() instanceof ThriftTableOperationException) {
- ThriftTableOperationException ttoe = (ThriftTableOperationException) ex.getCause();
- if (ttoe.type == TableOperationExceptionType.NAMESPACE_NOTFOUND)
- return;
- }
- throw ex;
- }
- }
-
- private void changeSetting(RandomDataGenerator random, State state, Environment env, Properties props) throws Exception {
- // pick a random property
- int choice = random.nextInt(0, settings.length - 1);
- Setting setting = settings[choice];
- // generate a random value
- 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);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateNamespace.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateNamespace.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateNamespace.java
deleted file mode 100644
index a30c958..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateNamespace.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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.NamespaceExistsException;
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class CreateNamespace extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> namespaces = (List<String>) state.get("namespaces");
-
- String namespace = namespaces.get(rand.nextInt(namespaces.size()));
-
- try {
- conn.namespaceOperations().create(namespace);
- log.debug("Created namespace " + namespace);
- } catch (NamespaceExistsException e) {
- log.debug("Create namespace " + namespace + " failed, it exists");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
deleted file mode 100644
index 30d49f0..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateTable.java
+++ /dev/null
@@ -1,61 +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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloException;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class CreateTable extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- try {
- conn.tableOperations().create(tableName);
- log.debug("Created table " + tableName);
- } catch (TableExistsException e) {
- log.debug("Create " + tableName + " failed, it exists");
- } catch (AccumuloException e) {
- if (e.getCause() != null && e.getCause() instanceof NamespaceNotFoundException)
- log.debug("Create " + tableName + " failed, the namespace does not exist");
- else
- throw e;
- } catch (IllegalArgumentException e) {
- log.debug("Create: " + e.toString());
- } catch (AccumuloSecurityException e) {
- log.debug("Could not create table: " + e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.java
deleted file mode 100644
index e73e80a..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/CreateUser.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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class CreateUser extends Test {
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> userNames = (List<String>) state.get("users");
-
- String userName = userNames.get(rand.nextInt(userNames.size()));
-
- try {
- log.debug("Creating user " + userName);
- conn.securityOperations().createLocalUser(userName, new PasswordToken(userName + "pass"));
- } catch (AccumuloSecurityException ex) {
- log.debug("Create user failed " + ex.getCause());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
deleted file mode 100644
index 07d7350..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteNamespace.java
+++ /dev/null
@@ -1,52 +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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class DeleteNamespace extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> namespaces = (List<String>) state.get("namespaces");
-
- String namespace = namespaces.get(rand.nextInt(namespaces.size()));
-
- try {
- conn.namespaceOperations().delete(namespace);
- log.debug("Deleted namespace " + namespace);
- } catch (NamespaceNotFoundException e) {
- log.debug("Delete namespace " + namespace + " failed, doesnt exist");
- } catch (NamespaceNotEmptyException e) {
- log.debug("Delete namespace " + namespace + " failed, not empty");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteRange.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteRange.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteRange.java
deleted file mode 100644
index c164b6b..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteRange.java
+++ /dev/null
@@ -1,66 +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.test.randomwalk.concurrent;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-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.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-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();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- List<Text> range = new ArrayList<>();
- do {
- range.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
- range.add(new Text(String.format("%016x", rand.nextLong() & 0x7fffffffffffffffl)));
- } while (range.get(0).equals(range.get(1)));
- Collections.sort(range);
- if (rand.nextInt(20) == 0)
- range.set(0, null);
- if (rand.nextInt(20) == 0)
- range.set(1, null);
-
- try {
- conn.tableOperations().deleteRows(tableName, range.get(0), range.get(1));
- log.debug("deleted rows (" + range.get(0) + " -> " + range.get(1) + "] in " + tableName);
- } catch (TableNotFoundException tne) {
- log.debug("deleted rows " + tableName + " failed, doesnt exist");
- } catch (TableOfflineException toe) {
- log.debug("deleted rows " + tableName + " failed, offline");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteTable.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteTable.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteTable.java
deleted file mode 100644
index 4bee7f1..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DeleteTable.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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class DeleteTable extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- try {
- conn.tableOperations().delete(tableName);
- log.debug("Deleted table " + tableName);
- } catch (TableNotFoundException e) {
- log.debug("Delete " + tableName + " failed, doesnt exist");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java
deleted file mode 100644
index a4442c6..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/DropUser.java
+++ /dev/null
@@ -1,48 +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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class DropUser extends Test {
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> userNames = (List<String>) state.get("users");
-
- String userName = userNames.get(rand.nextInt(userNames.size()));
-
- try {
- log.debug("Dropping user " + userName);
- conn.securityOperations().dropLocalUser(userName);
- } catch (AccumuloSecurityException ex) {
- log.debug("Unable to drop " + ex.getCause());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/IsolatedScan.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/IsolatedScan.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/IsolatedScan.java
deleted file mode 100644
index eac39fa..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/IsolatedScan.java
+++ /dev/null
@@ -1,74 +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.test.randomwalk.concurrent;
-
-import java.util.List;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.IsolatedScanner;
-import org.apache.accumulo.core.client.RowIterator;
-import org.apache.accumulo.core.client.TableDeletedException;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.TableOfflineException;
-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.core.util.PeekingIterator;
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-
-public class IsolatedScan extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- try {
- RowIterator iter = new RowIterator(new IsolatedScanner(conn.createScanner(tableName, Authorizations.EMPTY)));
-
- while (iter.hasNext()) {
- PeekingIterator<Entry<Key,Value>> row = new PeekingIterator<>(iter.next());
- Entry<Key,Value> kv = null;
- if (row.hasNext())
- kv = row.peek();
- while (row.hasNext()) {
- Entry<Key,Value> currentKV = row.next();
- if (!kv.getValue().equals(currentKV.getValue()))
- throw new Exception("values not equal " + kv + " " + currentKV);
- }
- }
- log.debug("Isolated scan " + tableName);
- } catch (TableDeletedException e) {
- log.debug("Isolated scan " + tableName + " failed, table deleted");
- } catch (TableNotFoundException e) {
- log.debug("Isolated scan " + tableName + " failed, doesnt exist");
- } catch (TableOfflineException e) {
- log.debug("Isolated scan " + tableName + " failed, offline");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ListSplits.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ListSplits.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ListSplits.java
deleted file mode 100644
index 6944092..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/ListSplits.java
+++ /dev/null
@@ -1,54 +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.test.randomwalk.concurrent;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-import org.apache.hadoop.io.Text;
-
-public class ListSplits extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
-
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- try {
- Collection<Text> splits = conn.tableOperations().listSplits(tableName);
- log.debug("Table " + tableName + " had " + splits.size() + " splits");
- } catch (TableNotFoundException e) {
- log.debug("listSplits " + tableName + " failed, doesnt exist");
- } catch (AccumuloSecurityException ase) {
- log.debug("listSplits " + tableName + " failed, " + ase.getMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/b24c338a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
deleted file mode 100644
index fe84dca..0000000
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Merge.java
+++ /dev/null
@@ -1,59 +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.test.randomwalk.concurrent;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-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.core.metadata.MetadataTable;
-import org.apache.accumulo.test.randomwalk.Environment;
-import org.apache.accumulo.test.randomwalk.State;
-import org.apache.accumulo.test.randomwalk.Test;
-import org.apache.hadoop.io.Text;
-
-public class Merge extends Test {
-
- @Override
- public void visit(State state, Environment env, Properties props) throws Exception {
- Connector conn = env.getConnector();
-
- Random rand = (Random) state.get("rand");
-
- @SuppressWarnings("unchecked")
- List<String> tableNames = (List<String>) state.get("tables");
- tableNames = new ArrayList<>(tableNames);
- tableNames.add(MetadataTable.NAME);
- String tableName = tableNames.get(rand.nextInt(tableNames.size()));
-
- List<Text> range = ConcurrentFixture.generateRange(rand);
-
- try {
- conn.tableOperations().merge(tableName, range.get(0), range.get(1));
- log.debug("merged " + tableName + " from " + range.get(0) + " to " + range.get(1));
- } catch (TableOfflineException toe) {
- log.debug("merge " + tableName + " from " + range.get(0) + " to " + range.get(1) + " failed, table is not online");
- } catch (TableNotFoundException tne) {
- log.debug("merge " + tableName + " from " + range.get(0) + " to " + range.get(1) + " failed, doesnt exist");
- }
-
- }
-}