use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.
the class QueryHelper method handleNonExstingTable.
/**
* Handle a non existing table
* @param requestTable
* @param clientConnectionHandler
* @return
* @throws PackageEncodeException
* @throws IOException
*/
public static boolean handleNonExstingTable(final TupleStoreName requestTable, final short packageSequence, final ClientConnectionHandler clientConnectionHandler) throws IOException, PackageEncodeException {
// Table is locally known, prevent expensive zookeeper call
final TupleStoreManagerRegistry storageRegistry = clientConnectionHandler.getStorageRegistry();
if (storageRegistry.isStorageManagerKnown(requestTable)) {
return true;
}
final TupleStoreAdapter tupleStoreAdapter = ZookeeperClientFactory.getZookeeperClient().getTupleStoreAdapter();
try {
final boolean tableKnown = tupleStoreAdapter.isTableKnown(requestTable);
if (!tableKnown) {
clientConnectionHandler.writeResultPackage(new ErrorResponse(packageSequence, ErrorMessages.ERROR_TABLE_NOT_EXIST));
return false;
}
} catch (ZookeeperException e) {
logger.error("Got an exception while query for table", e);
return false;
}
return true;
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.
the class StreamClientQuery method setupNewIterator.
/**
* Setup a new iterator with the next local table
*/
protected boolean setupNewIterator() {
if (activeOperatorIterator != null && !activeOperatorIterator.hasNext()) {
logger.warn("setupNewIterator() called, but old iterator is not exhaustet. Ignoring call");
return false;
}
if (getNumberOfTablesToProcess() == 0) {
logger.warn("setupNewIterator() called, but localTables are empty");
return false;
}
try {
final List<TupleStoreManager> storageManagers = new ArrayList<>();
final TupleStoreManagerRegistry storageRegistry = clientConnectionHandler.getStorageRegistry();
for (final TupleStoreName tupleStoreName : requestTables) {
final TupleStoreName sstableName = localTables.get(tupleStoreName).remove(0);
final TupleStoreManager storageManager = QueryHelper.getTupleStoreManager(storageRegistry, sstableName);
storageManagers.add(storageManager);
}
activeOperator = operatorTreeBuilder.buildOperatorTree(storageManagers);
activeOperatorIterator = activeOperator.iterator();
return true;
} catch (StorageManagerException | ZookeeperException e) {
logger.warn("Got exception while fetching tuples", e);
}
return false;
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.
the class TestStorageManager method beforeClass.
@BeforeClass
public static void beforeClass() throws InterruptedException, BBoxDBException {
storageRegistry = new TupleStoreManagerRegistry();
storageRegistry.init();
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.
the class TestStorageRegistry method beforeClass.
@BeforeClass
public static void beforeClass() throws InterruptedException, BBoxDBException, ZookeeperException {
storageRegistry = new TupleStoreManagerRegistry();
storageRegistry.init();
final ZookeeperClient zookeeperClient = ZookeeperClientFactory.getZookeeperClient();
final DistributionGroupAdapter adapter = new DistributionGroupAdapter(zookeeperClient);
final DistributionGroupConfiguration configuration = DistributionGroupConfigurationBuilder.create(2).withPlacementStrategy("org.bboxdb.distribution.placement.DummyResourcePlacementStrategy", "").build();
adapter.createDistributionGroup(RELATION_NAME.getDistributionGroup(), configuration);
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.
the class TestTableCompactor method beforeClass.
@BeforeClass
public static void beforeClass() throws InterruptedException, BBoxDBException {
storageRegistry = new TupleStoreManagerRegistry();
storageRegistry.init();
}
Aggregations