public interface AvailabilityStrategyContext
AvailabilityStrategy
to proceed with a rebalance, a membership update, or an availability mode change.
Implementations should not use blocking calls.Modifier and Type | Method and Description |
---|---|
ConsistentHash |
calculateConflictHash(ConsistentHash preferredHash,
Set<ConsistentHash> distinctHashes,
List<Address> actualMembers) |
AvailabilityMode |
getAvailabilityMode() |
String |
getCacheName() |
Map<Address,Float> |
getCapacityFactors() |
CacheTopology |
getCurrentTopology() |
List<Address> |
getExpectedMembers()
The members of the cache.
|
CacheJoinInfo |
getJoinInfo() |
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. |
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> newMembers)
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
|
void |
updateAvailabilityMode(List<Address> actualMembers,
AvailabilityMode mode,
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.
|
String getCacheName()
CacheJoinInfo getJoinInfo()
CacheTopology getCurrentTopology()
CacheTopology getStableTopology()
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.null
.AvailabilityMode getAvailabilityMode()
List<Address> getExpectedMembers()
CacheTopology
.
Does not include nodes which have left the cluster (either gracefully or abruptly) but are still in the
current topology.void queueRebalance(List<Address> newMembers)
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.void updateCurrentTopology(List<Address> newMembers)
ConsistentHashFactory
to create a new CH
with the given members
, but do not start a rebalance.
Members missing from the current topology are ignored.void updateAvailabilityMode(List<Address> actualMembers, AvailabilityMode mode, boolean cancelRebalance)
void updateTopologiesAfterMerge(CacheTopology currentTopology, CacheTopology stableTopology, AvailabilityMode availabilityMode)
boolean resolveConflictsOnMerge()
PartitionHandlingConfiguration.mergePolicy()
!= nullConsistentHash calculateConflictHash(ConsistentHash preferredHash, Set<ConsistentHash> distinctHashes, List<Address> actualMembers)
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 addressesvoid queueConflictResolution(CacheTopology conflictTopology, Set<Address> preferredNodes)
this#updateTopologiesAfterMerge(CacheTopology, CacheTopology, AvailabilityMode)
conflictTopology
- the topology to use during conflict resolutionpreferredNodes
- the addresses that belong to the preferred partition as determined by the AvailabilityStrategy
boolean restartConflictResolution(List<Address> newMembers)
newMembers
- the latest members of the current viewCopyright © 2021 JBoss by Red Hat. All rights reserved.