Class CacheGroupContext
- java.lang.Object
-
- org.apache.ignite.internal.processors.cache.CacheGroupContext
-
public class CacheGroupContext extends Object
-
-
Constructor Summary
Constructors Constructor Description 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)
-
Method Summary
-
-
-
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:
Trueif 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:
Trueif cacheId should be stored in data pages.
-
deploymentEnabled
public boolean deploymentEnabled()
- Returns:
Trueif deployment is enabled.
-
preloader
public GridCachePreloader preloader()
- Returns:
- Preloader.
-
ioPolicy
public byte ioPolicy()
- Returns:
- IO policy for the given cache group.
-
hasCache
public boolean hasCache(String cacheName)
- Parameters:
cacheName- Cache name.- Returns:
Trueif 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:
Trueif given event type should be recorded.
-
userCache
public boolean userCache()
- Returns:
Trueif 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:
Trueif contains cache with query indexing enabled.
-
isDrEnabled
public boolean isDrEnabled()
- Returns:
Truein 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.
-
shared
public GridCacheSharedContext<?,?> shared()
- Returns:
- Cache shared context.
-
dataRegion
public DataRegion dataRegion()
- Returns:
- data region.
-
affinityNode
public boolean affinityNode()
- Returns:
Trueif local node is affinity node.
-
topology
public GridDhtPartitionTopology topology()
- Returns:
- Topology.
-
isTopologyLocked
public boolean isTopologyLocked()
- Returns:
Trueif current thread holds lock on topology.
-
offheap
public IgniteCacheOffheapManager offheap()
- Returns:
- Offheap manager.
-
localStartVersion
public AffinityTopologyVersion localStartVersion()
- Returns:
- Topology version when group was started on local node.
-
isReplicated
public boolean isReplicated()
- Returns:
Trueif cache is local.
-
config
public CacheConfiguration<?,?> config()
- Returns:
- Cache configuration.
-
nodeFilter
public IgnitePredicate<ClusterNode> nodeFilter()
- Returns:
- Cache node filter.
-
topologyValidators
public Collection<TopologyValidator> topologyValidators()
- Returns:
- Configured topology validators.
-
affinityFunction
public AffinityFunction affinityFunction()
- Returns:
- Configured affinity function.
-
affinity
public GridAffinityAssignmentCache affinity()
- Returns:
- Affinity.
-
name
@Nullable public @Nullable String name()
- Returns:
- Group name or
nullif 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:
Trueif 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:
Trueif current cache group is in recovery mode.
-
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:
Trueif 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.
-
start
public void start() throws IgniteCheckedException- Throws:
IgniteCheckedException- If failed.
-
persistenceEnabled
public boolean persistenceEnabled()
- Returns:
- Persistence enabled flag.
-
logDataRecords
public boolean logDataRecords()
- Returns:
TrueifDataRecordshould be loged in the WAL.
-
cdcEnabled
public boolean cdcEnabled()
- Returns:
Trueif CDC enabled.
-
onDisconnected
public void onDisconnected(IgniteFuture reconnectFut)
- Parameters:
reconnectFut- Reconnect future.
-
rebalanceEnabled
public boolean rebalanceEnabled()
- Returns:
Trueif rebalance is enabled.
-
onReconnected
public void onReconnected()
-
walEnabled
public boolean walEnabled()
Value returned by this method can be changed runtime by the user or during rebalance.- Returns:
- WAL enabled flag.
- See Also:
IgniteCluster.disableWal(String),IgniteCluster.enableWal(String)
-
localWalEnabled
public boolean localWalEnabled()
Local WAL enabled flag.- Returns:
Falseif 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:
Trueif 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- Iftruethen 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:
Trueif group has atomic caches.
-
metrics
public CacheGroupMetricsImpl metrics()
- Returns:
- Metrics.
-
removeIOStatistic
public void removeIOStatistic(boolean destroy)
Removes statistics metrics registries.- Parameters:
destroy- Group destroy flag.
-
wal
public IgniteWriteAheadLogManager wal()
- Returns:
- Write ahead log manager.
-
compressionHandler
public CompressionHandler compressionHandler()
-
prepareToStop
public void prepareToStop()
Prepare cache to stop (prohibit any futher updates).
-
isPreparedToStop
public boolean isPreparedToStop()
-
-