Search in sources :

Example 1 with BucketRollup

use of org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup in project geode by apache.

the class RemoveOverRedundancy method removeOverRedundancy.

/**
   * Remove copies of buckets that have more than the expected number of redundant copies.
   */
private boolean removeOverRedundancy() {
    Move bestMove = null;
    BucketRollup first = null;
    while (bestMove == null) {
        if (model.getOverRedundancyBuckets().isEmpty()) {
            return false;
        }
        first = model.getOverRedundancyBuckets().first();
        bestMove = model.findBestRemove(first);
        if (bestMove == null) {
            if (logger.isDebugEnabled()) {
                logger.debug("Skipping overredundancy bucket {} because couldn't find a member to remove from?", first);
            }
            model.ignoreOverRedundancyBucket(first);
        }
    }
    Member targetMember = bestMove.getTarget();
    model.remoteOverRedundancyBucket(first, targetMember);
    return true;
}
Also used : Move(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Move) BucketRollup(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup) Member(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member)

Example 2 with BucketRollup

use of org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup in project geode by apache.

the class SatisfyRedundancy method satisfyRedundancy.

/**
   * Try to satisfy redundancy for a single bucket.
   * 
   * @return true if we actually created a bucket somewhere.
   */
private boolean satisfyRedundancy() {
    Move bestMove = null;
    BucketRollup first = null;
    while (bestMove == null) {
        if (model.getLowRedundancyBuckets().isEmpty()) {
            return false;
        }
        first = model.getLowRedundancyBuckets().first();
        bestMove = model.findBestTarget(first, true);
        if (bestMove == null && !model.enforceUniqueZones()) {
            bestMove = model.findBestTarget(first, false);
        }
        if (bestMove == null) {
            if (logger.isDebugEnabled()) {
                logger.debug("Skipping low redundancy bucket {} because no member will accept it", first);
            }
            model.ignoreLowRedundancyBucket(first);
        }
    }
    model.createRedundantBucket(first, bestMove.getTarget());
    return true;
}
Also used : Move(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Move) BucketRollup(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup)

Example 3 with BucketRollup

use of org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup in project geode by apache.

the class SatisfyRedundancyFPR method createFPRBucketsForThisNode.

public void createFPRBucketsForThisNode() {
    final Map<BucketRollup, Move> moves = new HashMap<BucketRollup, Move>();
    for (BucketRollup bucket : model.getLowRedundancyBuckets()) {
        Move move = model.findBestTargetForFPR(bucket, true);
        if (move == null && !model.enforceUniqueZones()) {
            move = model.findBestTargetForFPR(bucket, false);
        }
        if (move != null) {
            moves.put(bucket, move);
        } else {
            if (logger.isDebugEnabled()) {
                logger.debug("Skipping low redundancy bucket {} because no member will accept it", bucket);
            }
        }
    }
    // are different, there will not be any contention for lock
    for (Map.Entry<BucketRollup, Move> bucketMove : moves.entrySet()) {
        BucketRollup bucket = bucketMove.getKey();
        Move move = bucketMove.getValue();
        Member targetMember = move.getTarget();
        model.createRedundantBucket(bucket, targetMember);
    }
    model.waitForOperations();
}
Also used : HashMap(java.util.HashMap) Move(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Move) BucketRollup(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup) Map(java.util.Map) HashMap(java.util.HashMap) Member(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member)

Aggregations

BucketRollup (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup)3 Move (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Move)3 Member (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1