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