public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapter implements Comparable<GridDhtPartitionsExchangeFuture>, CachePartitionExchangeWorkerTask, IgniteDiagnosticAware
Modifier and Type | Class and Description |
---|---|
static class |
GridDhtPartitionsExchangeFuture.ExchangeType |
GridDhtTopologyFutureAdapter.CacheGroupValidation
Modifier and Type | Field and Description |
---|---|
static int |
DFLT_LONG_OPERATIONS_DUMP_TIMEOUT_LIMIT |
static int |
DFLT_PARTITION_RELEASE_FUTURE_DUMP_THRESHOLD |
static String |
EXCHANGE_LATCH_ID |
static String |
EXCHANGE_LOG |
static String |
PARTITION_STATE_FAILED_MSG
Partition state failed message.
|
clusterIsActive, grpValidRes
Constructor and Description |
---|
GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx,
ReadWriteLock busyLock,
GridDhtPartitionExchangeId exchId,
ExchangeActions exchActions,
CacheAffinityChangeMessage affChangeMsg) |
Modifier and Type | Method and Description |
---|---|
boolean |
activateCluster() |
void |
addClearingPartition(CacheGroupContext grp,
int part)
Marks a partition for clearing before rebalance.
|
void |
addDiagnosticRequest(IgniteDiagnosticPrepareContext diagCtx) |
boolean |
addOrMergeDelayedFullMessage(ClusterNode node,
GridDhtPartitionsFullMessage fullMsg)
Add or merge updates received from coordinator while exchange in progress.
|
void |
affinityChangeMessage(CacheAffinityChangeMessage affChangeMsg)
Sets affinity change message associated with the exchange.
|
boolean |
affinityReassign() |
boolean |
cacheAddedOnExchange(int cacheId,
UUID rcvdFrom) |
boolean |
cacheGroupAddedOnExchange(int grpId,
UUID rcvdFrom) |
boolean |
changedAffinity() |
boolean |
changedBaseline() |
void |
cleanUp()
Cleans up resources to avoid excessive memory usage.
|
int |
compareTo(GridDhtPartitionsExchangeFuture fut) |
ExchangeContext |
context() |
long |
currentPMEDuration(boolean blocked) |
boolean |
dynamicCacheGroupStarted(int grpId) |
boolean |
equals(Object o) |
ExchangeDiscoveryEvents |
events() |
@Nullable ExchangeActions |
exchangeActions()
Gets exchanges actions (such as cache start or stop) associated with the exchange future.
|
void |
exchangeActions(ExchangeActions exchActions)
Sets exchange actions associated with the exchange future (such as cache start or stop).
|
boolean |
exchangeDone()
Ready affinity future (
GridCachePartitionExchangeManager.affinityReadyFuture(AffinityTopologyVersion)
is completed before GridFutureAdapter.onDone(Object, Throwable) is called on
GridDhtPartitionsExchangeFuture , it is guaranteed that this method will return true
if affinity ready future is finished. |
GridDhtPartitionExchangeId |
exchangeId() |
@Nullable GridDhtPartitionsExchangeFuture.ExchangeType |
exchangeType() |
boolean |
fastReplyOnSingleMessage(ClusterNode node,
GridDhtPartitionsSingleMessage msg)
Tries to fast reply with
GridDhtPartitionsFullMessage on received single message in case of exchange
future has already completed. |
void |
finishMerged(AffinityTopologyVersion resVer,
GridDhtPartitionsExchangeFuture exchFut)
Finish merged future to allow GridCachePartitionExchangeManager.ExchangeFutureSet cleanup.
|
DiscoveryEvent |
firstEvent() |
DiscoCache |
firstEventCache() |
void |
forceClientReconnect(ClusterNode node,
GridDhtPartitionsSingleMessage msg)
Method is called on coordinator in situation when initial ExchangeFuture created on client join event was
preempted from exchange history because of IGNITE_EXCHANGE_HISTORY_SIZE property.
|
boolean |
hasCachesToStart() |
int |
hashCode() |
boolean |
hasInapplicableNodesForFullRebalance() |
boolean |
hasInapplicableNodesForHistoricalRebalance() |
boolean |
hasInapplicableNodesForRebalance() |
void |
init(boolean newCrd)
Starts activity.
|
AffinityTopologyVersion |
initialVersion()
Gets the affinity topology version for which this exchange was created.
|
boolean |
isBaselineNodeFailed() |
boolean |
isClearingPartition(CacheGroupContext grp,
int part) |
boolean |
isMerged() |
boolean |
isNodeApplicableForFullRebalance(UUID nodeId,
int grpId,
int p) |
boolean |
localJoinExchange() |
void |
markAffinityReassign()
Marks this future as affinity reassign.
|
void |
markNodeAsInapplicableForFullRebalance(UUID nodeId,
int grpId,
int p)
Marks the given node as not applicable for full rebalancing
for the given group and partition.
|
void |
markNodeAsInapplicableForHistoricalRebalance(UUID nodeId)
Marks the given node as not applicable for historical rebalancing.
|
boolean |
mergeJoinExchange(GridDhtPartitionsExchangeFuture fut)
Merges this exchange with given one.
|
@Nullable GridDhtPartitionsSingleMessage |
mergeJoinExchangeOnDone(GridDhtPartitionsExchangeFuture fut) |
Object |
mutex() |
static long |
nextDumpTimeout(int step,
long timeout) |
boolean |
onAdded() |
void |
onAffinityChangeMessage(ClusterNode node,
CacheAffinityChangeMessage msg)
Affinity change message callback, processed from the same thread as
onNodeLeft(org.apache.ignite.cluster.ClusterNode) . |
boolean |
onDone(@Nullable AffinityTopologyVersion res,
@Nullable Throwable err)
Callback to notify that future is finished.
|
void |
onDynamicCacheChangeFail(ClusterNode node,
DynamicCacheChangeFailureMessage msg)
Cache change failure message callback, processed from the discovery thread.
|
void |
onEvent(GridDhtPartitionExchangeId exchId,
DiscoveryEvent discoEvt,
DiscoCache discoCache)
Event callback.
|
void |
onNodeLeft(ClusterNode node)
Node left callback, processed from the same thread as
onAffinityChangeMessage(org.apache.ignite.cluster.ClusterNode, org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage) . |
void |
onReceiveFullMessage(ClusterNode node,
GridDhtPartitionsFullMessage msg) |
void |
onReceivePartitionRequest(ClusterNode node,
GridDhtPartitionsSingleRequest msg) |
void |
onReceiveSingleMessage(ClusterNode node,
GridDhtPartitionsSingleMessage msg)
Processing of received single message.
|
@Nullable List<UUID> |
partitionHistorySupplier(int grpId,
int partId,
long cntrSince)
Retreives the node which has WAL history since
cntrSince . |
boolean |
rebalanced() |
boolean |
reconnectOnError(Throwable e) |
boolean |
resetLostPartitionFor(String cacheOrGroupName) |
boolean |
serverNodeDiscoveryEvent() |
GridCacheSharedContext |
sharedContext() |
String |
shortInfo() |
boolean |
skipForExchangeMerge() |
Span |
span()
Gets span instance.
|
void |
span(Span span)
Set span.
|
TimeBag |
timeBag() |
AffinityTopologyVersion |
topologyVersion()
Gets result topology version of this future.
|
String |
toString() |
void |
validate(CacheGroupContext grp) |
void |
waitAndReplyToNode(UUID nodeId,
GridDhtPartitionsSingleMessage msg) |
boolean |
wasRebalanced() |
hasLostPartitions, validateCache, validateCacheGroup
cancel, chain, chain, error, get, get, get, getUninterruptibly, ignoreInterrupts, isCancelled, isDone, isFailed, listen, logger, onCancelled, onDone, onDone, onDone, onDone, reset, result
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
cancel, chain, chain, error, get, get, get, getUninterruptibly, isCancelled, isDone, listen, result
public static final String EXCHANGE_LOG
public static final String PARTITION_STATE_FAILED_MSG
public static final int DFLT_PARTITION_RELEASE_FUTURE_DUMP_THRESHOLD
public static final String EXCHANGE_LATCH_ID
public static final int DFLT_LONG_OPERATIONS_DUMP_TIMEOUT_LIMIT
public GridDhtPartitionsExchangeFuture(GridCacheSharedContext cctx, ReadWriteLock busyLock, GridDhtPartitionExchangeId exchId, ExchangeActions exchActions, CacheAffinityChangeMessage affChangeMsg)
cctx
- Cache context.busyLock
- Busy lock.exchId
- Exchange ID.exchActions
- Cache change requests.affChangeMsg
- Affinity change message.public void span(Span span)
span
- Span.public Span span()
public Object mutex()
public GridCacheSharedContext sharedContext()
public boolean skipForExchangeMerge()
skipForExchangeMerge
in interface CachePartitionExchangeWorkerTask
False
if exchange merge should stop if this task is found in exchange worker queue.public ExchangeContext context()
public void exchangeActions(ExchangeActions exchActions)
evtLatch
be armed.exchActions
- Exchange actions.@Nullable public @Nullable ExchangeActions exchangeActions()
null
(for example, if the exchange is created for topology
change event).public void affinityChangeMessage(CacheAffinityChangeMessage affChangeMsg)
affChangeMsg
- Affinity change message.public AffinityTopologyVersion initialVersion()
initialVersion
in interface GridDhtTopologyFuture
public AffinityTopologyVersion topologyVersion()
This method should be called only for finished topology future since result version is not known before exchange finished.
topologyVersion
in interface GridDhtTopologyFuture
@Nullable public @Nullable GridDhtPartitionsExchangeFuture.ExchangeType exchangeType()
null
if not determined yet.@Nullable public @Nullable List<UUID> partitionHistorySupplier(int grpId, int partId, long cntrSince)
cntrSince
.grpId
- Cache group ID.partId
- Partition ID.cntrSince
- Partition update counter since history supplying is requested.public void markNodeAsInapplicableForHistoricalRebalance(UUID nodeId)
nodeId
- Node id that should not be used for wal rebalancing (aka historical supplier).public void markNodeAsInapplicableForFullRebalance(UUID nodeId, int grpId, int p)
nodeId
- Node id that should not be used for full rebalancing.grpId
- Cache group id.p
- Partition id.public boolean hasInapplicableNodesForHistoricalRebalance()
true
if there are nodes which are inapplicable for historical rebalancing.public boolean hasInapplicableNodesForFullRebalance()
true
if there are nodes which are inapplicable for full rebalancing.public boolean hasInapplicableNodesForRebalance()
true
if there are nodes which are inapplicable for rebalancing.public boolean isNodeApplicableForFullRebalance(UUID nodeId, int grpId, int p)
nodeId
- Node id to check.grpId
- Cache group id.p
- Partition id.true
if the node is applicable for full rebalancing.public boolean cacheAddedOnExchange(int cacheId, UUID rcvdFrom)
cacheId
- Cache ID.rcvdFrom
- Node ID cache was received from.True
if cache was added during this exchange.public boolean cacheGroupAddedOnExchange(int grpId, UUID rcvdFrom)
grpId
- Cache group ID.rcvdFrom
- Node ID cache group was received from.True
if cache group was added during this exchange.public boolean dynamicCacheGroupStarted(int grpId)
grpId
- Cache group ID.True
if non-client cache group was added during this exchange.public long currentPMEDuration(boolean blocked)
blocked
- True
if take into account only cache operations blocked PME.0
If there is no
running PME or blocked
was set to true
and current PME don't block cache operations.public boolean onAdded()
True
public void onEvent(GridDhtPartitionExchangeId exchId, DiscoveryEvent discoEvt, DiscoCache discoCache)
exchId
- Exchange ID.discoEvt
- Discovery event.discoCache
- Discovery data cache.public boolean resetLostPartitionFor(String cacheOrGroupName)
cacheOrGroupName
- Group or cache name for reset lost partitions.True
if reset lost partition exchange.public boolean activateCluster()
True
if activate cluster exchange.public boolean changedBaseline()
public boolean changedAffinity()
changedAffinity
in interface GridDhtTopologyFuture
True
if this exchange changed affinity.public boolean hasCachesToStart()
True
if there are caches to start.public DiscoveryEvent firstEvent()
public DiscoCache firstEventCache()
public ExchangeDiscoveryEvents events()
public GridDhtPartitionExchangeId exchangeId()
public TimeBag timeBag()
public void init(boolean newCrd) throws IgniteInterruptedCheckedException
newCrd
- True
if node become coordinator on this exchange.IgniteInterruptedCheckedException
- If interrupted.public boolean isBaselineNodeFailed()
True
if event node is in baseline and failed and false
otherwise.public boolean localJoinExchange()
True
if exchange for local node join.public boolean serverNodeDiscoveryEvent()
True
if exchange triggered by server node join or fail.public boolean exchangeDone()
GridCachePartitionExchangeManager.affinityReadyFuture(AffinityTopologyVersion)
is completed before GridFutureAdapter.onDone(Object, Throwable)
is called on
GridDhtPartitionsExchangeFuture
, it is guaranteed that this method will return true
if affinity ready future is finished.
Also this method returns false
for merged exchange futures.
exchangeDone
in interface GridDhtTopologyFuture
True
if exchange is finished and result topology version can be used.public void finishMerged(AffinityTopologyVersion resVer, GridDhtPartitionsExchangeFuture exchFut)
public boolean isMerged()
True
if future was merged.public boolean onDone(@Nullable @Nullable AffinityTopologyVersion res, @Nullable @Nullable Throwable err)
null
exception is passed in
the result value will be ignored.onDone
in class GridFutureAdapter<AffinityTopologyVersion>
res
- Optional result.err
- Optional error.True
if result was set by this call.public void validate(CacheGroupContext grp)
grp
- Cache group.public void cleanUp()
public boolean mergeJoinExchange(GridDhtPartitionsExchangeFuture fut)
mux
of the fut
.
All futures being merged are merged under a single synchronized section.fut
- Current exchange to merge with.True
if need wait for message from joined server node.@Nullable public @Nullable GridDhtPartitionsSingleMessage mergeJoinExchangeOnDone(GridDhtPartitionsExchangeFuture fut)
fut
- Current future.public void forceClientReconnect(ClusterNode node, GridDhtPartitionsSingleMessage msg)
node
- Client node that should try to reconnect to the cluster.msg
- Single message received from the client which didn't find original ExchangeFuture.public void onReceiveSingleMessage(ClusterNode node, GridDhtPartitionsSingleMessage msg)
initDone()
node
- Sender node.msg
- Single partition info.public boolean fastReplyOnSingleMessage(ClusterNode node, GridDhtPartitionsSingleMessage msg)
GridDhtPartitionsFullMessage
on received single message in case of exchange
future has already completed.node
- Cluster node which sent single message.msg
- Single message.true
if fast reply succeed.public void waitAndReplyToNode(UUID nodeId, GridDhtPartitionsSingleMessage msg)
nodeId
- Node ID.msg
- Client's message.public void onReceiveFullMessage(ClusterNode node, GridDhtPartitionsFullMessage msg)
node
- Sender node.msg
- Full partition info.public void onReceivePartitionRequest(ClusterNode node, GridDhtPartitionsSingleRequest msg)
node
- Sender node.msg
- Message with full partition info.public void onDynamicCacheChangeFail(ClusterNode node, DynamicCacheChangeFailureMessage msg)
node
- Message sender node.msg
- Failure message.public void onAffinityChangeMessage(ClusterNode node, CacheAffinityChangeMessage msg)
onNodeLeft(org.apache.ignite.cluster.ClusterNode)
.node
- Message sender node.msg
- Message.public void onNodeLeft(ClusterNode node)
onAffinityChangeMessage(org.apache.ignite.cluster.ClusterNode, org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage)
.node
- Left node.public boolean reconnectOnError(Throwable e)
e
- Exception.True
if local node should try reconnect in case of error.public boolean rebalanced()
True
if cluster fully rebalanced.public boolean wasRebalanced()
True
if cluster was fully rebalanced on previous topology.public void markAffinityReassign()
public boolean affinityReassign()
public boolean addOrMergeDelayedFullMessage(ClusterNode node, GridDhtPartitionsFullMessage fullMsg)
fullMsg
- Full message with exchangeId = null.True
if message should be ignored and processed after exchange is done.public int compareTo(GridDhtPartitionsExchangeFuture fut)
compareTo
in interface Comparable<GridDhtPartitionsExchangeFuture>
public void addDiagnosticRequest(IgniteDiagnosticPrepareContext diagCtx)
addDiagnosticRequest
in interface IgniteDiagnosticAware
diagCtx
- Context.public String shortInfo()
public String toString()
toString
in class GridFutureAdapter<AffinityTopologyVersion>
public static long nextDumpTimeout(int step, long timeout)
step
- Exponent coefficient.timeout
- Base timeout.public boolean isClearingPartition(CacheGroupContext grp, int part)
grp
- Group.part
- Partition.True
if partition has to be cleared before rebalance.public void addClearingPartition(CacheGroupContext grp, int part)
grp
- Group.part
- Partition.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.10.0 Release Date : March 10 2021