Allowed configuring table props for CI table (#54)
diff --git a/conf/accumulo-testing.properties.example b/conf/accumulo-testing.properties.example
index b64a86e..dc926f5 100644
--- a/conf/accumulo-testing.properties.example
+++ b/conf/accumulo-testing.properties.example
@@ -39,6 +39,11 @@
# Optional authorizations that if specified will be randomly selected by scanners and walkers
# Format: a,b|a,b,c|c
test.ci.common.auths=
+# Accumulo table properties to set when creating table
+test.ci.common.accumulo.table.props=table.file.compress.type=snappy \
+table.majc.compaction.strategy=org.apache.accumulo.tserver.compaction.TwoTierCompactionStrategy \
+table.majc.compaction.strategy.opts.file.large.compress.threshold=100M \
+table.majc.compaction.strategy.opts.file.large.compress.type=gz
# Ingest
# ------
diff --git a/src/main/java/org/apache/accumulo/testing/TestProps.java b/src/main/java/org/apache/accumulo/testing/TestProps.java
index ad49fd3..c82154f 100644
--- a/src/main/java/org/apache/accumulo/testing/TestProps.java
+++ b/src/main/java/org/apache/accumulo/testing/TestProps.java
@@ -48,6 +48,8 @@
/** Common **/
// Accumulo table used by continuous ingest tests
public static final String CI_COMMON_ACCUMULO_TABLE = CI_COMMON + "accumulo.table";
+ // props to set on the table when created
+ public static final String CI_COMMON_ACCUMULO_TABLE_PROPS = CI_COMMON + "accumulo.table.props";
// Number of tablets that should exist in Accumulo table when created
public static final String CI_COMMON_ACCUMULO_NUM_TABLETS = CI_COMMON + "accumulo.num.tablets";
// Optional authorizations (in CSV format) that if specified will be
diff --git a/src/main/java/org/apache/accumulo/testing/continuous/CreateTable.java b/src/main/java/org/apache/accumulo/testing/continuous/CreateTable.java
index 9558ef9..9373144 100644
--- a/src/main/java/org/apache/accumulo/testing/continuous/CreateTable.java
+++ b/src/main/java/org/apache/accumulo/testing/continuous/CreateTable.java
@@ -16,10 +16,13 @@
*/
package org.apache.accumulo.testing.continuous;
+import java.util.HashMap;
+import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.admin.NewTableConfiguration;
import org.apache.accumulo.testing.TestProps;
import org.apache.hadoop.io.Text;
@@ -38,6 +41,7 @@
int numTablets = Integer.parseInt(env
.getTestProperty(TestProps.CI_COMMON_ACCUMULO_NUM_TABLETS));
+
if (numTablets < 1) {
System.err.println("ERROR: numTablets < 1");
System.exit(-1);
@@ -47,8 +51,6 @@
System.exit(-1);
}
- client.tableOperations().create(tableName);
-
SortedSet<Text> splits = new TreeSet<>();
int numSplits = numTablets - 1;
long distance = ((env.getRowMax() - env.getRowMin()) / numTablets) + 1;
@@ -62,9 +64,25 @@
split += distance;
}
- client.tableOperations().addSplits(tableName, splits);
+ NewTableConfiguration ntc = new NewTableConfiguration();
+ ntc.withSplits(splits);
+ ntc.setProperties(getTableProps(env));
+
+ client.tableOperations().create(tableName, ntc);
+
System.out.println("Created Accumulo table '" + tableName + "' with " + numTablets
+ " tablets");
}
}
+
+ private static Map<String,String> getTableProps(ContinuousEnv env) {
+ String[] props = env.getTestProperty(TestProps.CI_COMMON_ACCUMULO_TABLE_PROPS).split(" ");
+ Map<String,String> tableProps = new HashMap<>();
+ for (String prop : props) {
+ System.out.println("prop" + prop);
+ String[] kv = prop.split("=");
+ tableProps.put(kv[0], kv[1]);
+ }
+ return tableProps;
+ }
}