public class ClusterCacheStatus extends Object implements AvailabilityStrategyContext
Modifier and Type | Field and Description |
---|---|
static int |
INITIAL_REBALANCE_ID |
static int |
INITIAL_TOPOLOGY_ID |
Constructor and Description |
---|
ClusterCacheStatus(EmbeddedCacheManager cacheManager,
String cacheName,
AvailabilityStrategy availabilityStrategy,
RebalanceType rebalanceType,
ClusterTopologyManagerImpl clusterTopologyManager,
Transport transport,
PersistentUUIDManager persistentUUIDManager,
EventLogManager eventLogManager,
Optional<ScopedPersistentState> state,
boolean resolveConflictsOnMerge) |
Modifier and Type | Method and Description |
---|---|
ConsistentHash |
calculateConflictHash(ConsistentHash preferredHash,
Set<ConsistentHash> distinctHashes,
List<Address> actualMembers) |
void |
confirmRebalancePhase(Address member,
int receivedTopologyId) |
protected CacheTopology |
createInitialCacheTopology() |
void |
doHandleClusterView(int viewId) |
CacheStatusResponse |
doJoin(Address joiner,
CacheJoinInfo joinInfo) |
CompletionStage<Void> |
doLeave(Address leaver) |
void |
doMergePartitions(Map<Address,CacheStatusResponse> statusResponses) |
CompletionStage<Void> |
forceAvailabilityMode(AvailabilityMode newAvailabilityMode) |
void |
forceRebalance() |
AvailabilityMode |
getAvailabilityMode() |
String |
getCacheName() |
Map<Address,Float> |
getCapacityFactors() |
CacheTopology |
getCurrentTopology() |
List<Address> |
getExpectedMembers()
The members of the cache.
|
CacheJoinInfo |
getJoinInfo() |
RebalancingStatus |
getRebalancingStatus() |
CacheTopology |
getStableTopology()
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. |
boolean |
isRebalanceEnabled() |
boolean |
isRebalanceInProgress() |
void |
queueConflictResolution(CacheTopology conflictTopology,
Set<Address> preferredNodes)
Initiates conflict resolution using the conflictTopology, which should have already been broadcast via
this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode) |
void |
queueRebalance(List<Address> newMembers)
Queue (or start) a rebalance.
|
boolean |
resolveConflictsOnMerge() |
boolean |
restartConflictResolution(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 topology
|
protected CacheTopology |
restoreCacheTopology(ScopedPersistentState state) |
void |
setInitialTopologyId(int initialTopologyId) |
CompletionStage<Void> |
setRebalanceEnabled(boolean enabled) |
CompletionStage<Void> |
shutdownCache() |
void |
startQueuedRebalance() |
String |
toString() |
void |
updateAvailabilityMode(List<Address> actualMembers,
AvailabilityMode newAvailabilityMode,
boolean cancelRebalance)
Enter a new availability mode.
|
void |
updateCurrentTopology(List<Address> newMembers)
Use the configured
ConsistentHashFactory to create a new CH
with the given members , but do not start a rebalance. |
void |
updateTopologiesAfterMerge(CacheTopology currentTopology,
CacheTopology stableTopology,
AvailabilityMode availabilityMode)
Updates both the stable and the current topologies.
|
public static final int INITIAL_TOPOLOGY_ID
public static final int INITIAL_REBALANCE_ID
public ClusterCacheStatus(EmbeddedCacheManager cacheManager, String cacheName, AvailabilityStrategy availabilityStrategy, RebalanceType rebalanceType, ClusterTopologyManagerImpl clusterTopologyManager, Transport transport, PersistentUUIDManager persistentUUIDManager, EventLogManager eventLogManager, Optional<ScopedPersistentState> state, boolean resolveConflictsOnMerge)
public CacheJoinInfo getJoinInfo()
getJoinInfo
in interface AvailabilityStrategyContext
public List<Address> getExpectedMembers()
AvailabilityStrategyContext
CacheTopology
.
Does not include nodes which have left the cluster (either gracefully or abruptly) but are still in the
current topology.getExpectedMembers
in interface AvailabilityStrategyContext
public void queueRebalance(List<Address> newMembers)
AvailabilityStrategyContext
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.queueRebalance
in interface AvailabilityStrategyContext
public Map<Address,Float> getCapacityFactors()
getCapacityFactors
in interface AvailabilityStrategyContext
public CacheTopology getCurrentTopology()
getCurrentTopology
in interface AvailabilityStrategyContext
public CacheTopology getStableTopology()
AvailabilityStrategyContext
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.getStableTopology
in interface AvailabilityStrategyContext
null
.public AvailabilityMode getAvailabilityMode()
getAvailabilityMode
in interface AvailabilityStrategyContext
public void updateAvailabilityMode(List<Address> actualMembers, AvailabilityMode newAvailabilityMode, boolean cancelRebalance)
AvailabilityStrategyContext
updateAvailabilityMode
in interface AvailabilityStrategyContext
public void updateTopologiesAfterMerge(CacheTopology currentTopology, CacheTopology stableTopology, AvailabilityMode availabilityMode)
AvailabilityStrategyContext
updateTopologiesAfterMerge
in interface AvailabilityStrategyContext
public boolean isRebalanceInProgress()
public RebalancingStatus getRebalancingStatus()
public void confirmRebalancePhase(Address member, int receivedTopologyId) throws Exception
Exception
public void doHandleClusterView(int viewId)
public void updateCurrentTopology(List<Address> newMembers)
AvailabilityStrategyContext
ConsistentHashFactory
to create a new CH
with the given members
, but do not start a rebalance.
Members missing from the current topology are ignored.updateCurrentTopology
in interface AvailabilityStrategyContext
public void doMergePartitions(Map<Address,CacheStatusResponse> statusResponses)
public String getCacheName()
getCacheName
in interface AvailabilityStrategyContext
public CacheStatusResponse doJoin(Address joiner, CacheJoinInfo joinInfo)
protected CacheTopology restoreCacheTopology(ScopedPersistentState state)
protected CacheTopology createInitialCacheTopology()
public CompletionStage<Void> doLeave(Address leaver) throws Exception
Exception
public void startQueuedRebalance()
public boolean isRebalanceEnabled()
public CompletionStage<Void> setRebalanceEnabled(boolean enabled)
public void forceRebalance()
public CompletionStage<Void> forceAvailabilityMode(AvailabilityMode newAvailabilityMode)
public CompletionStage<Void> shutdownCache() throws Exception
Exception
public void setInitialTopologyId(int initialTopologyId)
public boolean resolveConflictsOnMerge()
resolveConflictsOnMerge
in interface AvailabilityStrategyContext
PartitionHandlingConfiguration.mergePolicy()
!= nullpublic ConsistentHash calculateConflictHash(ConsistentHash preferredHash, Set<ConsistentHash> distinctHashes, List<Address> actualMembers)
calculateConflictHash
in interface AvailabilityStrategyContext
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 addressespublic void queueConflictResolution(CacheTopology conflictTopology, Set<Address> preferredNodes)
AvailabilityStrategyContext
this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)
queueConflictResolution
in interface AvailabilityStrategyContext
conflictTopology
- the topology to use during conflict resolutionpreferredNodes
- the addresses that belong to the preferred partition as determined by the AvailabilityStrategy
public boolean restartConflictResolution(List<Address> members)
AvailabilityStrategyContext
restartConflictResolution
in interface AvailabilityStrategyContext
members
- the latest members of the current viewCopyright © 2021 JBoss by Red Hat. All rights reserved.