Search in sources :

Example 6 with ResourceAllocationException

use of org.bboxdb.distribution.placement.ResourceAllocationException in project bboxdb by jnidzwetzki.

the class QuadtreeSpacePartitioner method splitRegion.

@Override
public List<DistributionRegion> splitRegion(final DistributionRegion regionToSplit, final Collection<BoundingBox> samples) throws BBoxDBException {
    try {
        logger.info("Splitting region {}", regionToSplit.getIdentifier());
        final String parentPath = distributionRegionZookeeperAdapter.getZookeeperPathForDistributionRegion(regionToSplit);
        final BoundingBox box = regionToSplit.getConveringBox();
        final List<BoundingBox> childBoxes = createBoundingBoxes(box);
        final int numberOfChilden = childBoxes.size();
        for (int i = 0; i < numberOfChilden; i++) {
            final BoundingBox childBox = childBoxes.get(i);
            distributionRegionZookeeperAdapter.createNewChild(parentPath, i, childBox, distributionGroupName);
        }
        // Update state
        distributionRegionZookeeperAdapter.setStateForDistributionGroup(parentPath, DistributionRegionState.SPLITTING);
        waitUntilChildrenAreCreated(regionToSplit, numberOfChilden);
        allocateSystems(regionToSplit, numberOfChilden);
        setStateToRedistributionActiveAndWait(regionToSplit, numberOfChilden);
        return regionToSplit.getDirectChildren();
    } catch (ZookeeperException | ZookeeperNotFoundException | ResourceAllocationException e) {
        throw new BBoxDBException(e);
    }
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) ZookeeperNotFoundException(org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException) BoundingBox(org.bboxdb.commons.math.BoundingBox) ResourceAllocationException(org.bboxdb.distribution.placement.ResourceAllocationException) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Aggregations

ResourceAllocationException (org.bboxdb.distribution.placement.ResourceAllocationException)6 BoundingBox (org.bboxdb.commons.math.BoundingBox)4 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)4 ZookeeperNotFoundException (org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException)4 BBoxDBException (org.bboxdb.misc.BBoxDBException)4 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)3 SamplingBasedSplitStrategy (org.bboxdb.distribution.partitioner.regionsplit.SamplingBasedSplitStrategy)2 SplitpointStrategy (org.bboxdb.distribution.partitioner.regionsplit.SplitpointStrategy)2 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Predicate (java.util.function.Predicate)1 InputParseException (org.bboxdb.commons.InputParseException)1 MathUtil (org.bboxdb.commons.MathUtil)1 BBoxDBInstanceManager (org.bboxdb.distribution.membership.BBoxDBInstanceManager)1 ResourcePlacementStrategy (org.bboxdb.distribution.placement.ResourcePlacementStrategy)1 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)1