Search in sources :

Example 11 with ZookeeperException

use of org.bboxdb.distribution.zookeeper.ZookeeperException in project bboxdb by jnidzwetzki.

the class AbstractSpacePartitioner method prepareMerge.

@Override
public void prepareMerge(final List<DistributionRegion> source, final DistributionRegion destination) throws BBoxDBException {
    try {
        logger.debug("Merging region: {}", destination.getIdentifier());
        distributionRegionZookeeperAdapter.setStateForDistributionRegion(destination, DistributionRegionState.REDISTRIBUTION_ACTIVE);
        for (final DistributionRegion childRegion : source) {
            final String zookeeperPathChild = distributionRegionZookeeperAdapter.getZookeeperPathForDistributionRegion(childRegion);
            distributionRegionZookeeperAdapter.setStateForDistributionGroup(zookeeperPathChild, DistributionRegionState.MERGING);
        }
    } catch (ZookeeperException e) {
        throw new BBoxDBException(e);
    }
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 12 with ZookeeperException

use of org.bboxdb.distribution.zookeeper.ZookeeperException in project bboxdb by jnidzwetzki.

the class AbstractTreeSpacePartitoner method mergeComplete.

@Override
public void mergeComplete(final List<DistributionRegion> source, final DistributionRegion destination) throws BBoxDBException {
    try {
        for (final DistributionRegion childRegion : source) {
            logger.info("Merge done deleting: {}", childRegion.getIdentifier());
            distributionRegionZookeeperAdapter.deleteChild(childRegion);
        }
        distributionRegionZookeeperAdapter.setStateForDistributionRegion(destination, DistributionRegionState.ACTIVE);
    } catch (ZookeeperException e) {
        throw new BBoxDBException(e);
    }
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 13 with ZookeeperException

use of org.bboxdb.distribution.zookeeper.ZookeeperException in project bboxdb by jnidzwetzki.

the class AbstractTreeSpacePartitoner method splitFailed.

@Override
public void splitFailed(final DistributionRegion sourceRegion, final List<DistributionRegion> destination) throws BBoxDBException {
    try {
        distributionRegionZookeeperAdapter.setStateForDistributionRegion(sourceRegion, DistributionRegionState.ACTIVE);
        for (final DistributionRegion childRegion : destination) {
            logger.info("Deleting child after failed split: {}", childRegion.getIdentifier());
            distributionRegionZookeeperAdapter.deleteChild(childRegion);
        }
    } catch (ZookeeperException e) {
        throw new BBoxDBException(e);
    }
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 14 with ZookeeperException

use of org.bboxdb.distribution.zookeeper.ZookeeperException in project bboxdb by jnidzwetzki.

the class DynamicgridSpacePartitioner method mergeComplete.

@Override
public void mergeComplete(final List<DistributionRegion> source, final DistributionRegion destination) throws BBoxDBException {
    try {
        for (final DistributionRegion childRegion : source) {
            logger.info("Merge done deleting: {}", childRegion.getIdentifier());
            distributionRegionZookeeperAdapter.deleteChild(childRegion);
        }
        distributionRegionZookeeperAdapter.setStateForDistributionRegion(destination, DistributionRegionState.ACTIVE);
    } catch (ZookeeperException e) {
        throw new BBoxDBException(e);
    }
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 15 with ZookeeperException

use of org.bboxdb.distribution.zookeeper.ZookeeperException in project bboxdb by jnidzwetzki.

the class KDtreeSpacePartitioner method splitRegion.

/**
 * Split the node at the given position
 * @param regionToSplit
 * @param splitPosition
 * @throws ZookeeperException
 * @throws ResourceAllocationException
 * @throws ZookeeperNotFoundException
 */
@Override
public List<DistributionRegion> splitRegion(final DistributionRegion regionToSplit, final Collection<BoundingBox> samples) throws BBoxDBException {
    try {
        final SplitpointStrategy splitpointStrategy = new SamplingBasedSplitStrategy(samples);
        final int splitDimension = getSplitDimension(regionToSplit);
        final BoundingBox regionBox = regionToSplit.getConveringBox();
        final double splitPosition = splitpointStrategy.getSplitPoint(splitDimension, regionBox);
        splitNode(regionToSplit, splitPosition);
        return regionToSplit.getDirectChildren();
    } catch (Exception e) {
        throw new BBoxDBException(e);
    }
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) SamplingBasedSplitStrategy(org.bboxdb.distribution.partitioner.regionsplit.SamplingBasedSplitStrategy) BBoxDBException(org.bboxdb.misc.BBoxDBException) ZookeeperNotFoundException(org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException) ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) ResourceAllocationException(org.bboxdb.distribution.placement.ResourceAllocationException) BBoxDBException(org.bboxdb.misc.BBoxDBException) SplitpointStrategy(org.bboxdb.distribution.partitioner.regionsplit.SplitpointStrategy)

Aggregations

ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)37 BBoxDBException (org.bboxdb.misc.BBoxDBException)24 BoundingBox (org.bboxdb.commons.math.BoundingBox)17 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)17 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)16 ZookeeperNotFoundException (org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException)13 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)13 DistributionGroupAdapter (org.bboxdb.distribution.zookeeper.DistributionGroupAdapter)11 DistributionRegionIdMapper (org.bboxdb.distribution.region.DistributionRegionIdMapper)10 ZookeeperClientFactory (org.bboxdb.distribution.zookeeper.ZookeeperClientFactory)10 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)9 DistributionRegionState (org.bboxdb.distribution.partitioner.DistributionRegionState)9 DistributionRegionCallback (org.bboxdb.distribution.region.DistributionRegionCallback)9 DistributionRegionAdapter (org.bboxdb.distribution.zookeeper.DistributionRegionAdapter)9 DistributionGroupConfigurationBuilder (org.bboxdb.storage.entity.DistributionGroupConfigurationBuilder)9 Assert (org.junit.Assert)9 Test (org.junit.Test)9 Set (java.util.Set)8 CountDownLatch (java.util.concurrent.CountDownLatch)8 SpacePartitionerContext (org.bboxdb.distribution.partitioner.SpacePartitionerContext)8