You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/05/18 11:31:18 UTC

[09/29] incubator-ignite git commit: # ignite-709_3 do not create system caches on client nodes

# ignite-709_3 do not create system caches on client nodes


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fb1d79cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fb1d79cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fb1d79cf

Branch: refs/heads/ignite-709_2
Commit: fb1d79cf17a8e4f27ebbfbf141ce6cfb3cda1ff6
Parents: db06cd3
Author: sboikov <sb...@gridgain.com>
Authored: Thu May 14 17:47:21 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu May 14 17:47:21 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheProcessor.java    | 32 +++++++++++++-------
 .../preloader/GridDhtPartitionDemandPool.java   |  4 +++
 2 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fb1d79cf/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 8771515..9319b45 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
@@ -734,12 +734,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         }
 
         if (marshallerCache() == null) {
-            assert ctx.config().isClientMode() : "Marshaller cache is missed on server node.";
-
-            // On client node use near-only marshaller cache.
-            IgniteInternalFuture<?> fut = startCacheAsync(CU.MARSH_CACHE_NAME, new NearCacheConfiguration(), false);
-
-            assert fut != null;
+            IgniteInternalFuture<?> fut = marshallerCacheAsync();
 
             fut.listen(new CI1<IgniteInternalFuture<?>>() {
                 @Override public void apply(IgniteInternalFuture<?> fut) {
@@ -790,12 +785,14 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         // Wait for caches in SYNC preload mode.
         for (GridCacheAdapter<?, ?> cache : caches.values()) {
-            CacheConfiguration cfg = cache.configuration();
+            if (cache.context().started()) {
+                CacheConfiguration cfg = cache.configuration();
 
-            if (cfg.getRebalanceMode() == SYNC) {
-                if (cfg.getCacheMode() == REPLICATED ||
-                    (cfg.getCacheMode() == PARTITIONED && cfg.getRebalanceDelay() >= 0))
-                    cache.preloader().syncFuture().get();
+                if (cfg.getRebalanceMode() == SYNC) {
+                    if (cfg.getCacheMode() == REPLICATED ||
+                        (cfg.getCacheMode() == PARTITIONED && cfg.getRebalanceDelay() >= 0))
+                        cache.preloader().syncFuture().get();
+                }
             }
         }
 
@@ -2553,6 +2550,19 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @return Utility cache start future.
+     */
+    public IgniteInternalFuture<?> marshallerCacheAsync() {
+        if (internalCache(CU.MARSH_CACHE_NAME) != null)
+            return new GridFinishedFuture<>();
+
+        assert ctx.config().isClientMode() : "Marshaller cache is missed on server node.";
+
+        // On client node use near-only marshaller cache.
+        return startCacheAsync(CU.MARSH_CACHE_NAME, new NearCacheConfiguration(), false);
+    }
+
+    /**
      * @param name Cache name.
      * @param <K> type of keys.
      * @param <V> type of values.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fb1d79cf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
index 633f237..ba2af9e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemandPool.java
@@ -824,6 +824,10 @@ public class GridDhtPartitionDemandPool<K, V> {
                         log.debug("Waiting for marshaller cache preload [cacheName=" + cctx.name() + ']');
 
                     try {
+                        cctx.kernalContext().cache().marshallerCacheAsync().get();
+
+                        cctx.kernalContext().cache().marshallerCache().context().awaitStarted();
+
                         cctx.kernalContext().cache().marshallerCache().preloader().syncFuture().get();
                     }
                     catch (IgniteInterruptedCheckedException ignored) {