Search in sources :

Example 41 with DistributionGroupConfiguration

use of org.bboxdb.storage.entity.DistributionGroupConfiguration in project bboxdb by jnidzwetzki.

the class DataRedistributionLoader method initBBoxDB.

/**
 * Re-Create the distribution group and the table
 */
private void initBBoxDB() {
    try {
        // Delete old distribution group
        System.out.println("Delete old distribution group");
        final EmptyResultFuture dgroupDeleteResult = bboxDBCluster.deleteDistributionGroup(DGROUP);
        dgroupDeleteResult.waitForAll();
        if (dgroupDeleteResult.isFailed()) {
            System.err.println(dgroupDeleteResult.getAllMessages());
            System.exit(-1);
        }
        // Create new distribution group
        System.out.println("Create new distribution group");
        final DistributionGroupConfiguration dgroupConfig = DistributionGroupConfigurationBuilder.create(2).withReplicationFactor((short) 1).withMaximumRegionSize(16).withMinimumRegionSize(4).build();
        final EmptyResultFuture dgroupCreateResult = bboxDBCluster.createDistributionGroup(DGROUP, dgroupConfig);
        dgroupCreateResult.waitForAll();
        if (dgroupCreateResult.isFailed()) {
            System.err.println(dgroupCreateResult.getAllMessages());
            System.exit(-1);
        }
        // Create new table
        System.out.println("Create new table");
        final TupleStoreConfiguration storeConfiguration = TupleStoreConfigurationBuilder.create().allowDuplicates(false).build();
        final EmptyResultFuture tableCreateResult = bboxDBCluster.createTable(TABLE, storeConfiguration);
        tableCreateResult.waitForAll();
        if (tableCreateResult.isFailed()) {
            System.err.println(tableCreateResult.getAllMessages());
            System.exit(-1);
        }
    } catch (Exception e) {
        System.err.println("Got an exception while prepating BBoxDB");
        e.printStackTrace();
        System.exit(-1);
    }
}
Also used : TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration) IOException(java.io.IOException) BBoxDBException(org.bboxdb.misc.BBoxDBException) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture)

Example 42 with DistributionGroupConfiguration

use of org.bboxdb.storage.entity.DistributionGroupConfiguration in project bboxdb by jnidzwetzki.

the class RegionSplitHelper method getConfiguredRegionMaxSize.

/**
 * Get maximal size of a region
 * @return
 * @throws ZookeeperNotFoundException
 * @throws ZookeeperException
 */
private static long getConfiguredRegionMaxSize(final DistributionRegion region) throws ZookeeperException, ZookeeperNotFoundException {
    final String fullname = region.getDistributionGroupName();
    final DistributionGroupConfiguration config = DistributionGroupConfigurationCache.getInstance().getDistributionGroupConfiguration(fullname);
    return config.getMaximumRegionSize();
}
Also used : DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration)

Example 43 with DistributionGroupConfiguration

use of org.bboxdb.storage.entity.DistributionGroupConfiguration in project bboxdb by jnidzwetzki.

the class KDtreeSpacePartitioner method getDimension.

/**
 * Get the dimension of the distribution region
 * @return
 */
private int getDimension() {
    try {
        final DistributionGroupConfigurationCache instance = DistributionGroupConfigurationCache.getInstance();
        final DistributionGroupConfiguration config = instance.getDistributionGroupConfiguration(distributionGroupName);
        return config.getDimensions();
    } catch (ZookeeperNotFoundException e) {
        throw new RuntimeException(e);
    }
}
Also used : DistributionGroupConfigurationCache(org.bboxdb.distribution.DistributionGroupConfigurationCache) ZookeeperNotFoundException(org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException) DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration)

Aggregations

DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)43 Test (org.junit.Test)12 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)9 Before (org.junit.Before)7 ZookeeperNotFoundException (org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException)4 BeforeClass (org.junit.BeforeClass)4 BoundingBox (org.bboxdb.commons.math.BoundingBox)3 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)3 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)3 BBoxDBException (org.bboxdb.misc.BBoxDBException)3 Tuple (org.bboxdb.storage.entity.Tuple)3 DistributionGroupAdapter (org.bboxdb.distribution.zookeeper.DistributionGroupAdapter)2 ZookeeperClient (org.bboxdb.distribution.zookeeper.ZookeeperClient)2 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)2 Cursor (java.awt.Cursor)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 HashSet (java.util.HashSet)1 Random (java.util.Random)1 InputParseException (org.bboxdb.commons.InputParseException)1