This is an automated email from the ASF dual-hosted git repository.
ctubbsii pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git
The following commit(s) were added to refs/heads/main by this push:
new 1ac45a0 Use accumulo-project for dependency mgmt (#181)
1ac45a0 is described below
commit 1ac45a04914f837f48feb479cd738bda43bb8749
Author: Christopher Tubbs <[email protected]>
AuthorDate: Wed Dec 15 12:34:10 2021 -0500
Use accumulo-project for dependency mgmt (#181)
Fix warnings about dependency versions by using the accumulo-project POM
to manage dependencies. This alleviates the need to keep dependency
versions sync'd with the Accumulo main project. Also fix a few other
warnings throughout the project.
* Update POM to make accumulo-project pom manage the dependency versions
for this project (for dependencies used by that pom, anyway)
* Remove unnecessary dependency version management in this project's pom
* Remove log4j direct usage in ClientOpts and ContinuousOpts (log4j2
properties file can be used to control logging debug/trace levels
instead, dynamically if desired)
* Use commons-lang3 where possible, since commons-lang is no longer on
the class path
* Switch out deprecated properties with their replacement, when there is
a direct replacement
* Update TimedScanDispatcher to use the dispatch name with correctly
spelled parameters
* Inline XMLSchema constants to avoid problems with
javax.xml.XMLConstants being ambiguously grabbed from a jar on the
class path
* Remove use of TABLE_MAJC_COMPACTALL_IDLETIME compaction property,
since it was deprecated without replacement, for table settings in the
randomwalk config
* Suppress deprecation warnings by deprecating the Replication
randomwalk class
* Replace finalize method in DataWriter with a Cleaner
---
contrib/import-control.xml | 4 +-
pom.xml | 49 ++--------------------
.../apache/accumulo/testing/cli/ClientOpts.java | 11 -----
.../testing/continuous/ContinuousOpts.java | 27 ------------
.../apache/accumulo/testing/ingest/TestIngest.java | 6 ---
.../accumulo/testing/merkle/MerkleTreeNode.java | 2 +-
.../testing/performance/tests/RollWALPT.java | 4 +-
.../performance/tests/TimedScanDispatcher.java | 26 +++++-------
.../apache/accumulo/testing/randomwalk/Module.java | 3 +-
.../testing/randomwalk/concurrent/Config.java | 10 ++---
.../testing/randomwalk/concurrent/Replication.java | 1 +
.../apache/accumulo/testing/stress/DataWriter.java | 30 +++++++++----
.../org/apache/accumulo/testing/stress/Write.java | 14 +++----
.../accumulo/testing/randomwalk/FrameworkTest.java | 3 +-
.../randomwalk/ReplicationRandomWalkIT.java | 4 +-
15 files changed, 59 insertions(+), 135 deletions(-)
diff --git a/contrib/import-control.xml b/contrib/import-control.xml
index 0ca22cc..824c527 100644
--- a/contrib/import-control.xml
+++ b/contrib/import-control.xml
@@ -21,6 +21,7 @@
<import-control pkg="org.apache.accumulo.testing" strategyOnMismatch="allowed">
<!-- allow this package -->
<allow pkg="org.apache.accumulo.testing"/>
+
<!-- API packages -->
<allow pkg="org.apache.accumulo.core.client"/>
<allow pkg="org.apache.accumulo.core.data"/>
@@ -32,11 +33,10 @@
<!-- SPI package -->
<allow pkg="org.apache.accumulo.core.spi"/>
-
<!-- exceptions for testing -->
<allow pkg="org.apache.accumulo.core.conf"/>
<allow class="org.apache.accumulo.core.util.threads.ThreadPools"/>
-
+ <allow class="org.apache.accumulo.core.util.cleaner.CleanerUtil"/>
<!-- disallow everything else coming from accumulo -->
<disallow pkg="org.apache.accumulo"/>
diff --git a/pom.xml b/pom.xml
index 2b81373..c0a78bc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,15 +24,12 @@
</parent>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-testing</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<name>Apache Accumulo Testing</name>
<description>Testing tools for Apache Accumulo</description>
<properties>
<accumulo.version>2.1.0-SNAPSHOT</accumulo.version>
- <disruptor.version>3.4.4</disruptor.version>
<eclipseFormatterStyle>${project.basedir}/contrib/Eclipse-Accumulo-Codestyle.xml</eclipseFormatterStyle>
- <hadoop.version>3.2.0</hadoop.version>
- <log4j2.version>2.4</log4j2.version>
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
@@ -40,83 +37,55 @@
<minimalMavenBuildVersion>3.5.0</minimalMavenBuildVersion>
<!-- timestamp for reproducible outputs, updated on release by the release
plugin -->
<project.build.outputTimestamp>2021-12-15T00:00:00Z</project.build.outputTimestamp>
- <slf4j.version>1.7.30</slf4j.version>
- <spotbugs.version>3.1.7</spotbugs.version>
- <zookeeper.version>3.4.14</zookeeper.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.apache.logging.log4j</groupId>
- <artifactId>log4j-bom</artifactId>
- <version>${log4j2.version}</version>
+ <groupId>org.apache.accumulo</groupId>
+ <artifactId>accumulo-project</artifactId>
+ <version>${accumulo.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>${zookeeper.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
- <version>${spotbugs.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
- <version>30.1.1-jre</version>
</dependency>
<dependency>
<groupId>com.lmax</groupId>
<artifactId>disruptor</artifactId>
- <version>${disruptor.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.11</version>
- </dependency>
- <dependency>
- <groupId>commons-configuration</groupId>
- <artifactId>commons-configuration</artifactId>
- <version>1.10</version>
</dependency>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-core</artifactId>
- <version>${accumulo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-hadoop-mapreduce</artifactId>
- <version>${accumulo.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
- <version>3.6.1</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-api</artifactId>
- <version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client-runtime</artifactId>
- <version>${hadoop.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
@@ -125,31 +94,21 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-minicluster</artifactId>
- <version>${accumulo.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.accumulo</groupId>
<artifactId>accumulo-test</artifactId>
- <version>${accumulo.version}</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- </exclusion>
- </exclusions>
</dependency>
</dependencies>
<build>
diff --git a/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java
b/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java
index 3cd7823..d0f3fe3 100644
--- a/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java
+++ b/src/main/java/org/apache/accumulo/testing/cli/ClientOpts.java
@@ -36,8 +36,6 @@ import org.apache.accumulo.core.conf.ClientProperty;
import org.apache.accumulo.core.conf.ConfigurationTypeHelper;
import org.apache.accumulo.core.security.Authorizations;
import org.apache.accumulo.core.security.ColumnVisibility;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
import com.beust.jcommander.IStringConverter;
import com.beust.jcommander.Parameter;
@@ -108,9 +106,6 @@ public class ClientOpts extends Help {
description = "the authorizations to use when reading or writing")
public Authorizations auths = Authorizations.EMPTY;
- @Parameter(names = "--debug", description = "turn on TRACE-level log
messages")
- public boolean debug = false;
-
@Parameter(names = {"-c", "--config-file"}, description = "Read the given
client config file. "
+ "If omitted, the classpath will be searched for file named
accumulo-client.properties")
private String clientConfigFile = null;
@@ -119,11 +114,6 @@ public class ClientOpts extends Help {
+ "accumulo-client.properties. Expected format: -o <key>=<value>")
private List<String> overrides = new ArrayList<>();
- public void startDebugLogging() {
- if (debug)
- Logger.getLogger("org.apache.accumulo.testing").setLevel(Level.TRACE);
- }
-
@Parameter(names = "--trace", description = "turn on distributed tracing")
public boolean trace = false;
@@ -149,7 +139,6 @@ public class ClientOpts extends Help {
@Override
public void parseArgs(String programName, String[] args, Object... others) {
super.parseArgs(programName, args, others);
- startDebugLogging();
}
private Properties cachedProps = null;
diff --git
a/src/main/java/org/apache/accumulo/testing/continuous/ContinuousOpts.java
b/src/main/java/org/apache/accumulo/testing/continuous/ContinuousOpts.java
index 847942b..849ec28 100644
--- a/src/main/java/org/apache/accumulo/testing/continuous/ContinuousOpts.java
+++ b/src/main/java/org/apache/accumulo/testing/continuous/ContinuousOpts.java
@@ -16,13 +16,6 @@
*/
package org.apache.accumulo.testing.continuous;
-import java.io.IOException;
-
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-
import com.beust.jcommander.IStringConverter;
import com.beust.jcommander.Parameter;
@@ -31,22 +24,6 @@ import com.beust.jcommander.Parameter;
*/
public class ContinuousOpts {
- public static class DebugConverter implements IStringConverter<String> {
- @Override
- public String convert(String debugLog) {
- Logger logger = Logger.getLogger("org.apache.accumulo.core");
- logger.setLevel(Level.TRACE);
- logger.setAdditivity(false);
- try {
- logger.addAppender(new FileAppender(
- new PatternLayout("%d{dd HH:mm:ss,SSS} [%-8c{2}] %-5p: %m%n"),
debugLog, true));
- } catch (IOException ex) {
- throw new RuntimeException(ex);
- }
- return debugLog;
- }
- }
-
public static class ShortConverter implements IStringConverter<Short> {
@Override
public Short convert(String value) {
@@ -60,10 +37,6 @@ public class ContinuousOpts {
@Parameter(names = "--max", description = "maximum random row number to use")
long max = Long.MAX_VALUE;
- @Parameter(names = "--debugLog", description = "file to write debugging
output",
- converter = DebugConverter.class)
- String debugLog = null;
-
@Parameter(names = "--num", description = "the number of entries to ingest")
long num = Long.MAX_VALUE;
diff --git a/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java
b/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java
index ad3cf1c..878c8dc 100644
--- a/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java
+++ b/src/main/java/org/apache/accumulo/testing/ingest/TestIngest.java
@@ -48,8 +48,6 @@ import org.apache.accumulo.testing.util.FastFormat;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Text;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
import com.beust.jcommander.Parameter;
@@ -182,10 +180,6 @@ public class TestIngest {
try (AccumuloClient client =
Accumulo.newClient().from(opts.getClientProps()).build()) {
- if (opts.debug)
-
Logger.getLogger("org.apache.accumulo.core.clientImpl.TabletServerBatchWriter")
- .setLevel(Level.TRACE);
-
// test batch update
ingest(client, opts, new Configuration());
diff --git
a/src/main/java/org/apache/accumulo/testing/merkle/MerkleTreeNode.java
b/src/main/java/org/apache/accumulo/testing/merkle/MerkleTreeNode.java
index 52b3684..f2ed94e 100644
--- a/src/main/java/org/apache/accumulo/testing/merkle/MerkleTreeNode.java
+++ b/src/main/java/org/apache/accumulo/testing/merkle/MerkleTreeNode.java
@@ -27,7 +27,7 @@ import org.apache.accumulo.core.data.Key;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.data.Value;
import org.apache.commons.codec.binary.Hex;
-import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git
a/src/main/java/org/apache/accumulo/testing/performance/tests/RollWALPT.java
b/src/main/java/org/apache/accumulo/testing/performance/tests/RollWALPT.java
index a91a249..4424cd6 100644
--- a/src/main/java/org/apache/accumulo/testing/performance/tests/RollWALPT.java
+++ b/src/main/java/org/apache/accumulo/testing/performance/tests/RollWALPT.java
@@ -59,7 +59,7 @@ public class RollWALPT implements PerformanceTest {
Map<String,String> config = new HashMap<>();
config.put(Property.TSERV_WAL_REPLICATION.getKey(), "1");
- config.put(Property.TSERV_WALOG_MAX_REFERENCED.getKey(), "100");
+ config.put(Property.TSERV_WAL_MAX_REFERENCED.getKey(), "100");
config.put(Property.GC_CYCLE_START.getKey(), "1s");
config.put(Property.GC_CYCLE_DELAY.getKey(), "1s");
@@ -111,7 +111,7 @@ public class RollWALPT implements PerformanceTest {
private void setMaxWALSize(final String size, final AccumuloClient client)
throws AccumuloSecurityException, AccumuloException {
-
client.instanceOperations().setProperty(Property.TSERV_WALOG_MAX_SIZE.getKey(),
size);
+
client.instanceOperations().setProperty(Property.TSERV_WAL_MAX_SIZE.getKey(),
size);
}
private void initTable(final String tableName, final AccumuloClient client)
diff --git
a/src/main/java/org/apache/accumulo/testing/performance/tests/TimedScanDispatcher.java
b/src/main/java/org/apache/accumulo/testing/performance/tests/TimedScanDispatcher.java
index 1af466d..a3b79d3 100644
---
a/src/main/java/org/apache/accumulo/testing/performance/tests/TimedScanDispatcher.java
+++
b/src/main/java/org/apache/accumulo/testing/performance/tests/TimedScanDispatcher.java
@@ -17,30 +17,26 @@
package org.apache.accumulo.testing.performance.tests;
+import org.apache.accumulo.core.spi.scan.ScanDispatch;
import org.apache.accumulo.core.spi.scan.ScanDispatcher;
-import org.apache.accumulo.core.spi.scan.ScanInfo;
public class TimedScanDispatcher implements ScanDispatcher {
- String quickExecutor;
- long quickTime;
-
- String longExectuor;
+ private String quickExecutor;
+ private String longExectuor;
+ private long quickTime;
+ @Override
public void init(InitParameters params) {
- quickExecutor = params.getOptions().get("quick.executor");
+ var options = params.getOptions();
+ quickExecutor = options.get("quick.executor");
+ longExectuor = options.get("long.executor");
quickTime = Long.parseLong(params.getOptions().get("quick.time.ms"));
-
- longExectuor = params.getOptions().get("long.executor");
}
@Override
- public String dispatch(DispatchParmaters params) {
- ScanInfo scanInfo = params.getScanInfo();
-
- if (scanInfo.getRunTimeStats().sum() < quickTime)
- return quickExecutor;
-
- return longExectuor;
+ public ScanDispatch dispatch(DispatchParameters params) {
+ var n = params.getScanInfo().getRunTimeStats().sum() < quickTime ?
quickExecutor : longExectuor;
+ return ScanDispatch.builder().setExecutorName(n).build();
}
}
diff --git a/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
b/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
index 8341af3..e77620e 100644
--- a/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
+++ b/src/main/java/org/apache/accumulo/testing/randomwalk/Module.java
@@ -35,7 +35,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.validation.Schema;
@@ -509,7 +508,7 @@ public class Module extends Node {
Document d;
// set the schema
- SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ SchemaFactory sf =
SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
Schema moduleSchema = sf
.newSchema(this.getClass().getClassLoader().getResource("randomwalk/module.xsd"));
dbf.setSchema(moduleSchema);
diff --git
a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Config.java
b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Config.java
index 9996b76..feb3604 100644
---
a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Config.java
+++
b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Config.java
@@ -64,9 +64,9 @@ public class Config extends Test {
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_COMPACTION_SERVICE_DEFAULT_EXECUTORS,
1, 10),
s(Property.TSERV_MAJC_DELAY, 100, 10000),
- s(Property.TSERV_MAJC_THREAD_MAXOPEN, 3, 100),
+ s(Property.TSERV_COMPACTION_SERVICE_DEFAULT_MAX_OPEN,
3, 100),
s(Property.TSERV_MINC_MAXCONCURRENT, 1, 10),
s(Property.TSERV_DEFAULT_BLOCKSIZE, 100000, 10000000L),
s(Property.TSERV_MAX_IDLE, 10000, 500 * 1000),
@@ -74,12 +74,12 @@ public class Config extends Test {
s(TSERV_READ_AHEAD_MAXCONCURRENT_deprecated, 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_WAL_SORT_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_WAL_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),
@@ -95,8 +95,6 @@ public class Config extends Test {
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),
diff --git
a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Replication.java
b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Replication.java
index fb775b4..444d000 100644
---
a/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Replication.java
+++
b/src/main/java/org/apache/accumulo/testing/randomwalk/concurrent/Replication.java
@@ -53,6 +53,7 @@ import org.apache.accumulo.testing.randomwalk.State;
import org.apache.accumulo.testing.randomwalk.Test;
import org.apache.hadoop.io.Text;
+@Deprecated
public class Replication extends Test {
final int ROWS = 1000;
diff --git a/src/main/java/org/apache/accumulo/testing/stress/DataWriter.java
b/src/main/java/org/apache/accumulo/testing/stress/DataWriter.java
index 468e58a..f99efcf 100644
--- a/src/main/java/org/apache/accumulo/testing/stress/DataWriter.java
+++ b/src/main/java/org/apache/accumulo/testing/stress/DataWriter.java
@@ -16,16 +16,27 @@
*/
package org.apache.accumulo.testing.stress;
+import java.lang.ref.Cleaner.Cleanable;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.apache.accumulo.core.client.BatchWriter;
import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.core.util.cleaner.CleanerUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class DataWriter extends Stream<Void> {
+public class DataWriter extends Stream<Void> implements AutoCloseable {
private final BatchWriter writer;
private final RandomMutations mutations;
+ private final Cleanable cleanable;
+ private final AtomicBoolean closed = new AtomicBoolean(false);
+
+ private static final Logger log = LoggerFactory.getLogger(DataWriter.class);
public DataWriter(BatchWriter writer, RandomMutations mutations) {
this.writer = writer;
this.mutations = mutations;
+ this.cleanable = CleanerUtil.unclosed(this, DataWriter.class, closed, log,
writer);
}
@Override
@@ -39,12 +50,17 @@ public class DataWriter extends Stream<Void> {
}
@Override
- public void finalize() {
- try {
- this.writer.close();
- } catch (MutationsRejectedException e) {
- System.err.println("Error closing batch writer.");
- e.printStackTrace();
+ public void close() {
+ if (closed.compareAndSet(false, true)) {
+ // deregister cleanable, but it won't run because it checks
+ // the value of closed first, which is now true
+ cleanable.clean();
+ try {
+ writer.close();
+ } catch (MutationsRejectedException e) {
+ System.err.println("Error closing batch writer.");
+ e.printStackTrace();
+ }
}
}
}
diff --git a/src/main/java/org/apache/accumulo/testing/stress/Write.java
b/src/main/java/org/apache/accumulo/testing/stress/Write.java
index 6a86f4b..c35017f 100644
--- a/src/main/java/org/apache/accumulo/testing/stress/Write.java
+++ b/src/main/java/org/apache/accumulo/testing/stress/Write.java
@@ -52,7 +52,7 @@ public class Write {
writeDelay = 0;
}
- DataWriter dw = new DataWriter(c.createBatchWriter(opts.tableName), new
RandomMutations(
+ try (DataWriter dw = new DataWriter(c.createBatchWriter(opts.tableName),
new RandomMutations(
// rows
new RandomByteArrays(new RandomWithinRange(opts.row_seed,
opts.rowMin(), opts.rowMax())),
// cfs
@@ -65,12 +65,12 @@ public class Write {
// number of cells per row
new RandomWithinRange(opts.row_width_seed, opts.rowWidthMin(),
opts.rowWidthMax()),
// max cells per mutation
- opts.max_cells_per_mutation));
-
- while (true) {
- dw.next();
- if (writeDelay > 0) {
- Thread.sleep(writeDelay);
+ opts.max_cells_per_mutation))) {
+ while (true) {
+ dw.next();
+ if (writeDelay > 0) {
+ Thread.sleep(writeDelay);
+ }
}
}
}
diff --git
a/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
b/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
index d56eed5..eb7925c 100644
--- a/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
+++ b/src/test/java/org/apache/accumulo/testing/randomwalk/FrameworkTest.java
@@ -23,7 +23,6 @@ import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
-import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
@@ -41,7 +40,7 @@ public class FrameworkTest {
@org.junit.Test
public void testXML()
throws SAXException, URISyntaxException, ParserConfigurationException,
IOException {
- SchemaFactory sf =
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ SchemaFactory sf =
SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
Schema moduleSchema = sf.newSchema(getFile("/randomwalk/module.xsd"));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
diff --git
a/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
b/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
index ec5dc6a..c66d455 100644
---
a/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
+++
b/src/test/java/org/apache/accumulo/testing/randomwalk/ReplicationRandomWalkIT.java
@@ -23,7 +23,6 @@ import org.apache.accumulo.core.client.Accumulo;
import org.apache.accumulo.core.client.AccumuloClient;
import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
import org.apache.accumulo.test.functional.ConfigurableMacBase;
-import org.apache.accumulo.testing.randomwalk.concurrent.Replication;
import org.apache.hadoop.conf.Configuration;
import org.easymock.EasyMock;
import org.junit.Ignore;
@@ -39,9 +38,10 @@ public class ReplicationRandomWalkIT extends
ConfigurableMacBase {
cfg.setNumTservers(1);
}
+ @Deprecated
@Test(timeout = 5 * 60 * 1000)
public void runReplicationRandomWalkStep() throws Exception {
- Replication r = new Replication();
+ var r = new
org.apache.accumulo.testing.randomwalk.concurrent.Replication();
RandWalkEnv env = EasyMock.createMock(RandWalkEnv.class);
EasyMock.expect(env.getAccumuloUserName()).andReturn("root").anyTimes();