use of org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member in project geode by apache.
the class PercentageMoveDirector method membershipChanged.
@Override
public void membershipChanged(PartitionedRegionLoadModel model) {
// We don't reset the total load to move after a membership change
this.model = model;
Member sourceMember = model.getMember(source);
if (sourceMember == null) {
throw new IllegalStateException(LocalizedStrings.PERCENTAGE_MOVE_DIRECTORY_SOURCE_NOT_DATA_STORE.toLocalizedString(model.getName(), source));
}
// Build the set of of buckets
orderedBuckets = new TreeSet<Bucket>(new LoadComparator());
for (Bucket bucket : sourceMember.getBuckets()) {
float bucketLoad = bucket.getLoad();
if (bucketLoad <= loadToMove) {
orderedBuckets.add(bucket);
}
}
}
use of org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member 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