@GridToStringExclude public class GridClientPartitionTopology extends Object implements GridDhtPartitionTopology
| Constructor and Description |
|---|
GridClientPartitionTopology(GridCacheSharedContext<?,?> cctx,
DiscoCache discoCache,
int grpId,
int parts,
Object similarAffKey) |
public GridClientPartitionTopology(GridCacheSharedContext<?,?> cctx, DiscoCache discoCache, int grpId, int parts, Object similarAffKey)
cctx - Context.discoCache - Discovery data cache.grpId - Group ID.parts - Number of partitions in the group.similarAffKey - Key to find caches with similar affinity.public int partitions()
partitions in interface GridDhtPartitionTopology@Nullable public Object similarAffinityKey()
public int groupId()
groupId in interface GridDhtPartitionTopologypublic void readLock()
readLock in interface GridDhtPartitionTopologypublic void readUnlock()
GridDhtPartitionTopology.readLock() method.readUnlock in interface GridDhtPartitionTopologypublic void updateTopologyVersion(GridDhtTopologyFuture exchFut, DiscoCache discoCache, long updSeq, boolean stopping) throws IgniteInterruptedCheckedException
updateTopologyVersion in interface GridDhtPartitionTopologyexchFut - Exchange future.discoCache - Discovery data cache.updSeq - Update sequence.stopping - Stopping flag.IgniteInterruptedCheckedException - If interrupted.public AffinityTopologyVersion readyTopologyVersion()
readyTopologyVersion in interface GridDhtPartitionTopologypublic AffinityTopologyVersion lastTopologyChangeVersion()
lastTopologyChangeVersion in interface GridDhtPartitionTopologypublic GridDhtTopologyFuture topologyVersionFuture()
topologyVersionFuture in interface GridDhtPartitionTopologypublic boolean stopping()
stopping in interface GridDhtPartitionTopologyTrue if cache is being stopped.public boolean initPartitionsWhenAffinityReady(AffinityTopologyVersion affVer, GridDhtPartitionsExchangeFuture exchFut)
initPartitionsWhenAffinityReady in interface GridDhtPartitionTopologyaffVer - Affinity version.exchFut - Exchange future.True if partitions must be refreshed.public void beforeExchange(GridDhtPartitionsExchangeFuture exchFut, boolean initParts, boolean updateMoving) throws IgniteCheckedException
beforeExchange in interface GridDhtPartitionTopologyexchFut - Exchange future.initParts - Affinity ready flag.IgniteCheckedException - If failed.public void afterStateRestored(AffinityTopologyVersion topVer)
afterStateRestored in interface GridDhtPartitionTopologytopVer - Topology version.public boolean afterExchange(GridDhtPartitionsExchangeFuture exchFut) throws IgniteCheckedException
afterExchange in interface GridDhtPartitionTopologyexchFut - Exchange future.True if mapping was changed.IgniteCheckedException - If failed.@Nullable public GridDhtLocalPartition localPartition(int p, AffinityTopologyVersion topVer, boolean create) throws GridDhtInvalidPartitionException
localPartition in interface GridDhtPartitionTopologyp - Partition ID.topVer - Topology version at the time of creation.create - If true, then partition will be created if it's not there.GridDhtInvalidPartitionException - If partition is evicted or absent and
does not belong to this node.@Nullable public GridDhtLocalPartition localPartition(int p, AffinityTopologyVersion topVer, boolean create, boolean showRenting) throws GridDhtInvalidPartitionException
localPartition in interface GridDhtPartitionTopologyp - Partition ID.topVer - Topology version at the time of creation.create - If true, then partition will be created if it's not there.GridDhtInvalidPartitionException - If partition is evicted or absent and
does not belong to this node.public GridDhtLocalPartition forceCreatePartition(int p) throws IgniteCheckedException
forceCreatePartition in interface GridDhtPartitionTopologyp - Partition ID.IgniteCheckedException - If failed.public GridDhtLocalPartition localPartition(int p)
localPartition in interface GridDhtPartitionTopologyp - Partition number.public void releasePartitions(int... parts)
releasePartitions in interface GridDhtPartitionTopologyparts - Partitions to release (should be reserved before).public List<GridDhtLocalPartition> localPartitions()
localPartitions in interface GridDhtPartitionTopologypublic Collection<GridDhtLocalPartition> currentLocalPartitions()
currentLocalPartitions in interface GridDhtPartitionTopologypublic void onRemoved(GridDhtCacheEntry e)
onRemoved in interface GridDhtPartitionTopologye - Entry removed from cache.public GridDhtPartitionMap localPartitionMap()
localPartitionMap in interface GridDhtPartitionTopologypublic GridDhtPartitionState partitionState(UUID nodeId, int part)
partitionState in interface GridDhtPartitionTopologynodeId - Node ID.part - Partition.@Nullable public List<ClusterNode> nodes(int p, AffinityAssignment affAssignment, List<ClusterNode> affNodes)
nodes in interface GridDhtPartitionTopologyp - Partition ID.affAssignment - Assignments.affNodes - Node assigned for given partition by affinity.public List<ClusterNode> nodes(int p, AffinityTopologyVersion topVer)
nodes in interface GridDhtPartitionTopologyp - Partition ID.topVer - Topology version.public List<ClusterNode> owners(int p, AffinityTopologyVersion topVer)
owners in interface GridDhtPartitionTopologyp - Partition ID.topVer - Topology version.own this partition.public List<ClusterNode> owners(int p)
owners in interface GridDhtPartitionTopologyp - Partition ID.own this partition.public List<List<ClusterNode>> allOwners()
allOwners in interface GridDhtPartitionTopologypublic List<ClusterNode> moving(int p)
moving in interface GridDhtPartitionTopologyp - Partition ID.are preloading this partition.public long updateSequence()
updateSequence in interface GridDhtPartitionTopologypublic long lastUpdateSequence()
public GridDhtPartitionFullMap partitionMap(boolean onlyActive)
partitionMap in interface GridDhtPartitionTopologyonlyActive - If true, then only active partitions will be returned.public boolean update(@Nullable
AffinityTopologyVersion exchangeVer,
GridDhtPartitionFullMap partMap,
@Nullable
CachePartitionFullCountersMap cntrMap,
Set<Integer> partsToReload,
@Nullable
AffinityTopologyVersion msgTopVer)
update in interface GridDhtPartitionTopologyexchangeVer - Result topology version for exchange. Value should be greater than previously passed. Null value
means full map received is not related to exchangepartMap - Update partition map.cntrMap - Partition update counters.partsToReload - Set of partitions that need to be reloaded.msgTopVer - Topology version from incoming message. This value is not null only for case message is not
related to exchange. Value should be not less than previous 'Topology version from exchange'.True if local state was changed.public void collectUpdateCounters(CachePartitionPartialCountersMap cntrMap)
collectUpdateCounters in interface GridDhtPartitionTopologycntrMap - Counters map.public void applyUpdateCounters()
applyUpdateCounters in interface GridDhtPartitionTopologypublic boolean update(@Nullable
GridDhtPartitionExchangeId exchId,
GridDhtPartitionMap parts,
boolean force)
update in interface GridDhtPartitionTopologyexchId - Exchange ID.parts - Partitions.force - True to skip stale update check.True if local state was changed.public void onExchangeDone(GridDhtPartitionsExchangeFuture fut, AffinityAssignment assignment, boolean updateRebalanceVer)
onExchangeDone in interface GridDhtPartitionTopologyassignment - New affinity assignment.updateRebalanceVer - True if need check rebalance state.public boolean detectLostPartitions(AffinityTopologyVersion affVer, DiscoveryEvent discoEvt)
This method should be called on topology coordinator after all partition messages are received.
detectLostPartitions in interface GridDhtPartitionTopologyaffVer - Exchange result version.discoEvt - Discovery event for which we detect lost partitions.True if partitions state got updated.public void resetLostPartitions(AffinityTopologyVersion affVer)
resetLostPartitions in interface GridDhtPartitionTopologyaffVer - Exchange result version.public Collection<Integer> lostPartitions()
lostPartitions in interface GridDhtPartitionTopologypublic boolean own(GridDhtLocalPartition part)
own in interface GridDhtPartitionTopologypart - Partition to own.True if owned.public void ownMoving(AffinityTopologyVersion topVer)
ownMoving in interface GridDhtPartitionTopologytopVer - Topology version.public void onEvicted(GridDhtLocalPartition part, boolean updateSeq)
onEvicted in interface GridDhtPartitionTopologypart - Evicted partition.updateSeq - Update sequence increment flag.@Nullable public GridDhtPartitionMap partitions(UUID nodeId)
partitions in interface GridDhtPartitionTopologynodeId - Node to get partitions for.public Map<UUID,Set<Integer>> resetOwners(Map<Integer,Set<UUID>> ownersByUpdCounters, Set<Integer> haveHistory)
ownersByUpdCounters will be reset to MOVING.resetOwners in interface GridDhtPartitionTopologyownersByUpdCounters - Map (partition, set of node IDs that have most actual state about partition
(update counter is maximal) and should hold OWNING state for such partition).haveHistory - Set of partitions which have WAL history to rebalance.public CachePartitionFullCountersMap fullUpdateCounters()
fullUpdateCounters in interface GridDhtPartitionTopologypublic CachePartitionPartialCountersMap localUpdateCounters(boolean skipZeros)
localUpdateCounters in interface GridDhtPartitionTopologypublic Map<Integer,Long> partitionSizes()
partitionSizes in interface GridDhtPartitionTopologypublic boolean rebalanceFinished(AffinityTopologyVersion topVer)
rebalanceFinished in interface GridDhtPartitionTopologytopVer - Topology version.True if rebalance process finished.public boolean hasMovingPartitions()
hasMovingPartitions in interface GridDhtPartitionTopologyTrue If one of cache nodes has partitions in GridDhtPartitionState.MOVING state.public void printMemoryStats(int threshold)
printMemoryStats in interface GridDhtPartitionTopologythreshold - Threshold for number of entries.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.5.0 Release Date : May 23 2018