Search in sources :

Example 1 with TupleStoreManagerRegistry

use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.

the class SSTableServiceRunnable method executeSplit.

/**
 * Execute a region split
 *
 * @param sstableManager
 * @param spacePartitioner
 * @param regionToSplit
 * @throws StorageManagerException
 * @throws BBoxDBException
 * @throws InterruptedException
 */
private void executeSplit(final TupleStoreManager sstableManager, final SpacePartitioner spacePartitioner, final DistributionRegion regionToSplit) throws Exception {
    final TupleStoreManagerRegistry tupleStoreManagerRegistry = storage.getTupleStoreManagerRegistry();
    final RegionSplitter regionSplitter = new RegionSplitter(tupleStoreManagerRegistry);
    forceMajorCompact(sstableManager);
    regionSplitter.splitRegion(regionToSplit, spacePartitioner, tupleStoreManagerRegistry);
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) RegionSplitter(org.bboxdb.distribution.partitioner.regionsplit.RegionSplitter)

Example 2 with TupleStoreManagerRegistry

use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.

the class SSTableServiceRunnable method execute.

/**
 * Execute a new compaction
 * @throws InterruptedException
 */
public synchronized void execute() throws InterruptedException {
    final TupleStoreManagerRegistry storageRegistry = storage.getTupleStoreManagerRegistry();
    final String location = storage.getBasedir().getAbsolutePath();
    final List<TupleStoreName> tupleStores = storageRegistry.getTupleStoresForLocation(location);
    processTupleStores(storageRegistry, tupleStores);
    processRegionMerges();
    processScheduldedDeletions();
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName)

Example 3 with TupleStoreManagerRegistry

use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.

the class SSTableServiceRunnable method openFacades.

/**
 * Open the facades
 *
 * @param newTableWriter
 * @param newFacades
 * @throws StorageManagerException
 */
private void openFacades(final List<SSTableWriter> newTableWriter, final List<SSTableFacade> newFacades) throws StorageManagerException {
    for (final SSTableWriter writer : newTableWriter) {
        final TupleStoreManagerRegistry tupleStoreManagerRegistry = storage.getTupleStoreManagerRegistry();
        final BBoxDBConfiguration configuration = tupleStoreManagerRegistry.getConfiguration();
        final int sstableKeyCacheEntries = configuration.getSstableKeyCacheEntries();
        final SSTableFacade newFacade = new SSTableFacade(writer.getDirectory(), writer.getName(), writer.getTablenumber(), sstableKeyCacheEntries);
        newFacades.add(newFacade);
    }
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) BBoxDBConfiguration(org.bboxdb.misc.BBoxDBConfiguration) SSTableWriter(org.bboxdb.storage.sstable.SSTableWriter) SSTableFacade(org.bboxdb.storage.sstable.reader.SSTableFacade)

Example 4 with TupleStoreManagerRegistry

use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.

the class SSTableCheckpointRunnable method runThread.

/**
 * Execute the checkpoint thread
 */
protected void runThread() {
    final TupleStoreManagerRegistry storageRegistry = storage.getTupleStoreManagerRegistry();
    try {
        while (!Thread.currentThread().isInterrupted()) {
            if (Const.LOG_MEMORY_STATISTICS) {
                logger.info(SystemInfo.getMemoryStatisticsString());
            }
            final List<TupleStoreName> allTables = storageRegistry.getTupleStoresForLocation(storage.getBasedir().getAbsolutePath());
            for (final TupleStoreName ssTableName : allTables) {
                logger.info("Executing checkpoint check for: {}", ssTableName);
                if (Thread.currentThread().isInterrupted()) {
                    return;
                }
                createCheckpointIfNeeded(storageRegistry, ssTableName);
            }
            waitForNextRun();
        }
    } catch (Exception e) {
        if (!Thread.interrupted()) {
            logger.error("Got exception while executing thread", e);
        }
    }
}
Also used : TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) StorageManagerException(org.bboxdb.storage.StorageManagerException)

Example 5 with TupleStoreManagerRegistry

use of org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry in project bboxdb by jnidzwetzki.

the class ContinuousBoundingBoxClientQuery method init.

/**
 * Init the query
 * @param tupleStoreManagerRegistry
 * @throws BBoxDBException
 */
protected void init() throws BBoxDBException {
    try {
        final TupleStoreManagerRegistry storageRegistry = clientConnectionHandler.getStorageRegistry();
        final String fullname = requestTable.getDistributionGroup();
        final SpacePartitioner spacePartitioner = SpacePartitionerCache.getInstance().getSpacePartitionerForGroupName(fullname);
        final DistributionRegionIdMapper regionIdMapper = spacePartitioner.getDistributionRegionIdMapper();
        final List<TupleStoreName> localTables = regionIdMapper.getLocalTablesForRegion(boundingBox, requestTable);
        if (localTables.size() != 1) {
            logger.error("Got more than one table for the continuous query {}", localTables);
            close();
            return;
        }
        final TupleStoreName tupleStoreName = localTables.get(0);
        storageManager = QueryHelper.getTupleStoreManager(storageRegistry, tupleStoreName);
        storageManager.registerInsertCallback(tupleInsertCallback);
        // Remove tuple store insert listener on connection close
        clientConnectionHandler.addConnectionClosedHandler((c) -> close());
    } catch (StorageManagerException | ZookeeperException e) {
        logger.error("Got an exception during query init", e);
        close();
    }
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) TupleStoreManagerRegistry(org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) StorageManagerException(org.bboxdb.storage.StorageManagerException) DistributionRegionIdMapper(org.bboxdb.distribution.region.DistributionRegionIdMapper) SpacePartitioner(org.bboxdb.distribution.partitioner.SpacePartitioner)

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