Package org.infinispan.topology
Class ClusterCacheStatus
java.lang.Object
org.infinispan.topology.ClusterCacheStatus
- All Implemented Interfaces:
AvailabilityStrategyContext
Keeps track of a cache's status: members, current/pending consistent hashes, and rebalance status
- Since:
- 5.2
- Author:
- Dan Berindei
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionClusterCacheStatus(EmbeddedCacheManager cacheManager, GlobalComponentRegistry gcr, String cacheName, AvailabilityStrategy availabilityStrategy, org.infinispan.statetransfer.RebalanceType rebalanceType, ClusterTopologyManagerImpl clusterTopologyManager, Transport transport, PersistentUUIDManager persistentUUIDManager, org.infinispan.util.logging.events.EventLogManager eventLogManager, Optional<ScopedPersistentState> state, boolean resolveConflictsOnMerge) -
Method Summary
Modifier and TypeMethodDescriptioncalculateConflictHash(ConsistentHash preferredHash, Set<ConsistentHash> distinctHashes, List<Address> actualMembers) voidconfirmRebalancePhase(Address member, int receivedTopologyId) protected CacheTopologyvoiddoHandleClusterView(int viewId) doJoin(Address joiner, CacheJoinInfo joinInfo) voiddoMergePartitions(Map<Address, CacheStatusResponse> statusResponses) forceAvailabilityMode(AvailabilityMode newAvailabilityMode) voidThe members of the cache.Whenever a new cache topology without apendingCHand with at leastnumOwnersowners for each segment is installed, and the cache isAvailabilityMode.AVAILABLE, the current cache topology is marked as the stable topology.booleanbooleanbooleanvoidmanuallyUpdateAvailabilityMode(List<Address> actualMembers, AvailabilityMode mode, boolean cancelRebalance) Enter a new availability mode manually.voidqueueConflictResolution(CacheTopology conflictTopology, Set<Address> preferredNodes) Initiates conflict resolution using the conflictTopology, which should have already been broadcast via {@link this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)}voidqueueRebalance(List<Address> newMembers) Queue (or start) a rebalance.booleanbooleanrestartConflictResolution(List<Address> members) 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 topologyprotected CacheTopologybooleansetCurrentTopologyAsStable(boolean force) voidsetInitialTopologyId(int initialTopologyId) setRebalanceEnabled(boolean enabled) voidtoString()voidupdateAvailabilityMode(List<Address> actualMembers, AvailabilityMode newAvailabilityMode, boolean cancelRebalance) Enter a new availability mode.voidupdateCurrentTopology(List<Address> newMembers) Use the configuredConsistentHashFactoryto create a new CH with the givenmembers, but do not start a rebalance.voidupdateTopologiesAfterMerge(CacheTopology currentTopology, CacheTopology stableTopology, AvailabilityMode availabilityMode) Updates both the stable and the current topologies.
-
Field Details
-
INITIAL_TOPOLOGY_ID
public static final int INITIAL_TOPOLOGY_ID- See Also:
-
INITIAL_REBALANCE_ID
public static final int INITIAL_REBALANCE_ID- See Also:
-
-
Constructor Details
-
ClusterCacheStatus
public ClusterCacheStatus(EmbeddedCacheManager cacheManager, GlobalComponentRegistry gcr, String cacheName, AvailabilityStrategy availabilityStrategy, org.infinispan.statetransfer.RebalanceType rebalanceType, ClusterTopologyManagerImpl clusterTopologyManager, Transport transport, PersistentUUIDManager persistentUUIDManager, org.infinispan.util.logging.events.EventLogManager eventLogManager, Optional<ScopedPersistentState> state, boolean resolveConflictsOnMerge)
-
-
Method Details
-
getJoinInfo
- Specified by:
getJoinInfoin interfaceAvailabilityStrategyContext
-
getExpectedMembers
Description copied from interface:AvailabilityStrategyContextThe members of the cache. Includes nodes which have tried to join the cache but are not yet part of the currentCacheTopology. Does not include nodes which have left the cluster (either gracefully or abruptly) but are still in the current topology.- Specified by:
getExpectedMembersin interfaceAvailabilityStrategyContext
-
queueRebalance
Description copied from interface:AvailabilityStrategyContextQueue (or start) a rebalance. Use the configuredConsistentHashFactoryto 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. IfnewConsistentHash == null, remove any queued rebalance.- Specified by:
queueRebalancein interfaceAvailabilityStrategyContext
-
getCapacityFactors
- Specified by:
getCapacityFactorsin interfaceAvailabilityStrategyContext
-
getCurrentTopology
- Specified by:
getCurrentTopologyin interfaceAvailabilityStrategyContext- Returns:
- The current cache topology.
-
getStableTopology
Description copied from interface:AvailabilityStrategyContextWhenever a new cache topology without apendingCHand with at leastnumOwnersowners for each segment is installed, and the cache isAvailabilityMode.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:
getStableTopologyin interfaceAvailabilityStrategyContext- Returns:
- The last stable cache topology. May be
null.
-
getAvailabilityMode
- Specified by:
getAvailabilityModein interfaceAvailabilityStrategyContext- Returns:
- The current availability mode.
-
updateAvailabilityMode
public void updateAvailabilityMode(List<Address> actualMembers, AvailabilityMode newAvailabilityMode, boolean cancelRebalance) Description copied from interface:AvailabilityStrategyContextEnter a new availability mode.- Specified by:
updateAvailabilityModein interfaceAvailabilityStrategyContext
-
manuallyUpdateAvailabilityMode
public void manuallyUpdateAvailabilityMode(List<Address> actualMembers, AvailabilityMode mode, boolean cancelRebalance) Description copied from interface:AvailabilityStrategyContextEnter a new availability mode manually.- Specified by:
manuallyUpdateAvailabilityModein interfaceAvailabilityStrategyContext
-
isManuallyDegraded
public boolean isManuallyDegraded()- Specified by:
isManuallyDegradedin interfaceAvailabilityStrategyContext- Returns:
- true if manually set to
AvailabilityMode.DEGRADED_MODE, and false, otherwise.
-
updateTopologiesAfterMerge
public void updateTopologiesAfterMerge(CacheTopology currentTopology, CacheTopology stableTopology, AvailabilityMode availabilityMode) Description copied from interface:AvailabilityStrategyContextUpdates both the stable and the current topologies. Does not install the current topology on the cache members.- Specified by:
updateTopologiesAfterMergein interfaceAvailabilityStrategyContext
-
isRebalanceInProgress
public boolean isRebalanceInProgress() -
getRebalancingStatus
-
confirmRebalancePhase
- Throws:
Exception
-
doHandleClusterView
public void doHandleClusterView(int viewId) -
updateCurrentTopology
Description copied from interface:AvailabilityStrategyContextUse the configuredConsistentHashFactoryto create a new CH with the givenmembers, but do not start a rebalance. Members missing from the current topology are ignored.- Specified by:
updateCurrentTopologyin interfaceAvailabilityStrategyContext
-
toString
-
doMergePartitions
-
getCacheName
- Specified by:
getCacheNamein interfaceAvailabilityStrategyContext
-
doJoin
-
restoreCacheTopology
-
setCurrentTopologyAsStable
public boolean setCurrentTopologyAsStable(boolean force) -
createInitialCacheTopology
-
doLeave
- Throws:
Exception
-
startQueuedRebalance
public void startQueuedRebalance() -
isRebalanceEnabled
public boolean isRebalanceEnabled() -
setRebalanceEnabled
-
forceRebalance
public void forceRebalance() -
forceAvailabilityMode
-
shutdownCache
-
setInitialTopologyId
public void setInitialTopologyId(int initialTopologyId) -
resolveConflictsOnMerge
public boolean resolveConflictsOnMerge()- Specified by:
resolveConflictsOnMergein interfaceAvailabilityStrategyContext- Returns:
- true if
PartitionHandlingConfiguration.mergePolicy()!= null
-
calculateConflictHash
public ConsistentHash calculateConflictHash(ConsistentHash preferredHash, Set<ConsistentHash> distinctHashes, List<Address> actualMembers) - Specified by:
calculateConflictHashin interfaceAvailabilityStrategyContext- Parameters:
preferredHash- the base consistent hashdistinctHashes- a set of all hashes to be utilised as part of the conflict resolution hashactualMembers- a set of all valid addresses- Returns:
- the hash to be utilised as a pending CH during Phase.CONFLICT_RESOLUTION
-
queueConflictResolution
Description copied from interface:AvailabilityStrategyContextInitiates conflict resolution using the conflictTopology, which should have already been broadcast via {@link this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)}- Specified by:
queueConflictResolutionin interfaceAvailabilityStrategyContext- Parameters:
conflictTopology- the topology to use during conflict resolutionpreferredNodes- the addresses that belong to the preferred partition as determined by theAvailabilityStrategy
-
restartConflictResolution
Description copied from interface:AvailabilityStrategyContextIf 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:
restartConflictResolutionin interfaceAvailabilityStrategyContext- Parameters:
members- the latest members of the current view- Returns:
- true if conflict resolution was restarted due to the newMembers
-