This is an automated email from the ASF dual-hosted git repository. kturner pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/accumulo-testing.git
The following commit(s) were added to refs/heads/master by this push: new aed3196 Allowed configuring table props for CI table (#54) aed3196 is described below commit aed3196884f3c0529e16b7ce8741eacfe1244b0e Author: Keith Turner <ktur...@apache.org> AuthorDate: Thu Jan 31 13:41:58 2019 -0500 Allowed configuring table props for CI table (#54) --- conf/accumulo-testing.properties.example | 5 +++++ .../org/apache/accumulo/testing/TestProps.java | 2 ++ .../accumulo/testing/continuous/CreateTable.java | 24 +++++++++++++++++++--- 3 files changed, 28 insertions(+), 3 deletions(-) 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 @@ test.ci.common.accumulo.num.tablets=20 # 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 @@ public class TestProps { /** 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 @@ public class CreateTable { 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 @@ public class CreateTable { 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 @@ public class CreateTable { 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; + } }