@GridToStringExclude public class GridClientPartitionTopology extends Object implements GridDhtPartitionTopology
Constructor and Description |
---|
GridClientPartitionTopology(GridCacheSharedContext cctx,
int cacheId,
GridDhtPartitionsExchangeFuture exchFut,
Object similarAffKey) |
public GridClientPartitionTopology(GridCacheSharedContext cctx, int cacheId, GridDhtPartitionsExchangeFuture exchFut, Object similarAffKey)
cctx
- Context.cacheId
- Cache ID.exchFut
- Exchange ID.similarAffKey
- Key to find caches with similar affinity.@Nullable public Object similarAffinityKey()
public int cacheId()
cacheId
in interface GridDhtPartitionTopology
public void readLock()
readLock
in interface GridDhtPartitionTopology
public void readUnlock()
GridDhtPartitionTopology.readLock()
method.readUnlock
in interface GridDhtPartitionTopology
public void updateTopologyVersion(GridDhtPartitionExchangeId exchId, GridDhtPartitionsExchangeFuture exchFut, long updSeq, boolean stopping) throws IgniteInterruptedCheckedException
updateTopologyVersion
in interface GridDhtPartitionTopology
exchId
- Exchange ID.exchFut
- Exchange future.updSeq
- Update sequence.stopping
- Stopping flag.IgniteInterruptedCheckedException
- If interrupted.public AffinityTopologyVersion topologyVersion()
topologyVersion
in interface GridDhtPartitionTopology
public GridDhtTopologyFuture topologyVersionFuture()
topologyVersionFuture
in interface GridDhtPartitionTopology
public boolean stopping()
stopping
in interface GridDhtPartitionTopology
True
if cache is being stopped.public void initPartitions(GridDhtPartitionsExchangeFuture exchFut)
initPartitions
in interface GridDhtPartitionTopology
exchFut
- Exchange future.public void beforeExchange(GridDhtPartitionsExchangeFuture exchFut, boolean initParts) throws IgniteCheckedException
beforeExchange
in interface GridDhtPartitionTopology
exchFut
- Exchange future.initParts
- Affinity ready flag.IgniteCheckedException
- If failed.public boolean afterExchange(GridDhtPartitionsExchangeFuture exchFut) throws IgniteCheckedException
afterExchange
in interface GridDhtPartitionTopology
exchFut
- 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 GridDhtPartitionTopology
p
- 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 localPartition(Object key, boolean create)
localPartition
in interface GridDhtPartitionTopology
key
- Cache key.create
- If true
, then partition will be created if it's not there.public void releasePartitions(int... parts)
releasePartitions
in interface GridDhtPartitionTopology
parts
- Partitions to release (should be reserved before).public List<GridDhtLocalPartition> localPartitions()
localPartitions
in interface GridDhtPartitionTopology
public Collection<GridDhtLocalPartition> currentLocalPartitions()
currentLocalPartitions
in interface GridDhtPartitionTopology
public void onRemoved(GridDhtCacheEntry e)
onRemoved
in interface GridDhtPartitionTopology
e
- Entry removed from cache.public GridDhtPartitionMap localPartitionMap()
localPartitionMap
in interface GridDhtPartitionTopology
public GridDhtPartitionState partitionState(UUID nodeId, int part)
partitionState
in interface GridDhtPartitionTopology
nodeId
- Node ID.part
- Partition.@Nullable public List<ClusterNode> nodes(int p, AffinityAssignment affAssignment, List<ClusterNode> affNodes)
nodes
in interface GridDhtPartitionTopology
p
- Partition ID.affAssignment
- Assignments.affNodes
- Node assigned for given partition by affinity.public List<ClusterNode> nodes(int p, AffinityTopologyVersion topVer)
nodes
in interface GridDhtPartitionTopology
p
- Partition ID.topVer
- Topology version.public List<ClusterNode> owners(int p, AffinityTopologyVersion topVer)
owners
in interface GridDhtPartitionTopology
p
- Partition ID.topVer
- Topology version.own
this partition.public List<ClusterNode> owners(int p)
owners
in interface GridDhtPartitionTopology
p
- Partition ID.own
this partition.public List<ClusterNode> moving(int p)
moving
in interface GridDhtPartitionTopology
p
- Partition ID.are preloading
this partition.public long updateSequence()
updateSequence
in interface GridDhtPartitionTopology
public long lastUpdateSequence()
public GridDhtPartitionFullMap partitionMap(boolean onlyActive)
partitionMap
in interface GridDhtPartitionTopology
onlyActive
- If true
, then only active
partitions will be returned.@Nullable public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId, GridDhtPartitionFullMap partMap, Map<Integer,T2<Long,Long>> cntrMap)
update
in interface GridDhtPartitionTopology
exchId
- Exchange ID.partMap
- Update partition map.cntrMap
- Partition update counters.null
otherwise.@Nullable public GridDhtPartitionMap update(@Nullable GridDhtPartitionExchangeId exchId, GridDhtPartitionMap parts, Map<Integer,T2<Long,Long>> cntrMap)
update
in interface GridDhtPartitionTopology
exchId
- Exchange ID.parts
- Partitions.cntrMap
- Partition update counters.null
otherwise.public boolean detectLostPartitions(DiscoveryEvent discoEvt)
This method should be called on topology coordinator after all partition messages are received.
detectLostPartitions
in interface GridDhtPartitionTopology
discoEvt
- Discovery event for which we detect lost partitions.True
if partitons state got updated.public void resetLostPartitions()
resetLostPartitions
in interface GridDhtPartitionTopology
public Collection<Integer> lostPartitions()
lostPartitions
in interface GridDhtPartitionTopology
public void checkEvictions()
checkEvictions
in interface GridDhtPartitionTopology
public boolean own(GridDhtLocalPartition part)
own
in interface GridDhtPartitionTopology
part
- Partition to own.True
if owned.public void onEvicted(GridDhtLocalPartition part, boolean updateSeq)
onEvicted
in interface GridDhtPartitionTopology
part
- Evicted partition.updateSeq
- Update sequence increment flag.@Nullable public GridDhtPartitionMap partitions(UUID nodeId)
partitions
in interface GridDhtPartitionTopology
nodeId
- Node to get partitions for.public void setOwners(int p, Set<UUID> owners, boolean updateSeq)
setOwners
in interface GridDhtPartitionTopology
p
- Partition ID.owners
- Set of new owners.updateSeq
- If should increment sequence when updated.public Map<Integer,T2<Long,Long>> updateCounters(boolean skipZeros)
updateCounters
in interface GridDhtPartitionTopology
skipZeros
- If true
then filters out zero counters.public boolean rebalanceFinished(AffinityTopologyVersion topVer)
rebalanceFinished
in interface GridDhtPartitionTopology
topVer
- Topology version.True
if rebalance process finished.public boolean hasMovingPartitions()
hasMovingPartitions
in interface GridDhtPartitionTopology
True
If one of cache nodes has partitions in GridDhtPartitionState.MOVING
state.public void printMemoryStats(int threshold)
printMemoryStats
in interface GridDhtPartitionTopology
threshold
- Threshold for number of entries.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017