public class GridAffinityAssignmentCache extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DFLT_AFFINITY_HISTORY_SIZE |
static float |
DFLT_PART_DISTRIBUTION_WARN_THRESHOLD |
public static final int DFLT_AFFINITY_HISTORY_SIZE
public static final float DFLT_PART_DISTRIBUTION_WARN_THRESHOLD
public static GridAffinityAssignmentCache create(GridKernalContext ctx, AffinityFunction aff, CacheConfiguration<?,?> ccfg)
ctx - Kernal context.aff - Initialized affinity function.ccfg - Cache configuration.public Object similarAffinityKey()
public String cacheOrGroupName()
public int groupId()
public void initialize(AffinityTopologyVersion topVer, List<List<ClusterNode>> affAssignment)
topVer - Topology version.affAssignment - Affinity assignment for topology version.public void idealAssignment(AffinityTopologyVersion topVer, List<List<ClusterNode>> assignment)
assignment - Assignment.@Nullable public @Nullable List<List<ClusterNode>> idealAssignmentRaw()
@Nullable public @Nullable IdealAffinityAssignment idealAssignment()
public boolean centralizedAffinityFunction()
True if affinity function has AffinityCentralizedFunction annotation.public void cancelFutures(IgniteCheckedException err)
err - Error.public void onReconnected()
public IdealAffinityAssignment calculate(AffinityTopologyVersion topVer, @Nullable @Nullable ExchangeDiscoveryEvents events, @Nullable @Nullable DiscoCache discoCache)
topVer - Topology version to calculate affinity cache for.events - Discovery events that caused this topology version change.discoCache - Discovery cache.public void clientEventTopologyChange(DiscoveryEvent evt, AffinityTopologyVersion topVer)
evt - Event.topVer - Topology version.public AffinityTopologyVersion lastVersion()
public AffinityAssignment lastReadyAffinity()
public List<List<ClusterNode>> assignments(AffinityTopologyVersion topVer)
topVer - Topology version.public List<List<ClusterNode>> readyAssignments(AffinityTopologyVersion topVer)
topVer - Topology version.@Nullable public @Nullable IgniteInternalFuture<AffinityTopologyVersion> readyFuture(AffinityTopologyVersion topVer)
topVer is calculated.topVer - Topology version to await for.topVer is calculated.public int partitions()
public List<ClusterNode> nodes(int part, AffinityTopologyVersion topVer)
part - Partition.topVer - Topology version.public Set<Integer> partitionPrimariesDifferentToIdeal(AffinityTopologyVersion topVer)
topVer - Topology version.public Set<Integer> primaryPartitions(UUID nodeId, AffinityTopologyVersion topVer)
nodeId - Node ID to get primary partitions for.topVer - Topology version.public Set<Integer> backupPartitions(UUID nodeId, AffinityTopologyVersion topVer)
nodeId - Node ID to get backup partitions for.topVer - Topology version.public boolean dumpDebugInfo()
True if there are pending futures.public AffinityAssignment readyAffinity(AffinityTopologyVersion topVer)
topVer - Topology version.IllegalStateException - If affinity assignment is not initialized for the given topology version.public AffinityAssignment cachedAffinity(AffinityTopologyVersion topVer)
topVer - Topology version.IllegalArgumentException - in case of the specified topology version topVer
is earlier than affinity is calculated
or the history of assignments is already cleaned.public AffinityAssignment cachedAffinity(AffinityTopologyVersion topVer, AffinityTopologyVersion lastAffChangeTopVer)
topVer - Topology version for which affinity assignment is requested.lastAffChangeTopVer - Topology version of last affinity assignment change.IllegalArgumentException - in case of the specified topology version topVer
is earlier than affinity is calculated
or the history of assignments is already cleaned.public boolean primaryChanged(int part,
AffinityTopologyVersion startVer,
AffinityTopologyVersion endVer)
part - Partition.startVer - Start version.endVer - End version.True if primary changed or required affinity version not found in history.public void init(GridAffinityAssignmentCache aff)
aff - Affinity cache.public NavigableSet<AffinityTopologyVersion> cachedVersions()
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.15.0 Release Date : April 25 2023