Class GridCacheProcessor
- java.lang.Object
-
- org.apache.ignite.internal.processors.GridProcessorAdapter
-
- org.apache.ignite.internal.processors.cache.GridCacheProcessor
-
- All Implemented Interfaces:
GridComponent,GridProcessor
public class GridCacheProcessor extends GridProcessorAdapter
The main responsibility of this processor is orchestrating of starting, stopping caches and everything related to that activity like validation of cache configuration, restoring configuration from persistence, etc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.ignite.internal.GridComponent
GridComponent.DiscoveryDataExchangeType
-
-
Field Summary
Fields Modifier and Type Field Description static StringCACHE_GRP_IO_VIEWSystem view name for cache group IO.static StringCACHE_GRP_IO_VIEW_DESCSystem view description for cache group IO.static StringCACHE_GRP_PAGE_LIST_VIEWSystem view name for page lists.static StringCACHE_GRP_PAGE_LIST_VIEW_DESCSystem view description for page lists.static StringCLUSTER_READ_ONLY_MODE_ERROR_MSG_FORMATstatic booleanDFLT_ALLOW_START_CACHES_IN_PARALLELstatic StringEXPRITY_POLICY_MSGstatic StringPART_STATES_VIEWSystem view name for partition states.static StringPART_STATES_VIEW_DESCSystem view description for partition states.-
Fields inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
ctx, diagnosticLog, log
-
-
Constructor Summary
Constructors Constructor Description GridCacheProcessor(GridKernalContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCacheConfiguration(CacheConfiguration cacheCfg)@Nullable IgniteCacheProxyImpl<?,?>addjCacheProxy(String name, IgniteCacheProxyImpl<?,?> proxy)voidawaitStarted()Await for local join finish and caches start.voidblockGateway(String cacheName, boolean stop, boolean restart)voidblockGateways()Blocks all available gatewaysList<GridCacheAdapter>blockGateways(Collection<Integer> cacheGrpIds)Blocks (stops) cache gateway for caches according to givencacheGroupIds.<K,V>
@Nullable IgniteInternalCache<K,V>cache(String name)CacheConfigurationcacheConfiguration(String name)Get configuration for the given cache.@Nullable DynamicCacheDescriptorcacheDescriptor(int cacheId)DynamicCacheDescriptorcacheDescriptor(String name)Get registered cache descriptor.Map<String,DynamicCacheDescriptor>cacheDescriptors()@Nullable CacheGroupContextcacheGroup(int grpId)CacheGroupDescriptorcacheGroupDescriptor(int grpId)Tries to find cache group descriptor either in registered cache groups or in marked for deletion collection if cache group is considered to be stopped.Map<Integer,CacheGroupDescriptor>cacheGroupDescriptors()Collection<CacheGroupContext>cacheGroups()CacheModecacheMode(String cacheName)Gets cache mode.Collection<String>cacheNames()Gets a collection of currently started caches.Collection<IgniteInternalCache<?,?>>caches()CacheTypecacheType(String cacheName)voidcheckReadOnlyState(String opName, CacheConfiguration... cfgs)Checks that cluster in aClusterState.ACTIVE_READ_ONLYstate.voidcleanupCachesDirectories()Remove all persistent files for all registered caches.voidclearStatistics(Collection<String> cacheNames)Clear statistics globally for the caches<T> Tclone(T obj)voidcollectGridNodeData(DiscoveryDataBag dataBag)Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.voidcollectJoiningNodeData(DiscoveryDataBag dataBag)Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.voidcompleteCacheStartFuture(DynamicCacheChangeRequest req, boolean success, @Nullable Throwable err)voidcompleteProxyInitialize(String name)voidcompleteProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, AffinityTopologyVersion initVer, AffinityTopologyVersion doneVer)GridLocalConfigManagerconfigManager()<K,V>
GridCacheSharedContext<K,V>context()IgniteInternalFuture<?>createFromTemplate(String cacheName)Dynamically starts cache using template configuration.@NotNull DynamicCacheChangeRequestcreateStopRequest(String cacheName, boolean restart, IgniteUuid restartId, boolean destroy)Prepares cache stop request.@Nullable GridComponent.DiscoveryDataExchangeTypediscoveryDataType()Gets unique component type to distinguish components providing discovery data.@NotNull IgniteInternalFuture<?>dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs)Starts cache stop request as cache change batch.IgniteInternalFuture<Boolean>dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart, IgniteUuid restartId)IgniteInternalFuture<?>dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx)IgniteInternalFuture<?>dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx, boolean destroy)IgniteInternalFuture<Boolean>dynamicStartCache(@Nullable CacheConfiguration ccfg, String cacheName, @Nullable NearCacheConfiguration nearCfg, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)Dynamically starts cache.IgniteInternalFuture<Boolean>dynamicStartCache(@Nullable CacheConfiguration ccfg, String cacheName, @Nullable NearCacheConfiguration nearCfg, CacheType cacheType, boolean sql, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)Dynamically starts cache.IgniteInternalFuture<Boolean>dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists, boolean checkThreadTx, boolean disabledAfterStart)Dynamically starts multiple caches.IgniteInternalFuture<Boolean>dynamicStartCachesByStoredConf(Collection<StoredCacheData> storedCacheDataList, boolean failIfExists, boolean checkThreadTx, boolean disabledAfterStart, IgniteUuid restartId)Dynamically starts multiple caches.IgniteInternalFuture<Boolean>dynamicStartSqlCache(CacheConfiguration ccfg)Dynamically starts cache as a result of SQLCREATE TABLEcommand.voidenableStatistics(Collection<String> cacheNames, boolean enabled)Enable/disable statistics globally for the cachesCacheConfigurationEnricherenricher()CachePartitionExchangeWorkerTaskexchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)Create exchange worker task for custom discovery message.IgniteInternalFuture<?>finalizePartitionsCounters()Finalizes partitions update counters.CacheConfigurationgetConfigFromTemplate(String cacheName)IgniteInternalFuture<?>getOrCreateFromTemplate(String cacheName, boolean checkThreadTx)Dynamically starts cache using template configuration.IgniteInternalFuture<?>getOrCreateFromTemplate(String cacheName, String templateName, CacheConfigurationOverride cfgOverride, boolean checkThreadTx)Dynamically starts cache using template configuration.<K,V>
IgniteInternalCache<K,V>getOrStartCache(String name)<K,V>
IgniteInternalCache<K,V>getOrStartCache(String name, CacheConfiguration ccfg)IgniteCacheProxy<?,?>getOrStartPublicCache(boolean start)Gets public cache that can be used for query execution.booleanhasCachesReceivedFromJoin(ClusterNode node)<K,V>
GridCacheAdapter<K,V>internalCache(String name)Collection<GridCacheAdapter<?,?>>internalCaches()booleanisCacheRestarting(String cacheName)booleanisEncrypted(int cacheGrpId)<K,V>
IgniteCacheProxy<K,V>jcache(String name)@Nullable IgniteCacheProxyImpl<?,?>jcacheProxy(String name, boolean awaitInit)Collection<IgniteCacheProxy<?,?>>jcaches()booleankeepStaticCacheConfiguration()@Nullable LocalJoinCachesContextlocalJoinCachesContext()voidonCacheStatisticsModeChange(CacheStatisticsModeChangeMessage msg)Cache statistics flag change message received.booleanonCustomEvent(DiscoveryCustomMessage msg, AffinityTopologyVersion topVer, ClusterNode node)Callback invoked from discovery thread when discovery custom message is received.voidonDisconnected(IgniteFuture<?> reconnectFut)Client disconnected callback.voidonDiscoveryEvent(int type, @Nullable DiscoveryCustomMessage customMsg, ClusterNode node, AffinityTopologyVersion topVer, DiscoveryDataClusterState state)voidonExchangeDone(AffinityTopologyVersion cacheStartVer, @Nullable ExchangeActions exchActions, @Nullable Throwable err)Callback invoked when first exchange future for dynamic cache is completed.voidonGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)Receives discovery data object from remote nodes (called on new node during discovery process).voidonJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)Method is called on nodes that are already in grid (not on joining node).voidonKernalStart(boolean active)Callback that notifies that kernal has successfully started, including all managers and processors.voidonKernalStop(boolean cancel)Callback to notify that kernal is about to stop.voidonKernalStopCaches(boolean cancel)IgniteInternalFuture<?>onReconnected(boolean clusterRestarted)Client reconnected callback.voidonStateChangeFinish(ChangeGlobalStateFinishMessage msg)ExchangeActionsonStateChangeRequest(ChangeGlobalStateMessage msg, AffinityTopologyVersion topVer, DiscoveryDataClusterState curState)voidonUndeployed(ClassLoader ldr)Callback invoked by deployment manager for whenever a class loader gets undeployed.Collection<DynamicCacheDescriptor>persistentCaches()Collection<CacheGroupDescriptor>persistentGroups()voidprepareCacheStart(DynamicCacheDescriptor desc, @Nullable NearCacheConfiguration reqNearCfg, AffinityTopologyVersion exchTopVer, boolean disabledAfterStart, boolean clientCache)voidprepareCacheStop(String cacheName, boolean callDestroy, boolean clearCache)voidprepareCacheStop(String cacheName, boolean callDestroy, boolean clearCache, boolean clearDbObjects)voidpreparePageStore(DynamicCacheDescriptor desc, boolean affNode)Prepare page store for start cache.voidprintMemoryStats()Prints memory statistics (sizes of internal structures, etc.).voidprocessStatisticsModeChange(CacheStatisticsModeChangeMessage msg)Cache statistics flag change task processed by exchange worker.Collection<String>publicAndDsCacheNames()Gets a collection of currently started public cache names.<K,V>
IgniteInternalCache<K,V>publicCache(String name)Collection<String>publicCacheNames()Gets a collection of currently started public cache names.Collection<IgniteCacheProxy<?,?>>publicCaches()<K,V>
IgniteCacheProxy<K,V>publicJCache(String cacheName)<K,V>
@Nullable IgniteCacheProxy<K,V>publicJCache(String cacheName, boolean failIfNotStarted, boolean checkThreadTx)voidregistrateProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, GridFutureAdapter<?> fut)IgniteInternalFuture<?>resetCacheState(Collection<String> cacheNames)Resets cache state after the cache has been moved to recovery state.List<String>resetRestartingProxies()Complete stopping of caches if they were marked as restarting but it failed.voidrestartProxies()Restarts proxies of caches if they was marked as restarting.voidsaveCacheConfiguration(DynamicCacheDescriptor desc)Save cache configuration to persistent store if necessary.voidshutdownNotFinishedRecoveryCaches()Stops all caches and groups, that was recovered, but not activated on node join.CacheConfigurationSplittersplitter()voidstart()Starts grid component.IgniteInternalFuture<?>startCachesOnLocalJoin(AffinityTopologyVersion exchTopVer, LocalJoinCachesContext locJoinCtx)Collection<DynamicCacheDescriptor>startReceivedCaches(UUID nodeId, AffinityTopologyVersion exchTopVer)Starts statically configured caches received from remote nodes during exchange.voidstop(boolean cancel)Stops grid component.voidstopCaches(boolean cancel)booleanstopWarmUp()Stop warming up and current running strategy.booleansystemCache(String name)IgniteTransactionsExtransactions()<K,V>
IgniteInternalCache<K,V>utilityCache()Gets utility cache.@Nullable IgniteNodeValidationResultvalidateNode(ClusterNode node)Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.@Nullable IgniteNodeValidationResultvalidateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.-
Methods inherited from class org.apache.ignite.internal.processors.GridProcessorAdapter
assertParameter, toString
-
-
-
-
Field Detail
-
CLUSTER_READ_ONLY_MODE_ERROR_MSG_FORMAT
public static final String CLUSTER_READ_ONLY_MODE_ERROR_MSG_FORMAT
- See Also:
- Constant Field Values
-
CACHE_GRP_PAGE_LIST_VIEW
public static final String CACHE_GRP_PAGE_LIST_VIEW
System view name for page lists.- See Also:
- Constant Field Values
-
CACHE_GRP_PAGE_LIST_VIEW_DESC
public static final String CACHE_GRP_PAGE_LIST_VIEW_DESC
System view description for page lists.- See Also:
- Constant Field Values
-
PART_STATES_VIEW
public static final String PART_STATES_VIEW
System view name for partition states.- See Also:
- Constant Field Values
-
PART_STATES_VIEW_DESC
public static final String PART_STATES_VIEW_DESC
System view description for partition states.- See Also:
- Constant Field Values
-
CACHE_GRP_IO_VIEW
public static final String CACHE_GRP_IO_VIEW
System view name for cache group IO.
-
CACHE_GRP_IO_VIEW_DESC
public static final String CACHE_GRP_IO_VIEW_DESC
System view description for cache group IO.- See Also:
- Constant Field Values
-
DFLT_ALLOW_START_CACHES_IN_PARALLEL
public static final boolean DFLT_ALLOW_START_CACHES_IN_PARALLEL
-
EXPRITY_POLICY_MSG
public static final String EXPRITY_POLICY_MSG
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GridCacheProcessor
public GridCacheProcessor(GridKernalContext ctx)
- Parameters:
ctx- Kernal context.
-
-
Method Detail
-
exchangeTaskForCustomDiscoveryMessage
public CachePartitionExchangeWorkerTask exchangeTaskForCustomDiscoveryMessage(DiscoveryCustomMessage msg)
Create exchange worker task for custom discovery message.- Parameters:
msg- Custom discovery message.- Returns:
- Task or
nullif message doesn't require any special processing.
-
start
public void start() throws IgniteCheckedExceptionStarts grid component.- Specified by:
startin interfaceGridComponent- Overrides:
startin classGridProcessorAdapter- Throws:
IgniteCheckedException- Throws in case of any errors.
-
cacheGroup
@Nullable public @Nullable CacheGroupContext cacheGroup(int grpId)
- Parameters:
grpId- Group ID.- Returns:
- Cache group.
-
cacheGroups
public Collection<CacheGroupContext> cacheGroups()
- Returns:
- Cache groups.
-
onKernalStart
public void onKernalStart(boolean active) throws IgniteCheckedExceptionCallback that notifies that kernal has successfully started, including all managers and processors.- Specified by:
onKernalStartin interfaceGridComponent- Overrides:
onKernalStartin classGridProcessorAdapter- Parameters:
active- Cluster active flag (note: should be used carefully since state can change concurrently).- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
awaitStarted
public void awaitStarted() throws IgniteCheckedExceptionAwait for local join finish and caches start.- Throws:
IgniteCheckedException- If failed to wait.
-
stop
public void stop(boolean cancel) throws IgniteCheckedExceptionStops grid component.- Specified by:
stopin interfaceGridComponent- Overrides:
stopin classGridProcessorAdapter- Parameters:
cancel- Iftrue, then all ongoing tasks or jobs for relevant components need to be cancelled.- Throws:
IgniteCheckedException- Thrown in case of any errors.
-
stopCaches
public void stopCaches(boolean cancel)
- Parameters:
cancel- Cancel.
-
blockGateways
public void blockGateways()
Blocks all available gateways
-
blockGateways
public List<GridCacheAdapter> blockGateways(Collection<Integer> cacheGrpIds)
Blocks (stops) cache gateway for caches according to givencacheGroupIds.- Parameters:
cacheGrpIds- Cache group ids for which cache gateway should be stopped.- Returns:
- Caches for which cache gateway is blocked (stopped).
-
onKernalStop
public void onKernalStop(boolean cancel)
Callback to notify that kernal is about to stop.- Specified by:
onKernalStopin interfaceGridComponent- Overrides:
onKernalStopin classGridProcessorAdapter- Parameters:
cancel- Flag indicating whether jobs should be canceled.
-
onKernalStopCaches
public void onKernalStopCaches(boolean cancel)
- Parameters:
cancel- Cancel.
-
onDisconnected
public void onDisconnected(IgniteFuture<?> reconnectFut) throws IgniteCheckedException
Client disconnected callback.- Specified by:
onDisconnectedin interfaceGridComponent- Overrides:
onDisconnectedin classGridProcessorAdapter- Parameters:
reconnectFut- Reconnect future.- Throws:
IgniteCheckedException- If failed.
-
onReconnected
public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted) throws IgniteCheckedException
Client reconnected callback.- Specified by:
onReconnectedin interfaceGridComponent- Overrides:
onReconnectedin classGridProcessorAdapter- Parameters:
clusterRestarted- Cluster restarted flag.- Returns:
- Future to wait before completing reconnect future.
- Throws:
IgniteCheckedException- If failed.
-
registrateProxyRestart
public void registrateProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, GridFutureAdapter<?> fut)
- Parameters:
reqs- Cache requests to start.fut- Completable future.
-
completeProxyRestart
public void completeProxyRestart(Map<String,DynamicCacheChangeRequest> reqs, AffinityTopologyVersion initVer, AffinityTopologyVersion doneVer)
- Parameters:
reqs- Cache requests to start.initVer- Init exchange version.doneVer- Finish excahnge vertison.
-
cacheNames
public Collection<String> cacheNames()
Gets a collection of currently started caches.- Returns:
- Collection of started cache names.
-
getOrStartPublicCache
public IgniteCacheProxy<?,?> getOrStartPublicCache(boolean start) throws IgniteCheckedException
Gets public cache that can be used for query execution. If cache isn't created on current node it will be started.- Parameters:
start- Start cache.- Returns:
- Cache or
nullif there is no suitable cache. - Throws:
IgniteCheckedException
-
publicCacheNames
public Collection<String> publicCacheNames()
Gets a collection of currently started public cache names.- Returns:
- Collection of currently started public cache names
-
publicAndDsCacheNames
public Collection<String> publicAndDsCacheNames()
Gets a collection of currently started public cache names.- Returns:
- Collection of currently started public cache names
-
cacheMode
public CacheMode cacheMode(String cacheName)
Gets cache mode.- Parameters:
cacheName- Cache name to check.- Returns:
- Cache mode.
-
localJoinCachesContext
@Nullable public @Nullable LocalJoinCachesContext localJoinCachesContext()
- Returns:
- Caches to be started when this node starts.
-
startCachesOnLocalJoin
public IgniteInternalFuture<?> startCachesOnLocalJoin(AffinityTopologyVersion exchTopVer, LocalJoinCachesContext locJoinCtx) throws IgniteCheckedException
- Parameters:
exchTopVer- Local join exchange future version.locJoinCtx- Local join cache context.- Throws:
IgniteCheckedException- If failed.
-
hasCachesReceivedFromJoin
public boolean hasCachesReceivedFromJoin(ClusterNode node)
- Parameters:
node- Joined node.- Returns:
Trueif there are new caches received from joined node.
-
startReceivedCaches
public Collection<DynamicCacheDescriptor> startReceivedCaches(UUID nodeId, AffinityTopologyVersion exchTopVer) throws IgniteCheckedException
Starts statically configured caches received from remote nodes during exchange.- Parameters:
nodeId- Joining node ID.exchTopVer- Current exchange version.- Returns:
- Started caches descriptors.
- Throws:
IgniteCheckedException- If failed.
-
prepareCacheStart
public void prepareCacheStart(DynamicCacheDescriptor desc, @Nullable @Nullable NearCacheConfiguration reqNearCfg, AffinityTopologyVersion exchTopVer, boolean disabledAfterStart, boolean clientCache) throws IgniteCheckedException
- Parameters:
desc- Cache descriptor.reqNearCfg- Near configuration if specified for client cache start request.exchTopVer- Current exchange version.disabledAfterStart- If true, then we will discard restarting state from proxies. If false then we will change state of proxies to restarting- Throws:
IgniteCheckedException- If failed.
-
shutdownNotFinishedRecoveryCaches
public void shutdownNotFinishedRecoveryCaches()
Stops all caches and groups, that was recovered, but not activated on node join. Such caches can remain only if it was filtered by node filter on current node. It's impossible to check whether current node is affinity node for given cache before join to topology.
-
preparePageStore
public void preparePageStore(DynamicCacheDescriptor desc, boolean affNode) throws IgniteCheckedException
Prepare page store for start cache.- Parameters:
desc- Cache descriptor.affNode-trueif it is affinity node for cache.- Throws:
IgniteCheckedException- if failed.
-
restartProxies
public void restartProxies()
Restarts proxies of caches if they was marked as restarting. Requires external synchronization - shouldn't be called concurrently with another caches restart.
-
resetRestartingProxies
public List<String> resetRestartingProxies()
Complete stopping of caches if they were marked as restarting but it failed.- Returns:
- Cache names of proxies which were restarted.
-
blockGateway
public void blockGateway(String cacheName, boolean stop, boolean restart)
- Parameters:
cacheName- Cache name.stop-Truefor stop cache,falsefor close cache.restart- Restart flag.
-
prepareCacheStop
public void prepareCacheStop(String cacheName, boolean callDestroy, boolean clearCache)
- Parameters:
cacheName- Cache name.callDestroy- Cache destroy flag. This flag is passed to theGridCacheManager.stop(boolean, boolean)method.clearCache- Cache data clear flag. Setting totruewill remove all cache data.
-
prepareCacheStop
public void prepareCacheStop(String cacheName, boolean callDestroy, boolean clearCache, boolean clearDbObjects)
- Parameters:
cacheName- Cache name.callDestroy- Cache destroy flag. This flag is passed to theGridCacheManager.stop(boolean, boolean)method.clearCache- Cache data clear flag. Setting totruewill remove all cache data.clearDbObjects- IffalseDB objects don't removed (used for cache.close() on client node).
-
onExchangeDone
public void onExchangeDone(AffinityTopologyVersion cacheStartVer, @Nullable @Nullable ExchangeActions exchActions, @Nullable @Nullable Throwable err)
Callback invoked when first exchange future for dynamic cache is completed.- Parameters:
cacheStartVer- Started caches version to create proxy for.exchActions- Change requests.err- Error.
-
completeCacheStartFuture
public void completeCacheStartFuture(DynamicCacheChangeRequest req, boolean success, @Nullable @Nullable Throwable err)
- Parameters:
req- Request to complete future for.success- Future result.err- Error if any.
-
discoveryDataType
@Nullable public @Nullable GridComponent.DiscoveryDataExchangeType discoveryDataType()
Gets unique component type to distinguish components providing discovery data. Must return non-null value if component implements any of methodsGridComponent.collectJoiningNodeData(DiscoveryDataBag)orGridComponent.collectGridNodeData(DiscoveryDataBag).- Specified by:
discoveryDataTypein interfaceGridComponent- Overrides:
discoveryDataTypein classGridProcessorAdapter- Returns:
- Unique component type for discovery data exchange.
-
collectJoiningNodeData
public void collectJoiningNodeData(DiscoveryDataBag dataBag)
Collects discovery data on joining node before sendingTcpDiscoveryJoinRequestMessagerequest.- Specified by:
collectJoiningNodeDatain interfaceGridComponent- Overrides:
collectJoiningNodeDatain classGridProcessorAdapter- Parameters:
dataBag- container object to store discovery data in.
-
collectGridNodeData
public void collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receivingTcpDiscoveryNodeAddedMessage.- Specified by:
collectGridNodeDatain interfaceGridComponent- Overrides:
collectGridNodeDatain classGridProcessorAdapter- Parameters:
dataBag- container object to store discovery data in.
-
onJoiningNodeDataReceived
public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
Method is called on nodes that are already in grid (not on joining node). It receives discovery data from joining node.- Specified by:
onJoiningNodeDataReceivedin interfaceGridComponent- Overrides:
onJoiningNodeDataReceivedin classGridProcessorAdapter- Parameters:
data-DiscoveryDataBag.JoiningNodeDiscoveryDatainterface to retrieve discovery data of joining node.
-
onGridDataReceived
public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called on new node during discovery process).- Specified by:
onGridDataReceivedin interfaceGridComponent- Overrides:
onGridDataReceivedin classGridProcessorAdapter- Parameters:
data-DiscoveryDataBag.GridDiscoveryDatainterface to retrieve discovery data collected on remote nodes (data common for all nodes in grid and specific for each node).
-
validateNode
@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.- Specified by:
validateNodein interfaceGridComponent- Overrides:
validateNodein classGridProcessorAdapter- Parameters:
node- Joining node.discoData- Joining node discovery data.- Returns:
- Validation result or
nullin case of success.
-
onStateChangeFinish
public void onStateChangeFinish(ChangeGlobalStateFinishMessage msg)
- Parameters:
msg- Message.
-
onStateChangeRequest
public ExchangeActions onStateChangeRequest(ChangeGlobalStateMessage msg, AffinityTopologyVersion topVer, DiscoveryDataClusterState curState) throws IgniteCheckedException
- Parameters:
msg- Message.topVer- Current topology version.curState- Current cluster state.- Returns:
- Exchange actions.
- Throws:
IgniteCheckedException- If configuration validation failed.
-
onCacheStatisticsModeChange
public void onCacheStatisticsModeChange(CacheStatisticsModeChangeMessage msg)
Cache statistics flag change message received.- Parameters:
msg- Message.
-
processStatisticsModeChange
public void processStatisticsModeChange(CacheStatisticsModeChangeMessage msg)
Cache statistics flag change task processed by exchange worker.- Parameters:
msg- Message.
-
createFromTemplate
public IgniteInternalFuture<?> createFromTemplate(String cacheName)
Dynamically starts cache using template configuration.- Parameters:
cacheName- Cache name.- Returns:
- Future that will be completed when cache is deployed.
-
getOrCreateFromTemplate
public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName, boolean checkThreadTx)
Dynamically starts cache using template configuration.- Parameters:
cacheName- Cache name.checkThreadTx- Iftruechecks that current thread does not have active transactions.- Returns:
- Future that will be completed when cache is deployed.
-
getOrCreateFromTemplate
public IgniteInternalFuture<?> getOrCreateFromTemplate(String cacheName, String templateName, CacheConfigurationOverride cfgOverride, boolean checkThreadTx)
Dynamically starts cache using template configuration.- Parameters:
cacheName- Cache name.templateName- Cache template name.cfgOverride- Cache config properties to override.checkThreadTx- Iftruechecks that current thread does not have active transactions.- Returns:
- Future that will be completed when cache is deployed.
-
getConfigFromTemplate
public CacheConfiguration getConfigFromTemplate(String cacheName) throws IgniteCheckedException
- Parameters:
cacheName- Cache name.- Returns:
- Cache configuration, or
nullif no template with matching name found. - Throws:
IgniteCheckedException- If failed.
-
dynamicStartCache
public IgniteInternalFuture<Boolean> dynamicStartCache(@Nullable @Nullable CacheConfiguration ccfg, String cacheName, @Nullable @Nullable NearCacheConfiguration nearCfg, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)
Dynamically starts cache.- Parameters:
ccfg- Cache configuration.cacheName- Cache name.nearCfg- Near cache configuration.failIfExists- Fail if exists flag.failIfNotStarted- Iftruefails if cache is not started.checkThreadTx- Iftruechecks that current thread does not have active transactions.- Returns:
- Future that will be completed when cache is deployed.
-
dynamicStartSqlCache
public IgniteInternalFuture<Boolean> dynamicStartSqlCache(CacheConfiguration ccfg)
Dynamically starts cache as a result of SQLCREATE TABLEcommand.- Parameters:
ccfg- Cache configuration.
-
dynamicStartCache
public IgniteInternalFuture<Boolean> dynamicStartCache(@Nullable @Nullable CacheConfiguration ccfg, String cacheName, @Nullable @Nullable NearCacheConfiguration nearCfg, CacheType cacheType, boolean sql, boolean failIfExists, boolean failIfNotStarted, boolean checkThreadTx)
Dynamically starts cache.- Parameters:
ccfg- Cache configuration.cacheName- Cache name.nearCfg- Near cache configuration.cacheType- Cache type.sql- If the cache needs to be created as the result of SQLCREATE TABLEcommand.failIfExists- Fail if exists flag.failIfNotStarted- Iftruefails if cache is not started.checkThreadTx- Iftruechecks that current thread does not have active transactions.- Returns:
- Future that will be completed when cache is deployed.
-
checkReadOnlyState
public void checkReadOnlyState(String opName, CacheConfiguration... cfgs)
Checks that cluster in aClusterState.ACTIVE_READ_ONLYstate.- Parameters:
opName- Operation name.cfgs- Cache configurations.- Throws:
javax.cache.CacheException- If cluster in aClusterState.ACTIVE_READ_ONLYstate.
-
dynamicStartCaches
public IgniteInternalFuture<Boolean> dynamicStartCaches(Collection<CacheConfiguration> ccfgList, boolean failIfExists, boolean checkThreadTx, boolean disabledAfterStart)
Dynamically starts multiple caches.- Parameters:
ccfgList- Collection of cache configuration.failIfExists- Fail if exists flag.checkThreadTx- Iftruechecks that current thread does not have active transactions.disabledAfterStart- If true, cache proxies will be only activated afterrestartProxies().- Returns:
- Future that will be completed when all caches are deployed.
-
dynamicStartCachesByStoredConf
public IgniteInternalFuture<Boolean> dynamicStartCachesByStoredConf(Collection<StoredCacheData> storedCacheDataList, boolean failIfExists, boolean checkThreadTx, boolean disabledAfterStart, IgniteUuid restartId)
Dynamically starts multiple caches.- Parameters:
storedCacheDataList- Collection of stored cache data.failIfExists- Fail if exists flag.checkThreadTx- Iftruechecks that current thread does not have active transactions.disabledAfterStart- If true, cache proxies will be only activated afterrestartProxies().restartId- Restart requester id (it'll allow to start this cache only him).- Returns:
- Future that will be completed when all caches are deployed.
-
dynamicDestroyCache
public IgniteInternalFuture<Boolean> dynamicDestroyCache(String cacheName, boolean sql, boolean checkThreadTx, boolean restart, IgniteUuid restartId)
- Parameters:
cacheName- Cache name to destroy.sql- If the cache needs to be destroyed only if it was created as the result of SQLCREATE TABLEcommand.checkThreadTx- Iftruechecks that current thread does not have active transactions.restart- Restart flag.restartId- Restart requester id (it'll allow to start this cache only him).- Returns:
- Future that will be completed when cache is destroyed.
-
dynamicDestroyCaches
public IgniteInternalFuture<?> dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx)
- Parameters:
cacheNames- Collection of cache names to destroy.checkThreadTx- Iftruechecks that current thread does not have active transactions.- Returns:
- Future that will be completed when cache is destroyed.
-
dynamicDestroyCaches
public IgniteInternalFuture<?> dynamicDestroyCaches(Collection<String> cacheNames, boolean checkThreadTx, boolean destroy)
- Parameters:
cacheNames- Collection of cache names to destroy.checkThreadTx- Iftruechecks that current thread does not have active transactions.destroy- Cache data destroy flag. Setting totruewill cause removing all cache data- Returns:
- Future that will be completed when cache is destroyed.
-
createStopRequest
@NotNull public @NotNull DynamicCacheChangeRequest createStopRequest(String cacheName, boolean restart, IgniteUuid restartId, boolean destroy)
Prepares cache stop request.- Parameters:
cacheName- Cache names to destroy.restart- Restart flag.restartId- Restart requester id (it'll allow to start this cache only him).destroy- Cache data destroy flag. Setting totruewill cause removing all cache data from store.- Returns:
- Future that will be completed when cache is destroyed.
-
dynamicChangeCaches
@NotNull public @NotNull IgniteInternalFuture<?> dynamicChangeCaches(List<DynamicCacheChangeRequest> reqs)
Starts cache stop request as cache change batch.- Parameters:
reqs- cache stop requests.- Returns:
- compound future.
-
resetCacheState
public IgniteInternalFuture<?> resetCacheState(Collection<String> cacheNames) throws ClusterTopologyCheckedException
Resets cache state after the cache has been moved to recovery state.- Parameters:
cacheNames- Cache names.- Returns:
- Future that will be completed when state is changed for all caches.
- Throws:
ClusterTopologyCheckedException
-
finalizePartitionsCounters
public IgniteInternalFuture<?> finalizePartitionsCounters()
Finalizes partitions update counters.- Returns:
- Future that will be completed when state is changed for all caches.
-
cacheType
public CacheType cacheType(String cacheName)
- Parameters:
cacheName- Cache name.- Returns:
- Cache type.
-
isEncrypted
public boolean isEncrypted(int cacheGrpId)
- Returns:
Trueif cache groupcacheGrpIdis encrypted.Falseotherwise.
-
saveCacheConfiguration
public void saveCacheConfiguration(DynamicCacheDescriptor desc) throws IgniteCheckedException
Save cache configuration to persistent store if necessary.- Parameters:
desc- Cache descriptor.- Throws:
IgniteCheckedException
-
cleanupCachesDirectories
public void cleanupCachesDirectories() throws IgniteCheckedExceptionRemove all persistent files for all registered caches.- Throws:
IgniteCheckedException
-
onDiscoveryEvent
public void onDiscoveryEvent(int type, @Nullable @Nullable DiscoveryCustomMessage customMsg, ClusterNode node, AffinityTopologyVersion topVer, DiscoveryDataClusterState state)- Parameters:
type- Event type.customMsg- Custom message instance.node- Event node.topVer- Topology version.state- Cluster state.
-
onCustomEvent
public boolean onCustomEvent(DiscoveryCustomMessage msg, AffinityTopologyVersion topVer, ClusterNode node)
Callback invoked from discovery thread when discovery custom message is received.- Parameters:
msg- Customer message.topVer- Current topology version.node- Node sent message.- Returns:
Trueif minor topology version should be increased.
-
validateNode
@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node)
Validates that new node can join grid topology, this method is called on coordinator node before new node joins topology.- Specified by:
validateNodein interfaceGridComponent- Overrides:
validateNodein classGridProcessorAdapter- Parameters:
node- Joining node.- Returns:
- Validation result or
nullin case of success.
-
isCacheRestarting
public boolean isCacheRestarting(String cacheName)
- Parameters:
cacheName- Cache to check.- Returns:
- Cache is under restarting.
-
keepStaticCacheConfiguration
public boolean keepStaticCacheConfiguration()
- Returns:
- Keep static cache configuration flag. If
true, static cache configuration will override configuration persisted on disk.
-
cache
@Nullable public <K,V> @Nullable IgniteInternalCache<K,V> cache(String name)
- Type Parameters:
K- type of keys.V- type of values.- Parameters:
name- Cache name.- Returns:
- Cache instance for given name.
-
completeProxyInitialize
public void completeProxyInitialize(String name)
- Parameters:
name- Cache name.
-
getOrStartCache
public <K,V> IgniteInternalCache<K,V> getOrStartCache(String name) throws IgniteCheckedException
- Parameters:
name- Cache name.- Returns:
- Cache instance for given name.
- Throws:
IgniteCheckedException- If failed.
-
getOrStartCache
public <K,V> IgniteInternalCache<K,V> getOrStartCache(String name, CacheConfiguration ccfg) throws IgniteCheckedException
- Parameters:
name- Cache name.- Returns:
- Cache instance for given name.
- Throws:
IgniteCheckedException- If failed.
-
caches
public Collection<IgniteInternalCache<?,?>> caches()
- Returns:
- All configured cache instances.
-
jcaches
public Collection<IgniteCacheProxy<?,?>> jcaches()
- Returns:
- All configured cache instances.
-
utilityCache
public <K,V> IgniteInternalCache<K,V> utilityCache()
Gets utility cache.- Returns:
- Utility cache.
-
publicCache
public <K,V> IgniteInternalCache<K,V> publicCache(String name)
- Type Parameters:
K- type of keys.V- type of values.- Parameters:
name- Cache name.- Returns:
- Cache instance for given name.
- Throws:
IllegalArgumentException- If cache not exists.
-
publicJCache
public <K,V> IgniteCacheProxy<K,V> publicJCache(String cacheName) throws IgniteCheckedException
- Type Parameters:
K- type of keys.V- type of values.- Parameters:
cacheName- Cache name.- Returns:
- Cache instance for given name.
- Throws:
IgniteCheckedException- If failed.
-
publicJCache
@Nullable public <K,V> @Nullable IgniteCacheProxy<K,V> publicJCache(String cacheName, boolean failIfNotStarted, boolean checkThreadTx) throws IgniteCheckedException
- Parameters:
cacheName- Cache name.failIfNotStarted- IftruethrowsIllegalArgumentExceptionif cache is not started, otherwise returnsnullin this case.checkThreadTx- Iftruechecks that current thread does not have active transactions.- Returns:
- Cache instance for given name.
- Throws:
IgniteCheckedException- If failed.
-
cacheConfiguration
public CacheConfiguration cacheConfiguration(String name)
Get configuration for the given cache.- Parameters:
name- Cache name.- Returns:
- Cache configuration.
-
cacheDescriptor
public DynamicCacheDescriptor cacheDescriptor(String name)
Get registered cache descriptor.- Parameters:
name- Name.- Returns:
- Descriptor.
-
cacheDescriptors
public Map<String,DynamicCacheDescriptor> cacheDescriptors()
- Returns:
- Cache descriptors.
-
persistentCaches
public Collection<DynamicCacheDescriptor> persistentCaches()
- Returns:
- Collection of persistent cache descriptors.
-
persistentGroups
public Collection<CacheGroupDescriptor> persistentGroups()
- Returns:
- Collection of persistent cache group descriptors.
-
cacheGroupDescriptors
public Map<Integer,CacheGroupDescriptor> cacheGroupDescriptors()
- Returns:
- Cache group descriptors.
-
cacheGroupDescriptor
public CacheGroupDescriptor cacheGroupDescriptor(int grpId)
Tries to find cache group descriptor either in registered cache groups or in marked for deletion collection if cache group is considered to be stopped.- Parameters:
grpId- Group id.
-
cacheDescriptor
@Nullable public @Nullable DynamicCacheDescriptor cacheDescriptor(int cacheId)
- Parameters:
cacheId- Cache ID.- Returns:
- Cache descriptor.
-
addCacheConfiguration
public void addCacheConfiguration(CacheConfiguration cacheCfg) throws IgniteCheckedException
- Parameters:
cacheCfg- Cache configuration template.- Throws:
IgniteCheckedException- If failed.
-
jcache
public <K,V> IgniteCacheProxy<K,V> jcache(String name)
- Parameters:
name- Cache name.- Returns:
- Cache instance for given name.
-
jcacheProxy
@Nullable public @Nullable IgniteCacheProxyImpl<?,?> jcacheProxy(String name, boolean awaitInit)
- Parameters:
name- Cache name.awaitInit- Await proxy initialization.- Returns:
- Cache proxy.
-
addjCacheProxy
@Nullable public @Nullable IgniteCacheProxyImpl<?,?> addjCacheProxy(String name, IgniteCacheProxyImpl<?,?> proxy)
- Parameters:
name- Cache name.proxy- Cache proxy.- Returns:
- Previous cache proxy.
-
publicCaches
public Collection<IgniteCacheProxy<?,?>> publicCaches()
- Returns:
- All configured public cache instances.
-
internalCache
public <K,V> GridCacheAdapter<K,V> internalCache(String name)
- Type Parameters:
K- type of keys.V- type of values.- Parameters:
name- Cache name.- Returns:
- Cache instance for given name.
-
internalCaches
public Collection<GridCacheAdapter<?,?>> internalCaches()
- Returns:
- All internal cache instances.
-
systemCache
public boolean systemCache(String name)
- Parameters:
name- Cache name.- Returns:
Trueif specified cache is system,falseotherwise.
-
printMemoryStats
public void printMemoryStats()
Prints memory statistics (sizes of internal structures, etc.). NOTE: this method is for testing and profiling purposes only.- Specified by:
printMemoryStatsin interfaceGridComponent- Overrides:
printMemoryStatsin classGridProcessorAdapter
-
onUndeployed
public void onUndeployed(ClassLoader ldr)
Callback invoked by deployment manager for whenever a class loader gets undeployed.- Parameters:
ldr- Class loader.
-
context
public <K,V> GridCacheSharedContext<K,V> context()
- Returns:
- Shared context.
-
configManager
public GridLocalConfigManager configManager()
- Returns:
- Local config manager.
-
transactions
public IgniteTransactionsEx transactions()
- Returns:
- Transactions interface implementation.
-
enableStatistics
public void enableStatistics(Collection<String> cacheNames, boolean enabled) throws IgniteCheckedException
Enable/disable statistics globally for the caches- Parameters:
cacheNames- Collection of cache names.enabled- Statistics enabled flag.- Throws:
IgniteCheckedException
-
clearStatistics
public void clearStatistics(Collection<String> cacheNames) throws IgniteCheckedException
Clear statistics globally for the caches- Parameters:
cacheNames- Collection of cache names.- Throws:
IgniteCheckedException
-
clone
public <T> T clone(T obj) throws IgniteCheckedException- Parameters:
obj- Object to clone.- Returns:
- Object copy.
- Throws:
IgniteCheckedException- If failed.
-
splitter
public CacheConfigurationSplitter splitter()
- Returns:
- By default it returns splitter without old format configuration support.
-
enricher
public CacheConfigurationEnricher enricher()
- Returns:
- Cache configuration enricher.
-
stopWarmUp
public boolean stopWarmUp() throws IgniteCheckedExceptionStop warming up and current running strategy.- Returns:
trueif stopped by this call.- Throws:
IgniteCheckedException- If there is an error when stopping warm-up.
-
-