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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations