Search in sources :

Example 21 with BBoxDBException

use of org.bboxdb.misc.BBoxDBException 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 22 with BBoxDBException

use of org.bboxdb.misc.BBoxDBException in project bboxdb by jnidzwetzki.

the class DynamicgridSpacePartitioner method getDestinationForMerge.

@Override
public DistributionRegion getDestinationForMerge(final List<DistributionRegion> source) throws BBoxDBException {
    try {
        assert (source.size() == 2) : "We can only merge 2 regions";
        final BoundingBox bbox = BoundingBox.getCoveringBox(source.get(0).getConveringBox(), source.get(1).getConveringBox());
        final DistributionRegion parent = source.get(0).getParent();
        final String parentPath = distributionRegionZookeeperAdapter.getZookeeperPathForDistributionRegion(parent);
        final int childNumber = (int) parent.getHighestChildNumber();
        final String childPath = distributionRegionZookeeperAdapter.createNewChild(parentPath, childNumber, bbox, distributionGroupName);
        SpacePartitionerHelper.allocateSystemsToRegion(childPath, distributionGroupName, new ArrayList<>(), zookeeperClient);
        distributionRegionZookeeperAdapter.setStateForDistributionGroup(childPath, DistributionRegionState.ACTIVE);
        return distributionRegionZookeeperAdapter.getNodeForPath(source.get(0).getRootRegion(), childPath);
    } catch (Exception e) {
        throw new BBoxDBException(e);
    }
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BoundingBox(org.bboxdb.commons.math.BoundingBox) BBoxDBException(org.bboxdb.misc.BBoxDBException) ZookeeperNotFoundException(org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException) ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) InputParseException(org.bboxdb.commons.InputParseException) ResourceAllocationException(org.bboxdb.distribution.placement.ResourceAllocationException) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 23 with BBoxDBException

use of org.bboxdb.misc.BBoxDBException in project bboxdb by jnidzwetzki.

the class DynamicgridSpacePartitioner method splitComplete.

@Override
public void splitComplete(final DistributionRegion sourceRegion, final List<DistributionRegion> destination) throws BBoxDBException {
    try {
        logger.info("Split done deleting: {}", sourceRegion.getIdentifier());
        distributionRegionZookeeperAdapter.deleteChild(sourceRegion);
        // Children are ready
        for (final DistributionRegion childRegion : destination) {
            distributionRegionZookeeperAdapter.setStateForDistributionRegion(childRegion, DistributionRegionState.ACTIVE);
        }
    } catch (Exception e) {
        throw new BBoxDBException(e);
    }
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) BBoxDBException(org.bboxdb.misc.BBoxDBException) ZookeeperNotFoundException(org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException) ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) InputParseException(org.bboxdb.commons.InputParseException) ResourceAllocationException(org.bboxdb.distribution.placement.ResourceAllocationException) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 24 with BBoxDBException

use of org.bboxdb.misc.BBoxDBException 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 25 with BBoxDBException

use of org.bboxdb.misc.BBoxDBException 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

BBoxDBException (org.bboxdb.misc.BBoxDBException)64 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)24 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)22 BoundingBox (org.bboxdb.commons.math.BoundingBox)17 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)14 SpacePartitioner (org.bboxdb.distribution.partitioner.SpacePartitioner)13 ArrayList (java.util.ArrayList)12 ZookeeperNotFoundException (org.bboxdb.distribution.zookeeper.ZookeeperNotFoundException)12 StorageManagerException (org.bboxdb.storage.StorageManagerException)12 List (java.util.List)11 TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)11 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)10 Tuple (org.bboxdb.storage.entity.Tuple)9 ResourceAllocationException (org.bboxdb.distribution.placement.ResourceAllocationException)7 RoutingHop (org.bboxdb.network.routing.RoutingHop)7 JoinedTupleListFuture (org.bboxdb.network.client.future.JoinedTupleListFuture)6 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)6 RejectedException (org.bboxdb.commons.RejectedException)5 DistributionRegionIdMapper (org.bboxdb.distribution.region.DistributionRegionIdMapper)5 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)5