use of org.apache.accumulo.core.client.AccumuloClient in project accumulo by apache.
the class TestRandomDeletes method scanAll.
private static TreeSet<RowColumn> scanAll(TestOpts opts) throws Exception {
TreeSet<RowColumn> result = new TreeSet<>();
try (AccumuloClient client = Accumulo.newClient().from(opts.getClientProps()).build();
Scanner scanner = client.createScanner(opts.tableName, auths)) {
for (Entry<Key, Value> entry : scanner) {
Key key = entry.getKey();
Column column = new Column(TextUtil.getBytes(key.getColumnFamily()), TextUtil.getBytes(key.getColumnQualifier()), TextUtil.getBytes(key.getColumnVisibility()));
result.add(new RowColumn(key.getRow(), column, key.getTimestamp()));
}
}
return result;
}
use of org.apache.accumulo.core.client.AccumuloClient in project accumulo by apache.
the class VolumeChooserIT method twoTablesRandomVolumeChooser.
// Test that uses two tables with 10 split points each. They each use the RandomVolumeChooser to
// choose volumes.
@Test
public void twoTablesRandomVolumeChooser() throws Exception {
log.info("Starting twoTablesRandomVolumeChooser()");
// Create namespace
try (AccumuloClient client = Accumulo.newClient().from(getClientProperties()).build()) {
createAndVerify(client, namespace1, v1 + "," + v2 + "," + v3);
createAndVerify(client, namespace2, v1 + "," + v2 + "," + v3);
}
}
use of org.apache.accumulo.core.client.AccumuloClient in project accumulo by apache.
the class CompactionExecutorIT method testIncorrectSelectorType.
@Test
public void testIncorrectSelectorType() throws Exception {
String tableName = "tist";
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
client.tableOperations().create(tableName);
addFiles(client, tableName, 5);
var msg = assertThrows(AccumuloException.class, () -> {
client.tableOperations().compact(tableName, new CompactionConfig().setSelector(new PluginConfig(CompressionConfigurer.class.getName())).setWait(true));
}).getMessage();
assertTrue("Unexpected message : " + msg, msg.contains("TabletServer could not load CompactionSelector"));
}
}
use of org.apache.accumulo.core.client.AccumuloClient in project accumulo by apache.
the class CompactionExecutorIT method testReconfigureCompactionService.
@Test
public void testReconfigureCompactionService() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
createTable(client, "rctt", "recfg");
addFiles(client, "rctt", 22);
while (getFiles(client, "rctt").size() > 2) {
Thread.sleep(100);
}
assertEquals(2, getFiles(client, "rctt").size());
client.instanceOperations().setProperty(Property.TSERV_COMPACTION_SERVICE_PREFIX.getKey() + "recfg.planner.opts.filesPerCompaction", "5");
client.instanceOperations().setProperty(Property.TSERV_COMPACTION_SERVICE_PREFIX.getKey() + "recfg.planner.opts.executors", "1");
addFiles(client, "rctt", 10);
while (getFiles(client, "rctt").size() > 4) {
Thread.sleep(100);
}
assertEquals(4, getFiles(client, "rctt").size());
}
}
use of org.apache.accumulo.core.client.AccumuloClient in project accumulo by apache.
the class CompactionExecutorIT method testTooManyDeletes.
@Test
public void testTooManyDeletes() throws Exception {
try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
Map<String, String> props = Map.of(Property.TABLE_COMPACTION_SELECTOR.getKey(), TooManyDeletesSelector.class.getName(), Property.TABLE_COMPACTION_SELECTOR_OPTS.getKey() + "threshold", ".4");
var deleteSummarizerCfg = SummarizerConfiguration.builder(DeletesSummarizer.class.getName()).build();
client.tableOperations().create("tmd_selector", new NewTableConfiguration().setProperties(props).enableSummarization(deleteSummarizerCfg));
client.tableOperations().create("tmd_control1", new NewTableConfiguration().enableSummarization(deleteSummarizerCfg));
client.tableOperations().create("tmd_control2", new NewTableConfiguration().enableSummarization(deleteSummarizerCfg));
client.tableOperations().create("tmd_control3", new NewTableConfiguration().enableSummarization(deleteSummarizerCfg));
addFile(client, "tmd_selector", 1, 1000, false);
addFile(client, "tmd_selector", 1, 1000, true);
addFile(client, "tmd_control1", 1, 1000, false);
addFile(client, "tmd_control1", 1, 1000, true);
addFile(client, "tmd_control2", 1, 1000, false);
addFile(client, "tmd_control2", 1000, 2000, false);
addFile(client, "tmd_control3", 1, 2000, false);
addFile(client, "tmd_control3", 1, 1000, true);
assertEquals(2, getFiles(client, "tmd_control1").size());
assertEquals(2, getFiles(client, "tmd_control2").size());
assertEquals(2, getFiles(client, "tmd_control3").size());
while (getFiles(client, "tmd_selector").size() != 0) {
Thread.sleep(100);
}
assertEquals(2, getFiles(client, "tmd_control1").size());
assertEquals(2, getFiles(client, "tmd_control2").size());
assertEquals(2, getFiles(client, "tmd_control3").size());
var cc1 = new CompactionConfig().setSelector(new PluginConfig(TooManyDeletesSelector.class.getName(), Map.of("threshold", ".99"))).setWait(true);
client.tableOperations().compact("tmd_control1", cc1);
client.tableOperations().compact("tmd_control2", cc1);
client.tableOperations().compact("tmd_control3", cc1);
assertEquals(0, getFiles(client, "tmd_control1").size());
assertEquals(2, getFiles(client, "tmd_control2").size());
assertEquals(2, getFiles(client, "tmd_control3").size());
var cc2 = new CompactionConfig().setSelector(new PluginConfig(TooManyDeletesSelector.class.getName(), Map.of("threshold", ".40"))).setWait(true);
client.tableOperations().compact("tmd_control1", cc2);
client.tableOperations().compact("tmd_control2", cc2);
client.tableOperations().compact("tmd_control3", cc2);
assertEquals(0, getFiles(client, "tmd_control1").size());
assertEquals(2, getFiles(client, "tmd_control2").size());
assertEquals(1, getFiles(client, "tmd_control3").size());
client.tableOperations().compact("tmd_control2", new CompactionConfig().setWait(true));
assertEquals(1, getFiles(client, "tmd_control2").size());
}
}
Aggregations