Class GridCacheMvccManager

    • Constructor Detail

      • GridCacheMvccManager

        public GridCacheMvccManager()
    • Method Detail

      • finishRemoteTxs

        public IgniteInternalFuture<?> finishRemoteTxs​(AffinityTopologyVersion topVer)
        Creates a future that will wait for finishing all remote transactions (primary -> backup) with topology version less or equal to topVer.
        Parameters:
        topVer - Topology version.
        Returns:
        Compound future of all GridDhtTxFinishFuture futures.
      • removeExplicitNodeLocks

        public void removeExplicitNodeLocks​(UUID leftNodeId)
        Parameters:
        leftNodeId - Left node ID.
      • onStop

        public void onStop()
        Cancels all client futures.
      • addAtomicFuture

        public boolean addAtomicFuture​(long futId,
                                       GridCacheAtomicFuture<?> fut)
        Parameters:
        futId - Future ID.
        fut - Future.
        Returns:
        False if future was forcibly completed with error.
      • atomicFuturesCount

        public int atomicFuturesCount()
        Returns:
        Number of pending atomic futures.
      • dataStreamerFutures

        public Collection<org.apache.ignite.internal.processors.cache.GridCacheMvccManager.DataStreamerFuture> dataStreamerFutures()
        Returns:
        Collection of pending data streamer futures.
      • atomicFuture

        @Nullable
        public @Nullable IgniteInternalFuture<?> atomicFuture​(long futId)
        Gets future by given future ID.
        Parameters:
        futId - Future ID.
        Returns:
        Future.
      • removeAtomicFuture

        @Nullable
        public @Nullable IgniteInternalFuture<?> removeAtomicFuture​(long futId)
        Parameters:
        futId - Future ID.
        Returns:
        Removed future.
      • addFuture

        public boolean addFuture​(GridCacheFuture<?> fut,
                                 IgniteUuid futId)
        Parameters:
        fut - Future.
        futId - Future ID.
        Returns:
        True if added.
      • addFuture

        public boolean addFuture​(GridCacheVersionedFuture<?> fut)
        /** Adds future.
        Parameters:
        fut - Future.
        Returns:
        True if added.
      • removeFuture

        public void removeFuture​(IgniteUuid futId)
        Parameters:
        futId - Future ID.
      • removeVersionedFuture

        public boolean removeVersionedFuture​(GridCacheVersionedFuture<?> fut)
        Parameters:
        fut - Future to remove.
        Returns:
        True if removed.
      • future

        @Nullable
        public @Nullable GridCacheFuture future​(IgniteUuid futId)
        Parameters:
        futId - Future ID.
        Returns:
        Found future.
      • isRemoved

        public boolean isRemoved​(GridCacheContext cacheCtx,
                                 GridCacheVersion ver)
        Parameters:
        cacheCtx - Cache context.
        ver - Lock version to check.
        Returns:
        True if lock had been removed.
      • addRemoved

        public boolean addRemoved​(GridCacheContext cacheCtx,
                                  GridCacheVersion ver)
        Parameters:
        cacheCtx - Cache context.
        ver - Obsolete entry version.
        Returns:
        True if added.
      • remoteCandidates

        public Collection<GridCacheMvccCandidate> remoteCandidates()
        This method has poor performance, so use with care. It is currently only used by DGC.
        Returns:
        Remote candidates.
      • localCandidates

        public Collection<GridCacheMvccCandidate> localCandidates()
        This method has poor performance, so use with care. It is currently only used by DGC.
        Returns:
        Local candidates.
      • addNext

        public boolean addNext​(GridCacheContext cacheCtx,
                               GridCacheMvccCandidate cand)
        Parameters:
        cacheCtx - Cache context.
        cand - Cache lock candidate to add.
        Returns:
        True if added as a result of this operation, false if was previously added.
      • contextReset

        public void contextReset()
        Reset MVCC context.
      • addExplicitLock

        public void addExplicitLock​(long threadId,
                                    GridCacheMvccCandidate cand,
                                    AffinityTopologyVersion topVer)
        Adds candidate to the list of near local candidates.
        Parameters:
        threadId - Thread ID.
        cand - Candidate to add.
        topVer - Topology version.
      • removeExplicitLock

        public void removeExplicitLock​(GridCacheMvccCandidate cand)
        Removes candidate from the list of near local candidates.
        Parameters:
        cand - Candidate to remove.
      • isLockedByThread

        public boolean isLockedByThread​(IgniteTxKey key,
                                        long threadId)
        Checks if given key is locked by thread with given id or any thread.
        Parameters:
        key - Key to check.
        threadId - Thread id. If -1, all threads will be checked.
        Returns:
        True if locked by any or given thread (depending on threadId value).
      • markExplicitOwner

        public void markExplicitOwner​(IgniteTxKey key,
                                      long threadId)
        Marks candidates for given thread and given key as owned.
        Parameters:
        key - Key.
        threadId - Thread id.
      • removeExplicitLock

        public GridCacheMvccCandidate removeExplicitLock​(long threadId,
                                                         IgniteTxKey key,
                                                         @Nullable
                                                         @Nullable GridCacheVersion ver)
        Removes explicit lock for given thread id, key and optional version.
        Parameters:
        threadId - Thread id.
        key - Key.
        ver - Optional version.
        Returns:
        Candidate.
      • explicitLock

        @Nullable
        public @Nullable GridCacheMvccCandidate explicitLock​(long threadId,
                                                             IgniteTxKey key)
        Gets last added explicit lock candidate by thread id and key.
        Parameters:
        threadId - Thread id.
        key - Key to look up.
        Returns:
        Last added explicit lock candidate for given thread id and key or null if no such candidate.
      • explicitLock

        @Nullable
        public @Nullable GridCacheMvccCandidate explicitLock​(IgniteTxKey key,
                                                             @Nullable
                                                             @Nullable GridCacheVersion ver)
        Gets explicit lock candidate added by any thread by given key and lock version.
        Parameters:
        key - Key.
        ver - Version.
        Returns:
        Lock candidate that satisfies given criteria or null if no such candidate.
      • lastExplicitLockTopologyVersion

        @Nullable
        public @Nullable AffinityTopologyVersion lastExplicitLockTopologyVersion​(long threadId)
        Parameters:
        threadId - Thread ID.
        Returns:
        Topology snapshot for last acquired and not released lock.
      • finishExplicitLocks

        public IgniteInternalFuture<?> finishExplicitLocks​(AffinityTopologyVersion topVer)
        Creates a future that will wait for all explicit locks acquired on given topology version to be released.
        Parameters:
        topVer - Topology version to wait for.
        Returns:
        Explicit locks release future.
      • recheckPendingLocks

        public void recheckPendingLocks()
      • nextAtomicId

        public long nextAtomicId()
        Returns:
        Next future ID for atomic futures.