Class GridDhtPartitionsExchangeFuture

    • Method Detail

      • span

        public void span​(Span span)
        Set span.
        Parameters:
        span - Span.
      • span

        public Span span()
        Gets span instance.
        Returns:
        Span.
      • mutex

        public Object mutex()
        Returns:
        Future mutex.
      • exchangeActions

        public void exchangeActions​(ExchangeActions exchActions)
        Sets exchange actions associated with the exchange future (such as cache start or stop). Exchange actions is created from discovery event, so the actions must be set before the event is processed, thus the setter requires that evtLatch be armed.
        Parameters:
        exchActions - Exchange actions.
      • exchangeActions

        @Nullable
        public @Nullable ExchangeActions exchangeActions()
        Gets exchanges actions (such as cache start or stop) associated with the exchange future. Exchange actions can be null (for example, if the exchange is created for topology change event).
        Returns:
        Exchange actions.
      • affinityChangeMessage

        public void affinityChangeMessage​(CacheAffinityChangeMessage affChangeMsg)
        Sets affinity change message associated with the exchange. Affinity change message is required when centralized affinity change is performed.
        Parameters:
        affChangeMsg - Affinity change message.
      • initialVersion

        public AffinityTopologyVersion initialVersion()
        Gets the affinity topology version for which this exchange was created. If several exchanges were merged, initial version is the version of the earliest merged exchange.
        Specified by:
        initialVersion in interface GridDhtTopologyFuture
        Returns:
        Initial exchange version.
      • topologyVersion

        public AffinityTopologyVersion topologyVersion()
        Gets result topology version of this future. Result version can differ from initial exchange version if exchanges for multiple discovery events are merged, in this case result version is version of last discovery event.

        This method should be called only for finished topology future since result version is not known before exchange finished.

        Specified by:
        topologyVersion in interface GridDhtTopologyFuture
        Returns:
        Result topology version.
      • partitionHistorySupplier

        public List<UUID> partitionHistorySupplier​(int grpId,
                                                   int partId,
                                                   long cntrSince)
        Retreives the node which has WAL history since cntrSince.
        Parameters:
        grpId - Cache group ID.
        partId - Partition ID.
        cntrSince - Partition update counter since history supplying is requested.
        Returns:
        List of IDs of history supplier nodes or empty list if these doesn't exist.
      • markNodeAsInapplicableForHistoricalRebalance

        public void markNodeAsInapplicableForHistoricalRebalance​(UUID nodeId)
        Marks the given node as not applicable for historical rebalancing.
        Parameters:
        nodeId - Node id that should not be used for wal rebalancing (aka historical supplier).
      • copyInapplicableNodesFrom

        public void copyInapplicableNodesFrom​(GridDhtPartitionsExchangeFuture fut)
        Marks nodes as not applicable for full and historical rebalancing.
        Parameters:
        fut - Exchange future that is used for getting nodes that are not applicable for rebalancing.
      • markNodeAsInapplicableForFullRebalance

        public void markNodeAsInapplicableForFullRebalance​(UUID nodeId,
                                                           int grpId,
                                                           int p)
        Marks the given node as not applicable for full rebalancing for the given group and partition.
        Parameters:
        nodeId - Node id that should not be used for full rebalancing.
        grpId - Cache group id.
        p - Partition id.
      • hasInapplicableNodesForHistoricalRebalance

        public boolean hasInapplicableNodesForHistoricalRebalance()
        Returns:
        true if there are nodes which are inapplicable for historical rebalancing.
      • hasInapplicableNodesForFullRebalance

        public boolean hasInapplicableNodesForFullRebalance()
        Returns:
        true if there are nodes which are inapplicable for full rebalancing.
      • hasInapplicableNodesForRebalance

        public boolean hasInapplicableNodesForRebalance()
        Returns:
        true if there are nodes which are inapplicable for rebalancing.
      • isNodeApplicableForFullRebalance

        public boolean isNodeApplicableForFullRebalance​(UUID nodeId,
                                                        int grpId,
                                                        int p)
        Parameters:
        nodeId - Node id to check.
        grpId - Cache group id.
        p - Partition id.
        Returns:
        true if the node is applicable for full rebalancing.
      • cacheAddedOnExchange

        public boolean cacheAddedOnExchange​(int cacheId,
                                            UUID rcvdFrom)
        Parameters:
        cacheId - Cache ID.
        rcvdFrom - Node ID cache was received from.
        Returns:
        True if cache was added during this exchange.
      • cacheGroupAddedOnExchange

        public boolean cacheGroupAddedOnExchange​(int grpId,
                                                 UUID rcvdFrom)
        Parameters:
        grpId - Cache group ID.
        rcvdFrom - Node ID cache group was received from.
        Returns:
        True if cache group was added during this exchange.
      • dynamicCacheGroupStarted

        public boolean dynamicCacheGroupStarted​(int grpId)
        Parameters:
        grpId - Cache group ID.
        Returns:
        True if non-client cache group was added during this exchange.
      • currentPMEDuration

        public long currentPMEDuration​(boolean blocked)
        Parameters:
        blocked - True if take into account only cache operations blocked PME.
        Returns:
        Gets execution duration for current partition map exchange in milliseconds. 0 If there is no running PME or blocked was set to true and current PME don't block cache operations.
      • onAdded

        public boolean onAdded()
        Returns:
        True
      • resetLostPartitionFor

        public boolean resetLostPartitionFor​(String cacheOrGroupName)
        Parameters:
        cacheOrGroupName - Group or cache name for reset lost partitions.
        Returns:
        True if reset lost partition exchange.
      • finalizeCounters

        public boolean finalizeCounters()
        Returns:
        True if update counters finalization exchange.
      • activateCluster

        public boolean activateCluster()
        Returns:
        True if activate cluster exchange.
      • changedBaseline

        public boolean changedBaseline()
      • hasCachesToStart

        public boolean hasCachesToStart()
        Returns:
        True if there are caches to start.
      • firstEvent

        public DiscoveryEvent firstEvent()
        Returns:
        First event discovery event.
      • firstEventCache

        public DiscoCache firstEventCache()
        Returns:
        Discovery cache for first event.
      • timeBag

        public TimeBag timeBag()
        Returns:
        Object to collect exchange timings.
      • isBaselineNodeFailed

        public boolean isBaselineNodeFailed()
        Returns:
        True if event node is in baseline and failed and false otherwise.
      • localJoinExchange

        public boolean localJoinExchange()
        Returns:
        True if exchange for local node join.
      • serverNodeDiscoveryEvent

        public boolean serverNodeDiscoveryEvent()
        Returns:
        True if exchange triggered by server node join or fail.
      • isMerged

        public boolean isMerged()
        Returns:
        True if future was merged.
      • onDone

        public boolean onDone​(@Nullable
                              @Nullable AffinityTopologyVersion res,
                              @Nullable
                              @Nullable Throwable err)
        Callback to notify that future is finished. Note that if non-null exception is passed in the result value will be ignored.
        Overrides:
        onDone in class GridFutureAdapter<AffinityTopologyVersion>
        Parameters:
        res - Optional result.
        err - Optional error.
        Returns:
        True if result was set by this call.
      • validate

        public void validate​(CacheGroupContext grp)
        Parameters:
        grp - Cache group.
      • cleanUp

        public void cleanUp()
        Cleans up resources to avoid excessive memory usage.
      • mergeJoinExchange

        public boolean mergeJoinExchange​(GridDhtPartitionsExchangeFuture fut)
        Merges this exchange with given one. Invoked under synchronization on mux of the fut. All futures being merged are merged under a single synchronized section.
        Parameters:
        fut - Current exchange to merge with.
        Returns:
        True if need wait for message from joined server node.
      • forceClientReconnect

        public 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.
        Parameters:
        node - Client node that should try to reconnect to the cluster.
        msg - Single message received from the client which didn't find original ExchangeFuture.
      • onReceiveSingleMessage

        public void onReceiveSingleMessage​(ClusterNode node,
                                           GridDhtPartitionsSingleMessage msg)
        Processing of received single message. Actual processing in future may be delayed if init method was not completed, see initDone()
        Parameters:
        node - Sender node.
        msg - Single partition info.
      • fastReplyOnSingleMessage

        public boolean fastReplyOnSingleMessage​(ClusterNode node,
                                                GridDhtPartitionsSingleMessage msg)
        Tries to fast reply with GridDhtPartitionsFullMessage on received single message in case of exchange future has already completed.
        Parameters:
        node - Cluster node which sent single message.
        msg - Single message.
        Returns:
        true if fast reply succeed.
      • onDynamicCacheChangeFail

        public void onDynamicCacheChangeFail​(ClusterNode node,
                                             DynamicCacheChangeFailureMessage msg)
        Cache change failure message callback, processed from the discovery thread.
        Parameters:
        node - Message sender node.
        msg - Failure message.
      • reconnectOnError

        public boolean reconnectOnError​(Throwable e)
        Parameters:
        e - Exception.
        Returns:
        True if local node should try reconnect in case of error.
      • rebalanced

        public boolean rebalanced()
        Returns:
        True if cluster fully rebalanced.
      • wasRebalanced

        public boolean wasRebalanced()
        Returns:
        True if cluster was fully rebalanced on previous topology.
      • markAffinityReassign

        public void markAffinityReassign()
        Marks this future as affinity reassign.
      • affinityReassign

        public boolean affinityReassign()
        Returns:
        True if some owned partition was reassigned, false otherwise.
      • addOrMergeDelayedFullMessage

        public boolean addOrMergeDelayedFullMessage​(ClusterNode node,
                                                    GridDhtPartitionsFullMessage fullMsg)
        Add or merge updates received from coordinator while exchange in progress.
        Parameters:
        fullMsg - Full message with exchangeId = null.
        Returns:
        True if message should be ignored and processed after exchange is done.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • shortInfo

        public String shortInfo()
        Returns:
        Short information string.
      • nextDumpTimeout

        public static long nextDumpTimeout​(int step,
                                           long timeout)
        Parameters:
        step - Exponent coefficient.
        timeout - Base timeout.
        Returns:
        Time to wait before next debug dump.
      • isClearingPartition

        public boolean isClearingPartition​(CacheGroupContext grp,
                                           int part)
        Parameters:
        grp - Group.
        part - Partition.
        Returns:
        True if partition has to be cleared before rebalance.
      • addClearingPartition

        public void addClearingPartition​(CacheGroupContext grp,
                                         int part)
        Marks a partition for clearing before rebalance. Fully cleared partitions should never be historically rebalanced.
        Parameters:
        grp - Group.
        part - Partition.