Search in sources :

Example 6 with TupleStoreManagerRegistry

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;
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) ErrorResponse(org.bboxdb.network.packages.response.ErrorResponse)

Example 7 with TupleStoreManagerRegistry

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;
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) ArrayList(java.util.ArrayList) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) StorageManagerException(org.bboxdb.storage.StorageManagerException) TupleStoreManager(org.bboxdb.storage.tuplestore.manager.TupleStoreManager)

Example 8 with TupleStoreManagerRegistry

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();
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) BeforeClass(org.junit.BeforeClass)

Example 9 with TupleStoreManagerRegistry

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);
}
Also used : ZookeeperClient(org.bboxdb.distribution.zookeeper.ZookeeperClient) DistributionGroupAdapter(org.bboxdb.distribution.zookeeper.DistributionGroupAdapter) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration) BeforeClass(org.junit.BeforeClass)

Example 10 with TupleStoreManagerRegistry

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();
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) BeforeClass(org.junit.BeforeClass)

Aggregations

TupleStoreManagerRegistry (org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry)21 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)10 BeforeClass (org.junit.BeforeClass)5 StorageManagerException (org.bboxdb.storage.StorageManagerException)4 ArrayList (java.util.ArrayList)3 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)3 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)3 SpacePartitioner (org.bboxdb.distribution.partitioner.SpacePartitioner)2 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)2 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)2 BBoxDBException (org.bboxdb.misc.BBoxDBException)2 Tuple (org.bboxdb.storage.entity.Tuple)2 File (java.io.File)1 List (java.util.List)1 DistributedRecoveryService (org.bboxdb.distribution.DistributedRecoveryService)1 TupleStoreFlushZookeeperAdapter (org.bboxdb.distribution.TupleStoreFlushZookeeperAdapter)1 MembershipConnectionService (org.bboxdb.distribution.membership.MembershipConnectionService)1 KDtreeSpacePartitioner (org.bboxdb.distribution.partitioner.KDtreeSpacePartitioner)1 RegionMerger (org.bboxdb.distribution.partitioner.regionsplit.RegionMerger)1 RegionSplitter (org.bboxdb.distribution.partitioner.regionsplit.RegionSplitter)1