use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTupleStoreAdapter method testTupleStoreConfig2.
/**
* Test configuration 2
* @throws ZookeeperException
*/
@Test(timeout = 60000)
public void testTupleStoreConfig2() throws ZookeeperException {
final TupleStoreConfiguration tupleStoreConfiguration = TupleStoreConfigurationBuilder.create().allowDuplicates(true).withTTL(10000, TimeUnit.MILLISECONDS).withVersions(100).build();
final TupleStoreName tupleStoreName = new TupleStoreName("dg_table1");
tupleStoreAdapter.deleteTable(tupleStoreName);
Assert.assertFalse(tupleStoreAdapter.isTableKnown(tupleStoreName));
tupleStoreAdapter.writeTuplestoreConfiguration(tupleStoreName, tupleStoreConfiguration);
final TupleStoreConfiguration readConfig = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreName);
Assert.assertEquals(tupleStoreConfiguration, readConfig);
Assert.assertTrue(tupleStoreAdapter.isTableKnown(tupleStoreName));
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTablenameParser method testTablenameParserInvalid.
/**
* Test the parsing of invalid tablenames
*/
@Test(timeout = 60000)
public void testTablenameParserInvalid() {
final List<String> invalidNames = new ArrayList<>();
invalidNames.add("");
invalidNames.add(null);
invalidNames.add("abc");
invalidNames.add("abcd_abcd_abce");
invalidNames.add("__");
invalidNames.add("3__");
invalidNames.add("3_abc_");
invalidNames.add("3_abc_def_gef");
invalidNames.add("__def");
invalidNames.add("abc__def");
invalidNames.add("-0_df_def");
invalidNames.add("1-0_df_def");
invalidNames.add("-1_df_def");
invalidNames.add("0_df_def");
invalidNames.add("0_df_def_");
invalidNames.add("0_df_def_a");
invalidNames.add("0_df_def__");
invalidNames.add("_____");
invalidNames.add("1_2_");
for (final String invalidTablename : invalidNames) {
final TupleStoreName tablename = new TupleStoreName(invalidTablename);
Assert.assertFalse(tablename.isValid());
Assert.assertEquals(TupleStoreName.INVALID_GROUP, tablename.getDistributionGroup());
Assert.assertEquals(TupleStoreName.INVALID_TABLENAME, tablename.getTablename());
}
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TestTablenameParser method testTablenameParserValid.
/**
* Test the parsing of valid tablenames
*/
@Test(timeout = 60000)
public void testTablenameParserValid() {
final List<String> validNames = new ArrayList<String>();
validNames.add("abc_def");
validNames.add("34_34");
validNames.add("def_34");
validNames.add("def_table21");
validNames.add("12def_table21");
validNames.add("12def_table21_1");
validNames.add("12def_table21_4711");
for (final String validTablename : validNames) {
final TupleStoreName tablename = new TupleStoreName(validTablename);
Assert.assertTrue(tablename.isValid());
Assert.assertNotNull(tablename.getDistributionGroup());
Assert.assertNotNull(tablename.getTablename());
}
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class SSTableExaminer method main.
/**
* Main * Main * Main
*
* Examine a given SSTable and the coresponding index. The tuple with the key=examineKey
* will be search with fulltable scans and index scans. The result of this operations
* is printed onto the console.
*
* @param args
*/
public static void main(final String[] args) {
if (args.length != 4) {
logger.error("Usage: SSTableExaminer <Base directory> <Tablename> <Tablenumber> <Key>");
System.exit(-1);
}
final String baseDirectory = args[0];
final TupleStoreName relationname = new TupleStoreName(args[1]);
if (!relationname.isValid()) {
logger.error("Relationname {} is invalid, exiting", args[0]);
System.exit(-1);
}
try {
final int tableNumber = Integer.parseInt(args[2]);
final String examineKey = args[3];
final SSTableExaminer dumper = new SSTableExaminer(baseDirectory, relationname, tableNumber, examineKey);
dumper.run();
} catch (NumberFormatException e) {
logger.error("Unable to parse {} as tablenumber", args[2]);
System.exit(-1);
}
}
use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.
the class TupleStoreManagerRegistry method shutdownAndDeleteTablesForPredicate.
/**
* Shutdown and delete data for the given predicate
* @param deleteTablePredicate
* @throws StorageManagerException
*/
private void shutdownAndDeleteTablesForPredicate(final Predicate<TupleStoreName> deleteTablePredicate, final boolean synchronous) throws StorageManagerException {
// Create a copy of the key set to allow deletions (performed by shutdown) during iteration
final Set<TupleStoreName> copyOfInstances = new HashSet<>(managerInstances.keySet());
for (final TupleStoreName tupleStoreName : copyOfInstances) {
if (deleteTablePredicate.test(tupleStoreName)) {
shutdownSStable(tupleStoreName);
}
}
// Storage on disk
final List<TupleStoreName> allTables = getAllTables();
for (final TupleStoreName tupleStoreName : allTables) {
if (deleteTablePredicate.test(tupleStoreName)) {
deleteTable(tupleStoreName, synchronous);
}
}
}
Aggregations