Search in sources :

Example 6 with Member

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);
        }
    }
}
Also used : Bucket(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Bucket) Member(org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) DistributedMember(org.apache.geode.distributed.DistributedMember)

Example 7 with Member

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

Member (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Member)7 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)5 Move (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Move)5 DistributedMember (org.apache.geode.distributed.DistributedMember)4 Bucket (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.Bucket)4 BucketRollup (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.BucketRollup)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Set (java.util.Set)1 FixedPartitionAttributesImpl (org.apache.geode.internal.cache.FixedPartitionAttributesImpl)1 PartitionedRegion (org.apache.geode.internal.cache.PartitionedRegion)1 RefusalReason (org.apache.geode.internal.cache.partitioned.rebalance.PartitionedRegionLoadModel.RefusalReason)1