Class CacheGroupContext


  • public class CacheGroupContext
    extends Object
    • Constructor Detail

      • CacheGroupContext

        public CacheGroupContext​(GridCacheSharedContext<?,​?> ctx,
                                 int grpId,
                                 UUID rcvdFrom,
                                 CacheType cacheType,
                                 CacheConfiguration<?,​?> ccfg,
                                 boolean affNode,
                                 DataRegion dataRegion,
                                 CacheObjectContext cacheObjCtx,
                                 FreeList<?> freeList,
                                 ReuseList reuseList,
                                 AffinityTopologyVersion locStartVer,
                                 boolean persistenceEnabled,
                                 boolean walEnabled,
                                 boolean recoveryMode,
                                 CompressionHandler compressHnd)
        Parameters:
        ctx - Context.
        grpId - Group ID.
        rcvdFrom - Node ID cache group was received from.
        cacheType - Cache type.
        ccfg - Cache configuration.
        affNode - Affinity node flag.
        dataRegion - data region.
        cacheObjCtx - Cache object context.
        freeList - Free list.
        reuseList - Reuse list.
        locStartVer - Topology version when group was started on local node.
        persistenceEnabled - Persistence enabled flag.
        walEnabled - Wal enabled flag.
        compressHnd - Compression handler.
    • Method Detail

      • systemCache

        public boolean systemCache()
        Returns:
        True if this is cache group for one of system caches.
      • receivedFrom

        public UUID receivedFrom()
        Returns:
        Node ID initiated cache group start.
      • storeCacheIdInDataPage

        public boolean storeCacheIdInDataPage()
        Returns:
        True if cacheId should be stored in data pages.
      • deploymentEnabled

        public boolean deploymentEnabled()
        Returns:
        True if deployment is enabled.
      • ioPolicy

        public byte ioPolicy()
        Returns:
        IO policy for the given cache group.
      • hasCache

        public boolean hasCache​(String cacheName)
        Parameters:
        cacheName - Cache name.
        Returns:
        True if group contains cache with given name.
      • singleCacheContext

        public GridCacheContext<?,​?> singleCacheContext()
        Returns:
        Cache context if group contains single cache.
      • unwindUndeploys

        public void unwindUndeploys()
      • eventRecordable

        public boolean eventRecordable​(int type)
        Parameters:
        type - Event type to check.
        Returns:
        True if given event type should be recorded.
      • userCache

        public boolean userCache()
        Returns:
        True if cache created by user.
      • addRebalanceEvent

        public void addRebalanceEvent​(int part,
                                      int type,
                                      ClusterNode discoNode,
                                      int discoType,
                                      long discoTs)
        Adds rebalancing event.
        Parameters:
        part - Partition.
        type - Event type.
        discoNode - Discovery node.
        discoType - Discovery event type.
        discoTs - Discovery event timestamp.
      • addUnloadEvent

        public void addUnloadEvent​(int part)
        Adds partition unload event.
        Parameters:
        part - Partition.
      • addRebalanceSupplyEvent

        public void addRebalanceSupplyEvent​(int part)
        Adds partition supply event.
        Parameters:
        part - Partition.
      • addRebalanceMissEvent

        public void addRebalanceMissEvent​(int part)
        Adds partition supply event.
        Parameters:
        part - Partition.
      • addCacheEvent

        public void addCacheEvent​(int part,
                                  KeyCacheObject key,
                                  UUID evtNodeId,
                                  int type,
                                  @Nullable
                                  @Nullable CacheObject newVal,
                                  boolean hasNewVal,
                                  @Nullable
                                  @Nullable CacheObject oldVal,
                                  boolean hasOldVal,
                                  boolean keepBinary)
        Parameters:
        part - Partition.
        key - Key.
        evtNodeId - Event node ID.
        type - Event type.
        newVal - New value.
        hasNewVal - Has new value flag.
        oldVal - Old values.
        hasOldVal - Has old value flag.
        keepBinary - Keep binary flag.
      • queriesEnabled

        public boolean queriesEnabled()
        Returns:
        True if contains cache with query indexing enabled.
      • isDrEnabled

        public boolean isDrEnabled()
        Returns:
        True in case replication is enabled.
      • freeList

        public FreeList<?> freeList()
        Returns:
        Free List.
      • reuseList

        public ReuseList reuseList()
        Returns:
        Reuse List.
      • cacheObjectContext

        public CacheObjectContext cacheObjectContext()
        Returns:
        Cache object context.
      • dataRegion

        public DataRegion dataRegion()
        Returns:
        data region.
      • affinityNode

        public boolean affinityNode()
        Returns:
        True if local node is affinity node.
      • isTopologyLocked

        public boolean isTopologyLocked()
        Returns:
        True if current thread holds lock on topology.
      • localStartVersion

        public AffinityTopologyVersion localStartVersion()
        Returns:
        Topology version when group was started on local node.
      • isReplicated

        public boolean isReplicated()
        Returns:
        True if cache is local.
      • affinityFunction

        public AffinityFunction affinityFunction()
        Returns:
        Configured affinity function.
      • name

        @Nullable
        public @Nullable String name()
        Returns:
        Group name or null if group name was not specified for cache.
      • cacheOrGroupName

        public String cacheOrGroupName()
        Returns:
        Group name if it is specified, otherwise cache name.
      • groupId

        public int groupId()
        Returns:
        Group ID.
      • sharedGroup

        public boolean sharedGroup()
        Returns:
        True if group can contain multiple caches.
      • onKernalStop

        public void onKernalStop()
      • finishRecovery

        public void finishRecovery​(AffinityTopologyVersion startVer,
                                   UUID originalReceivedFrom,
                                   boolean affinityNode)
                            throws IgniteCheckedException
        Finishes recovery for current cache group. Attaches topology version and initializes I/O.
        Parameters:
        startVer - Cache group start version.
        originalReceivedFrom - UUID of node that was first who initiated cache group creating. This is needed to decide should node calculate affinity locally or fetch from other nodes.
        affinityNode - Flag indicates, is local node affinity node or not. This may be calculated only after node joined to topology.
        Throws:
        IgniteCheckedException - If failed.
      • isRecoveryMode

        public boolean isRecoveryMode()
        Returns:
        True if current cache group is in recovery mode.
      • cacheIds

        public Set<Integer> cacheIds()
        Returns:
        IDs of caches in this group.
      • caches

        public List<GridCacheContext<?,​?>> caches()
        Returns:
        Caches in this group. caches is already Unmodifiable list, so we don't need to explicitly wrap it here.
      • hasCaches

        public boolean hasCaches()
        Returns:
        True if group contains caches.
      • onPartitionEvicted

        public void onPartitionEvicted​(int part)
        Parameters:
        part - Partition ID.
      • addCacheWithContinuousQuery

        public void addCacheWithContinuousQuery​(GridCacheContext<?,​?> cctx)
        Parameters:
        cctx - Cache context.
      • removeCacheWithContinuousQuery

        public void removeCacheWithContinuousQuery​(GridCacheContext<?,​?> cctx)
        Parameters:
        cctx - Cache context.
      • listenerLock

        public ReadWriteLock listenerLock()
        Obtain the group listeners lock. Write lock should be held to register/unregister listeners. Read lock should be hel for CQ listeners notification.
        Returns:
        Lock for the CQ listeners.
      • onPartitionCounterUpdate

        public void onPartitionCounterUpdate​(int cacheId,
                                             int part,
                                             long cntr,
                                             AffinityTopologyVersion topVer,
                                             boolean primary)
        Parameters:
        cacheId - ID of cache initiated counter update.
        part - Partition number.
        cntr - Counter.
        topVer - Topology version for current operation.
      • persistenceEnabled

        public boolean persistenceEnabled()
        Returns:
        Persistence enabled flag.
      • logDataRecords

        public boolean logDataRecords()
        Returns:
        True if DataRecord should be loged in the WAL.
      • cdcEnabled

        public boolean cdcEnabled()
        Returns:
        True if CDC enabled.
      • onDisconnected

        public void onDisconnected​(IgniteFuture reconnectFut)
        Parameters:
        reconnectFut - Reconnect future.
      • rebalanceEnabled

        public boolean rebalanceEnabled()
        Returns:
        True if rebalance is enabled.
      • onReconnected

        public void onReconnected()
      • localWalEnabled

        public boolean localWalEnabled()
        Local WAL enabled flag.
        Returns:
        False if a durability (WAL logging) is disabled for a group until rebalancing has finished.
      • globalWalEnabled

        public boolean globalWalEnabled()
        Returns:
        Global WAL enabled flag.
      • indexWalEnabled

        public boolean indexWalEnabled()
        Returns:
        True if WAL for index operations enabled.
      • indexWalEnabled

        public void indexWalEnabled​(boolean idxWalEnabled)
        Parameters:
        idxWalEnabled - Index WAL enabled flag.
      • globalWalEnabled

        public void globalWalEnabled​(boolean enabled)
        Parameters:
        enabled - Global WAL enabled flag.
      • localWalEnabled

        public void localWalEnabled​(boolean enabled,
                                    boolean persist)
        Parameters:
        enabled - Local WAL enabled flag.
        persist - If true then flag state will be persisted into metastorage.
      • statisticsHolderIdx

        public IoStatisticsHolder statisticsHolderIdx()
        Returns:
        Statistics holder to track cache IO operations.
      • statisticsHolderData

        public IoStatisticsHolder statisticsHolderData()
        Returns:
        Statistics holder to track cache IO operations.
      • hasAtomicCaches

        public boolean hasAtomicCaches()
        Returns:
        True if group has atomic caches.
      • removeIOStatistic

        public void removeIOStatistic​(boolean destroy)
        Removes statistics metrics registries.
        Parameters:
        destroy - Group destroy flag.
      • prepareToStop

        public void prepareToStop()
        Prepare cache to stop (prohibit any futher updates).
      • isPreparedToStop

        public boolean isPreparedToStop()