use of org.bboxdb.storage.tuplestore.manager.TupleStoreManager in project bboxdb by jnidzwetzki.
the class LocalSelftest method main.
public static void main(final String[] args) throws InterruptedException, ExecutionException, BBoxDBException, StorageManagerException, RejectedException {
if (args.length != 1) {
logger.error("Usage: LocalSelftest <Iterations>");
System.exit(-1);
}
try {
final int iterations = Integer.parseInt(args[0]);
logger.info("Running selftest......");
final TupleStoreManagerRegistry storageRegistry = new TupleStoreManagerRegistry();
storageRegistry.init();
final TupleStoreName sstable = new TupleStoreName(TABLENAME);
final TupleStoreManager storageManager = storageRegistry.getTupleStoreManager(sstable);
for (int iteration = 0; iteration < iterations; iteration++) {
logger.info("Running iteration {}", iteration);
storageRegistry.deleteTable(sstable, true);
testInsertDelete(storageManager);
}
storageRegistry.shutdown();
logger.info("Selftest done");
} catch (NumberFormatException e) {
logger.error("Unable to parse {} as a number, exiting", args[0]);
System.exit(-1);
}
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManager in project bboxdb by jnidzwetzki.
the class RegionMerger method startFlushToDisk.
/**
* Start the to disk flushing
* @param ssTableName
* @throws StorageManagerException
*/
private void startFlushToDisk(final TupleStoreName ssTableName) throws StorageManagerException {
final TupleStoreManager ssTableManager = registry.getTupleStoreManager(ssTableName);
ssTableManager.init();
ssTableManager.setToReadWrite();
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManager in project bboxdb by jnidzwetzki.
the class RegionSplitter method distributeData.
/**
* Redistribute the given sstable
* @param ssTableName
* @param source
* @param destination
* @throws StorageManagerException
*/
private void distributeData(final TupleStoreName ssTableName, final DistributionRegion source, final List<DistributionRegion> destination) throws BBoxDBException, StorageManagerException {
logger.info("Redistributing table {}", ssTableName.getFullname());
final TupleStoreManager ssTableManager = registry.getTupleStoreManager(ssTableName);
// Spread data
final TupleRedistributor tupleRedistributor = getTupleRedistributor(source, destination, ssTableName);
spreadTupleStores(ssTableManager, tupleRedistributor);
logger.info("Redistributing table {} is DONE", ssTableName.getFullname());
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManager in project bboxdb by jnidzwetzki.
the class TupleRedistributor method registerRegion.
/**
* Register a new region for distribution
* @param distributionRegion
* @throws StorageManagerException
* @throws ZookeeperException
*/
public void registerRegion(final DistributionRegion distributionRegion) throws StorageManagerException {
final ArrayList<AbstractTupleSink> sinks = new ArrayList<>();
final Collection<BBoxDBInstance> instances = distributionRegion.getSystems();
final MembershipConnectionService membershipConnectionService = MembershipConnectionService.getInstance();
final BBoxDBInstance localInstance = ZookeeperClientFactory.getLocalInstanceName();
for (final BBoxDBInstance instance : instances) {
if (instance.socketAddressEquals(localInstance)) {
final TupleStoreName localTableName = tupleStoreName.cloneWithDifferntRegionId(distributionRegion.getRegionId());
final TupleStoreAdapter tupleStoreAdapter = ZookeeperClientFactory.getZookeeperClient().getTupleStoreAdapter();
final TupleStoreConfiguration config = readTuplestoreConfig(localTableName, tupleStoreAdapter);
final TupleStoreManager storageManager = tupleStoreManagerRegistry.createTableIfNotExist(localTableName, config);
final LocalTupleSink tupleSink = new LocalTupleSink(tupleStoreName, storageManager);
sinks.add(tupleSink);
logger.info("Redistributing data to local table {}", localTableName.getFullname());
} else {
final BBoxDBConnection connection = membershipConnectionService.getConnectionForInstance(instance);
final NetworkTupleSink tupleSink = new NetworkTupleSink(tupleStoreName, connection);
sinks.add(tupleSink);
logger.info("Redistributing data to remote system {}", instance.getInetSocketAddress());
}
}
registerRegion(distributionRegion, sinks);
}
use of org.bboxdb.storage.tuplestore.manager.TupleStoreManager in project bboxdb by jnidzwetzki.
the class SSTableServiceRunnable method processTupleStores.
/**
* Process the tuple stores
*
* @param storageRegistry
* @param tupleStores
* @throws InterruptedException
*/
private void processTupleStores(final TupleStoreManagerRegistry storageRegistry, final List<TupleStoreName> tupleStores) throws InterruptedException {
for (final TupleStoreName tupleStoreName : tupleStores) {
try {
logger.debug("Running compact for: {}", tupleStoreName);
final TupleStoreManager tupleStoreManager = storageRegistry.getTupleStoreManager(tupleStoreName);
if (tupleStoreManager.getSstableManagerState() == TupleStoreManagerState.READ_ONLY) {
logger.debug("Skipping compact for read only sstable manager: {}", tupleStoreName);
continue;
}
if (!CompactorHelper.isRegionActive(tupleStoreName)) {
logger.info("Skipping compact run, because region is not active {}", tupleStoreName);
continue;
}
final List<SSTableFacade> facades = getAllTupleStores(tupleStoreManager);
final MergeTask mergeTask = mergeStrategy.getMergeTask(facades);
executeCompactTask(mergeTask, tupleStoreManager);
testForRegionOverflow(tupleStoreManager);
} catch (StorageManagerException | BBoxDBException e) {
logger.error("Error while merging tables", e);
}
}
}
Aggregations