Class ClusterCacheStatus

  • All Implemented Interfaces:
    org.infinispan.partitionhandling.impl.AvailabilityStrategyContext

    public class ClusterCacheStatus
    extends Object
    implements org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
    Keeps track of a cache's status: members, current/pending consistent hashes, and rebalance status
    Since:
    5.2
    Author:
    Dan Berindei
    • Method Detail

      • getJoinInfo

        public CacheJoinInfo getJoinInfo()
        Specified by:
        getJoinInfo in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • getExpectedMembers

        public List<Address> getExpectedMembers()
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        The members of the cache. Includes nodes which have tried to join the cache but are not yet part of the current CacheTopology. Does not include nodes which have left the cluster (either gracefully or abruptly) but are still in the current topology.
        Specified by:
        getExpectedMembers in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • queueRebalance

        public void queueRebalance​(List<Address> newMembers)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Queue (or start) a rebalance. Use the configured ConsistentHashFactory to create a new balanced consistent hash with the given members. If there is no rebalance in progress, start a rebalance right away. If there is a rebalance in progress, queue another rebalance. If there is a rebalance in the queue as well, it will be replaced with the new one. If newConsistentHash == null, remove any queued rebalance.
        Specified by:
        queueRebalance in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • isTotalOrder

        public boolean isTotalOrder()
      • isDistributed

        public boolean isDistributed()
      • getCapacityFactors

        public Map<Address,​Float> getCapacityFactors()
        Specified by:
        getCapacityFactors in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • getCurrentTopology

        public CacheTopology getCurrentTopology()
        Specified by:
        getCurrentTopology in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Returns:
        The current cache topology.
      • getStableTopology

        public CacheTopology getStableTopology()
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Whenever a new cache topology without a pendingCH and with at least numOwners owners for each segment is installed, and the cache is AvailabilityMode.AVAILABLE, the current cache topology is marked as the stable topology. The same happens when a rebalance is scheduled to start, but it doesn't do anything because the current topology is already balanced.
        Specified by:
        getStableTopology in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Returns:
        The last stable cache topology. May be null.
      • getAvailabilityMode

        public AvailabilityMode getAvailabilityMode()
        Specified by:
        getAvailabilityMode in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Returns:
        The current availability mode.
      • updateAvailabilityMode

        public void updateAvailabilityMode​(List<Address> actualMembers,
                                           AvailabilityMode newAvailabilityMode,
                                           boolean cancelRebalance)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Enter a new availability mode.
        Specified by:
        updateAvailabilityMode in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • updateTopologiesAfterMerge

        public void updateTopologiesAfterMerge​(CacheTopology currentTopology,
                                               CacheTopology stableTopology,
                                               AvailabilityMode availabilityMode)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Updates both the stable and the current topologies. Does not install the current topology on the cache members.
        Specified by:
        updateTopologiesAfterMerge in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • isRebalanceInProgress

        public boolean isRebalanceInProgress()
      • confirmRebalancePhase

        public void confirmRebalancePhase​(Address member,
                                          int receivedTopologyId)
                                   throws Exception
        Throws:
        Exception
      • doHandleClusterView

        public void doHandleClusterView​(int viewId)
      • updateCurrentTopology

        public void updateCurrentTopology​(List<Address> newMembers)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Use the configured ConsistentHashFactory to create a new CH with the given members, but do not start a rebalance. Members missing from the current topology are ignored.
        Specified by:
        updateCurrentTopology in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • getCacheName

        public String getCacheName()
        Specified by:
        getCacheName in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
      • createInitialCacheTopology

        protected CacheTopology createInitialCacheTopology()
      • startQueuedRebalance

        public void startQueuedRebalance()
      • isRebalanceEnabled

        public boolean isRebalanceEnabled()
      • setRebalanceEnabled

        public void setRebalanceEnabled​(boolean enabled)
      • forceRebalance

        public void forceRebalance()
      • forceAvailabilityMode

        public void forceAvailabilityMode​(AvailabilityMode newAvailabilityMode)
      • setInitialTopologyId

        public void setInitialTopologyId​(int initialTopologyId)
      • resolveConflictsOnMerge

        public boolean resolveConflictsOnMerge()
        Specified by:
        resolveConflictsOnMerge in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Returns:
        true if PartitionHandlingConfiguration.mergePolicy() != null
      • calculateConflictHash

        public ConsistentHash calculateConflictHash​(ConsistentHash preferredHash,
                                                    Set<ConsistentHash> distinctHashes,
                                                    List<Address> actualMembers)
        Specified by:
        calculateConflictHash in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Parameters:
        preferredHash - the base consistent hash
        distinctHashes - a set of all hashes to be utilised as part of the conflict resolution hash
        actualMembers - a set of all valid addresses
        Returns:
        the hash to be utilised as a pending CH during Phase.CONFLICT_RESOLUTION
      • queueConflictResolution

        public void queueConflictResolution​(CacheTopology conflictTopology,
                                            Set<Address> preferredNodes)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Initiates conflict resolution using the conflictTopology, which should have already been broadcast via {@link this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)}
        Specified by:
        queueConflictResolution in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Parameters:
        conflictTopology - the topology to use during conflict resolution
        preferredNodes - the addresses that belong to the preferred partition as determined by the AvailabilityStrategy
      • restartConflictResolution

        public boolean restartConflictResolution​(List<Address> members)
        Description copied from interface: org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        If CR is in progress, then this method cancels the current CR and starts a new CR phase with an updated topology based upon newMembers and the previously queued CR topology
        Specified by:
        restartConflictResolution in interface org.infinispan.partitionhandling.impl.AvailabilityStrategyContext
        Parameters:
        members - the latest members of the current view
        Returns:
        true if conflict resolution was restarted due to the newMembers