Repository: ignite Updated Branches: refs/heads/ignite-3477 c66bb4f8f -> 53b579f94
Need init page memory on clients for LOCAL caches. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/53b579f9 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/53b579f9 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/53b579f9 Branch: refs/heads/ignite-3477 Commit: 53b579f9487bb95b8b09064cd21087cb464bdf22 Parents: c66bb4f Author: sboikov <[email protected]> Authored: Fri Dec 30 13:59:39 2016 +0300 Committer: sboikov <[email protected]> Committed: Fri Dec 30 13:59:39 2016 +0300 ---------------------------------------------------------------------- .../processors/cache/GridCacheProcessor.java | 28 ++++++++++++-------- .../cache/IgniteCacheOffheapManagerImpl.java | 6 +++++ .../IgniteCacheDatabaseSharedManager.java | 16 ++++++++--- .../cluster/GridClusterStateProcessor.java | 9 ++++--- .../cache/CacheClientStoreSelfTest.java | 6 ++--- 5 files changed, 44 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/53b579f9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java index 4f299dd..53807f5 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java @@ -679,8 +679,11 @@ public class GridCacheProcessor extends GridProcessorAdapter { boolean template = cfg.getName() != null && cfg.getName().endsWith("*"); - DynamicCacheDescriptor desc = new DynamicCacheDescriptor( - ctx, cfg, cacheType, template, IgniteUuid.randomUuid()); + DynamicCacheDescriptor desc = new DynamicCacheDescriptor(ctx, + cfg, + cacheType, + template, + IgniteUuid.randomUuid()); desc.locallyConfigured(true); desc.staticallyConfigured(true); @@ -712,8 +715,11 @@ public class GridCacheProcessor extends GridProcessorAdapter { } if (cfg.getName() == null) { // Use cache configuration with null name as template. - DynamicCacheDescriptor desc0 = new DynamicCacheDescriptor( - ctx, cfg, cacheType, true, IgniteUuid.randomUuid()); + DynamicCacheDescriptor desc0 = new DynamicCacheDescriptor(ctx, + cfg, + cacheType, + true, + IgniteUuid.randomUuid()); desc0.locallyConfigured(true); desc0.staticallyConfigured(true); @@ -749,11 +755,11 @@ public class GridCacheProcessor extends GridProcessorAdapter { try { checkConsistency(); - boolean currentStatus = ctx.state().active(); + boolean currStatus = ctx.state().active(); - //if we start as inactive node, and join to active cluster, we must registrate all caches which - //was receive on join - if (!ctx.isDaemon() && currentStatus && !activeOnStart) { + // If we start as inactive node, and join to active cluster, we must register all caches + // which were received on join. + if (!ctx.isDaemon() && currStatus && !activeOnStart) { List<CacheConfiguration> tmpCacheCfg = new ArrayList<>(); for (CacheConfiguration conf : ctx.config().getCacheConfiguration()) { @@ -780,13 +786,13 @@ public class GridCacheProcessor extends GridProcessorAdapter { ctx.config().setCacheConfiguration(newCacheCfg); } - activeOnStart = currentStatus; + activeOnStart = currStatus; } if (activeOnStart && !ctx.clientNode() && !ctx.isDaemon()) sharedCtx.database().lock(); - //must start database before start first cache + // Must start database before start first cache. sharedCtx.database().onKernalStart(false); // Start dynamic caches received from collect discovery data. @@ -1409,7 +1415,7 @@ public class GridCacheProcessor extends GridProcessorAdapter { storeMgr.initialize(cfgStore, sesHolders); - boolean affNode = CU.affinityNode(ctx.discovery().localNode(), cfg.getNodeFilter()); + boolean affNode = cfg.getCacheMode() == LOCAL || CU.affinityNode(ctx.discovery().localNode(), cfg.getNodeFilter()); GridCacheContext<?, ?> cacheCtx = new GridCacheContext( ctx, http://git-wip-us.apache.org/repos/asf/ignite/blob/53b579f9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java index bfbc616..84d972f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java @@ -112,6 +112,12 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple indexingEnabled = GridQueryProcessor.isEnabled(cctx.config()); if (cctx.affinityNode()) { + if (cctx.kernalContext().clientNode()) { + assert cctx.isLocal() : cctx.name(); + + cctx.shared().database().init(); + } + cctx.shared().database().checkpointReadLock(); try { http://git-wip-us.apache.org/repos/asf/ignite/blob/53b579f9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java index 8f3b88a..18b3a1f 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/IgniteCacheDatabaseSharedManager.java @@ -53,9 +53,17 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap /** {@inheritDoc} */ @Override protected void start0() throws IgniteCheckedException { - MemoryConfiguration dbCfg = cctx.kernalContext().config().getMemoryConfiguration(); + if (!cctx.kernalContext().clientNode()) + init(); + } + + /** + * @throws IgniteCheckedException If failed. + */ + public void init() throws IgniteCheckedException { + if (pageMem == null) { + MemoryConfiguration dbCfg = cctx.kernalContext().config().getMemoryConfiguration(); - if (!cctx.kernalContext().clientNode()) { if (dbCfg == null) dbCfg = new MemoryConfiguration(); @@ -75,10 +83,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap } /** - * + * @throws IgniteCheckedException If failed. */ public void initDataBase() throws IgniteCheckedException{ - + // No-op. } /** http://git-wip-us.apache.org/repos/asf/ignite/blob/53b579f9/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java index 55061fc..d60243b 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java @@ -431,9 +431,10 @@ public class GridClusterStateProcessor extends GridProcessorAdapter { Collection<CacheConfiguration> cfgs = new ArrayList<>(); - for (DynamicCacheChangeRequest req : cgsCtx.batch.requests()) + for (DynamicCacheChangeRequest req : cgsCtx.batch.requests()) { if (req.startCacheConfiguration() != null) cfgs.add(req.startCacheConfiguration()); + } try { if (!client) { @@ -446,13 +447,15 @@ public class GridClusterStateProcessor extends GridProcessorAdapter { sharedCtx.database().initDataBase(); - for (CacheConfiguration cfg : cfgs) + for (CacheConfiguration cfg : cfgs) { if (CU.isSystemCache(cfg.getName())) sharedCtx.pageStore().initializeForCache(cfg); + } - for (CacheConfiguration cfg : cfgs) + for (CacheConfiguration cfg : cfgs) { if (!CU.isSystemCache(cfg.getName())) sharedCtx.pageStore().initializeForCache(cfg); + } sharedCtx.database().onActivate(ctx); } http://git-wip-us.apache.org/repos/asf/ignite/blob/53b579f9/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java index d2e90e5..5422c77 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheClientStoreSelfTest.java @@ -210,7 +210,7 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest { Ignite ignite = startGrid("client-1"); - IgniteCache cache = ignite.cache(CACHE_NAME); + IgniteCache<Object, Object> cache = ignite.cache(CACHE_NAME); cache.get(0); cache.getAll(F.asSet(0, 1)); @@ -242,7 +242,7 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest { Ignite client = startGrid("client-1"); - IgniteCache cache = client.cache(CACHE_NAME); + IgniteCache<Object, Object> cache = client.cache(CACHE_NAME); cache.loadCache(null); @@ -257,7 +257,7 @@ public class CacheClientStoreSelfTest extends GridCommonAbstractTest { /** * Load cache from server that created on client as LOCAL and see if it only loaded on server * - * @throws Exception + * @throws Exception If failed. */ public void testLocalLoadServer() throws Exception { cacheMode = CacheMode.LOCAL;
