ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sevdoki...@apache.org
Subject [13/15] incubator-ignite git commit: # IGNITE-45 - Fixing examples.
Date Fri, 13 Mar 2015 09:52:20 GMT
# IGNITE-45 - Fixing examples.


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

Branch: refs/heads/ignite-45
Commit: eb2e68199907025545be1ad312364410f4cdbdcb
Parents: aa98990
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Thu Mar 12 22:30:02 2015 -0700
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Thu Mar 12 22:30:02 2015 -0700

----------------------------------------------------------------------
 examples/config/filesystem/example-igfs.xml     |  1 -
 .../datagrid/CachePopularNumbersExample.java    |  8 +++
 .../examples/datagrid/CacheQueryExample.java    |  1 +
 .../discovery/GridDiscoveryManager.java         | 10 +++-
 .../affinity/GridAffinityProcessor.java         |  4 +-
 .../processors/cache/GridCacheProcessor.java    | 24 +++++----
 .../cache/query/GridCacheQueryAdapter.java      |  1 -
 .../processors/igfs/IgfsDataManager.java        | 56 ++++++++++----------
 .../processors/igfs/IgfsMetaManager.java        | 43 +++++++--------
 .../internal/processors/igfs/IgfsProcessor.java | 43 ++++++++++-----
 .../processors/query/GridQueryProcessor.java    |  9 ++++
 11 files changed, 121 insertions(+), 79 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/examples/config/filesystem/example-igfs.xml
----------------------------------------------------------------------
diff --git a/examples/config/filesystem/example-igfs.xml b/examples/config/filesystem/example-igfs.xml
index d8ccd34..b2fc17f 100644
--- a/examples/config/filesystem/example-igfs.xml
+++ b/examples/config/filesystem/example-igfs.xml
@@ -119,7 +119,6 @@
                     <property name="atomicityMode" value="TRANSACTIONAL"/>
                     <property name="queryIndexEnabled" value="false"/>
                     <property name="writeSynchronizationMode" value="FULL_SYNC"/>
-                    <property name="distributionMode" value="PARTITIONED_ONLY"/>
                     <property name="backups" value="0"/>
                     <property name="affinityMapper">
                         <bean class="org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper">

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
index fcb09e1..addca78 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CachePopularNumbersExample.java
@@ -70,6 +70,14 @@ public class CachePopularNumbersExample {
 
             cfg.setCacheMode(CacheMode.PARTITIONED);
             cfg.setName(CACHE_NAME);
+            cfg.setQueryIndexEnabled(true);
+
+            CacheQueryConfiguration qCfg = new CacheQueryConfiguration();
+
+            qCfg.setIndexPrimitiveKey(true);
+            qCfg.setIndexPrimitiveValue(true);
+
+            cfg.setQueryConfiguration(qCfg);
 
             try (IgniteCache<Integer, Long> cache = ignite.createCache(cfg)) {
                 ClusterGroup prj = ignite.cluster().forCacheNodes(CACHE_NAME);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
index 6120cba..84c5dbf 100644
--- a/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/datagrid/CacheQueryExample.java
@@ -88,6 +88,7 @@ public class CacheQueryExample {
 
             cfg.setCacheMode(CacheMode.PARTITIONED);
             cfg.setName(CACHE_NAME);
+            cfg.setQueryIndexEnabled(true);
 
             try (IgniteCache<?, ?> cache = ignite.createCache(cfg)) {
                 // Populate cache.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 1543df2..4e1c5cf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -373,7 +373,8 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                     return;
                 }
 
-                if (topVer > 0 && (type == EVT_NODE_JOINED || type == EVT_NODE_FAILED
|| type == EVT_NODE_LEFT)) {
+                if (topVer > 0 && (type == EVT_NODE_JOINED || type == EVT_NODE_FAILED
|| type == EVT_NODE_LEFT ||
+                    type == DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT)) {
                     boolean set = updateTopologyVersionIfGreater(nextTopVer);
 
                     assert set : "Topology version has not been updated [this.topVer=" +
@@ -1264,6 +1265,13 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
         return topVer.get().topologyVersion();
     }
 
+    /**
+     * @return Topology version.
+     */
+    public AffinityTopologyVersion topologyVersionEx() {
+        return topVer.get();
+    }
+
     /** @return Event that represents a local node joined to topology. */
     public DiscoveryEvent localJoinEvent() {
         try {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
index d90aa81..a214257 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityProcessor.java
@@ -217,7 +217,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
         if (key == null)
             return null;
 
-        AffinityInfo affInfo = affinityCache(cacheName, new AffinityTopologyVersion(ctx.discovery().topologyVersion()));
+        AffinityInfo affInfo = affinityCache(cacheName, ctx.discovery().topologyVersionEx());
 
         if (affInfo == null || affInfo.mapper == null)
             return null;
@@ -252,7 +252,7 @@ public class GridAffinityProcessor extends GridProcessorAdapter {
      */
     private <K> Map<ClusterNode, Collection<K>> keysToNodes(@Nullable final
String cacheName,
         Collection<? extends K> keys) throws IgniteCheckedException {
-        return keysToNodes(cacheName, keys, new AffinityTopologyVersion(ctx.discovery().topologyVersion()));
+        return keysToNodes(cacheName, keys, ctx.discovery().topologyVersionEx());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/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 9d613a5..402a784 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
@@ -752,8 +752,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (ctx.config().isDaemon())
             return;
 
-        for (String cacheName : stopSeq)
-            stopCache(caches.get(cacheName), cancel);
+        for (String cacheName : stopSeq) {
+            GridCacheAdapter<?, ?> cache = caches.get(cacheName);
+
+            if (cache != null)
+                stopCache(cache, cancel);
+        }
 
         List<? extends GridCacheSharedManager<?, ?>> mgrs = sharedCtx.managers();
 
@@ -775,8 +779,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         if (ctx.config().isDaemon())
             return;
 
-        for (String cacheName : stopSeq)
-            onKernalStop(caches.get(cacheName), cancel);
+        for (String cacheName : stopSeq) {
+            GridCacheAdapter<?, ?> cache = caches.get(cacheName);
+
+            if (cache != null)
+                onKernalStop(cache, cancel);
+        }
 
         List<? extends GridCacheSharedManager<?, ?>> sharedMgrs = sharedCtx.managers();
 
@@ -869,13 +877,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 mgr.stop(cancel);
         }
 
-        try {
-            ctx.kernalContext().query().onCacheStopped(cache.context());
-        }
-        catch (IgniteCheckedException e) {
-            // TODO implement.
-            e.printStackTrace();
-        }
+        ctx.kernalContext().query().onCacheStopped(cache.context());
 
         U.stopLifecycleAware(log, lifecycleAwares(cache.configuration(), ctx.jta().tmLookup(),
             ctx.store().configuredStore()));

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
index 6e2e462..14f84f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryAdapter.java
@@ -122,7 +122,6 @@ public class GridCacheQueryAdapter<T> implements CacheQuery<T>
{
 
     /**
      * @param cctx Context.
-     * @param prjPred Cache projection filter.
      * @param type Query type.
      * @param log Logger.
      * @param pageSize Page size.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
index e3c2c0e..e238c15 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsDataManager.java
@@ -52,11 +52,9 @@ import java.util.concurrent.*;
 import java.util.concurrent.atomic.*;
 import java.util.concurrent.locks.*;
 
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.events.EventType.*;
 import static org.apache.ignite.internal.GridTopic.*;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.*;
-import static org.apache.ignite.internal.processors.cache.GridCacheUtils.*;
 import static org.apache.ignite.transactions.TransactionConcurrency.*;
 import static org.apache.ignite.transactions.TransactionIsolation.*;
 
@@ -74,7 +72,7 @@ public class IgfsDataManager extends IgfsManager {
     private GridCache<Object, Object> dataCache;
 
     /** */
-    private IgniteInternalFuture<?> dataCacheStartFut;
+    private CountDownLatch dataCacheStartLatch;
 
     /** Local IGFS metrics. */
     private IgfsLocalMetrics metrics;
@@ -138,13 +136,11 @@ public class IgfsDataManager extends IgfsManager {
      *
      */
     void awaitInit() {
-        if (!dataCacheStartFut.isDone()) {
-            try {
-                dataCacheStartFut.get();
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException(e);
-            }
+        try {
+            dataCacheStartLatch.await();
+        }
+        catch (InterruptedException e) {
+            throw new IgniteInterruptedException(e);
         }
     }
 
@@ -152,25 +148,7 @@ public class IgfsDataManager extends IgfsManager {
     @Override protected void start0() throws IgniteCheckedException {
         igfs = igfsCtx.igfs();
 
-        dataCachePrj = igfsCtx.kernalContext().cache().internalCache(igfsCtx.configuration().getDataCacheName());
-        dataCache = igfsCtx.kernalContext().cache().internalCache(igfsCtx.configuration().getDataCacheName());
-
-        dataCacheStartFut = igfsCtx.kernalContext().cache().internalCache(igfsCtx.configuration().getDataCacheName())
-            .preloader().startFuture();
-
-        if (dataCache.configuration().getAtomicityMode() != TRANSACTIONAL)
-            throw new IgniteCheckedException("Data cache should be transactional: " +
-                igfsCtx.configuration().getDataCacheName());
-
-        metrics = igfsCtx.igfs().localMetrics();
-
-        assert dataCachePrj != null;
-
-        CacheAffinityKeyMapper mapper = igfsCtx.kernalContext().cache()
-            .internalCache(igfsCtx.configuration().getDataCacheName()).configuration().getAffinityMapper();
-
-        grpSize = mapper instanceof IgfsGroupDataBlocksKeyMapper ?
-            ((IgfsGroupDataBlocksKeyMapper)mapper).groupSize() : 1;
+        dataCacheStartLatch = new CountDownLatch(1);
 
         grpBlockSize = igfsCtx.configuration().getBlockSize() * grpSize;
 
@@ -227,6 +205,26 @@ public class IgfsDataManager extends IgfsManager {
 
     /** {@inheritDoc} */
     @Override protected void onKernalStart0() throws IgniteCheckedException {
+        dataCachePrj = igfsCtx.kernalContext().cache().internalCache(igfsCtx.configuration().getDataCacheName());
+        dataCache = igfsCtx.kernalContext().cache().internalCache(igfsCtx.configuration().getDataCacheName());
+
+        metrics = igfsCtx.igfs().localMetrics();
+
+        assert dataCachePrj != null;
+
+        CacheAffinityKeyMapper mapper = igfsCtx.kernalContext().cache()
+            .internalCache(igfsCtx.configuration().getDataCacheName()).configuration().getAffinityMapper();
+
+        grpSize = mapper instanceof IgfsGroupDataBlocksKeyMapper ?
+            ((IgfsGroupDataBlocksKeyMapper)mapper).groupSize() : 1;
+
+        igfsCtx.kernalContext().cache().internalCache(igfsCtx.configuration().getDataCacheName()).preloader()
+            .startFuture().listen(new CI1<IgniteInternalFuture<Object>>() {
+            @Override public void apply(IgniteInternalFuture<Object> f) {
+                dataCacheStartLatch.countDown();
+            }
+        });
+
         new Thread(delWorker).start();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
index 53fadd9..834e8c0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsMetaManager.java
@@ -40,8 +40,8 @@ import org.jetbrains.annotations.*;
 import javax.cache.processor.*;
 import java.io.*;
 import java.util.*;
+import java.util.concurrent.*;
 
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
 import static org.apache.ignite.events.EventType.*;
 import static org.apache.ignite.internal.processors.igfs.IgfsFileInfo.*;
 import static org.apache.ignite.transactions.TransactionConcurrency.*;
@@ -59,7 +59,7 @@ public class IgfsMetaManager extends IgfsManager {
     private GridCache<Object, Object> metaCache;
 
     /** */
-    private IgniteInternalFuture<?> metaCacheStartFut;
+    private CountDownLatch metaCacheStartLatch;
 
     /** File ID to file info projection. */
     private GridCacheProjectionEx<IgniteUuid, IgfsFileInfo> id2InfoPrj;
@@ -86,41 +86,42 @@ public class IgfsMetaManager extends IgfsManager {
      *
      */
     void awaitInit() {
-        if (!metaCacheStartFut.isDone()) {
-            try {
-                metaCacheStartFut.get();
-            }
-            catch (IgniteCheckedException e) {
-                throw new IgniteException(e);
-            }
+        try {
+            metaCacheStartLatch.await();
+        }
+        catch (InterruptedException e) {
+            throw new IgniteInterruptedException(e);
         }
     }
 
     /** {@inheritDoc} */
     @Override protected void start0() throws IgniteCheckedException {
-        cfg = igfsCtx.configuration();
-
-        metaCache = igfsCtx.kernalContext().cache().cache(cfg.getMetaCacheName());
+        metaCacheStartLatch = new CountDownLatch(1);
 
-        metaCacheStartFut = igfsCtx.kernalContext().cache().internalCache(cfg.getMetaCacheName()).preloader()
-            .startFuture();
-
-        if (metaCache.configuration().getAtomicityMode() != TRANSACTIONAL)
-            throw new IgniteCheckedException("Meta cache should be transactional: " + cfg.getMetaCacheName());
+        cfg = igfsCtx.configuration();
 
         evts = igfsCtx.kernalContext().event();
 
         sampling = new IgfsSamplingKey(cfg.getName());
 
-        assert metaCache != null;
-
-        id2InfoPrj = (GridCacheProjectionEx<IgniteUuid, IgfsFileInfo>)metaCache.<IgniteUuid,
IgfsFileInfo>cache();
-
         log = igfsCtx.kernalContext().log(IgfsMetaManager.class);
     }
 
     /** {@inheritDoc} */
     @Override protected void onKernalStart0() throws IgniteCheckedException {
+        metaCache = igfsCtx.kernalContext().cache().cache(cfg.getMetaCacheName());
+
+        assert metaCache != null;
+
+        igfsCtx.kernalContext().cache().internalCache(cfg.getMetaCacheName()).preloader().startFuture()
+            .listen(new CI1<IgniteInternalFuture<Object>>() {
+                @Override public void apply(IgniteInternalFuture<Object> f) {
+                    metaCacheStartLatch.countDown();
+                }
+            });
+
+        id2InfoPrj = (GridCacheProjectionEx<IgniteUuid, IgfsFileInfo>)metaCache.<IgniteUuid,
IgfsFileInfo>cache();
+
         locNode = igfsCtx.kernalContext().discovery().localNode();
 
         // Start background delete worker.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
index 941eb80..fd59174 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsProcessor.java
@@ -18,7 +18,6 @@
 package org.apache.ignite.internal.processors.igfs;
 
 import org.apache.ignite.*;
-import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
 import org.apache.ignite.cluster.*;
 import org.apache.ignite.compute.*;
@@ -26,7 +25,6 @@ import org.apache.ignite.configuration.*;
 import org.apache.ignite.igfs.*;
 import org.apache.ignite.igfs.mapreduce.*;
 import org.apache.ignite.internal.*;
-import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.ipc.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -38,6 +36,7 @@ import java.util.*;
 import java.util.concurrent.*;
 
 import static org.apache.ignite.IgniteSystemProperties.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
 import static org.apache.ignite.cache.CacheMemoryMode.*;
 import static org.apache.ignite.cache.CacheMode.*;
 import static org.apache.ignite.igfs.IgfsMode.*;
@@ -262,26 +261,31 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
                 throw new IgniteCheckedException("Duplicate IGFS name found (check configuration
and " +
                     "assign unique name to each): " + name);
 
-            GridCacheAdapter<Object, Object> dataCache = ctx.cache().internalCache(cfg.getDataCacheName());
+            CacheConfiguration dataCacheCfg = config(cfg.getDataCacheName());
+            CacheConfiguration metaCacheCfg = config(cfg.getMetaCacheName());
 
-            if (dataCache == null)
+            if (dataCacheCfg == null)
                 throw new IgniteCheckedException("Data cache is not configured locally for
IGFS: " + cfg);
 
-            if (dataCache.configuration().isQueryIndexEnabled())
+            if (dataCacheCfg.isQueryIndexEnabled())
                 throw new IgniteCheckedException("IGFS data cache cannot start with enabled
query indexing.");
 
-            GridCache<Object, Object> metaCache = ctx.cache().cache(cfg.getMetaCacheName());
+            if (dataCacheCfg.getAtomicityMode() != TRANSACTIONAL)
+                throw new IgniteCheckedException("Data cache should be transactional: " +
cfg.getDataCacheName());
 
-            if (metaCache == null)
+            if (metaCacheCfg == null)
                 throw new IgniteCheckedException("Metadata cache is not configured locally
for IGFS: " + cfg);
 
-            if (metaCache.configuration().isQueryIndexEnabled())
+            if (metaCacheCfg.isQueryIndexEnabled())
                 throw new IgniteCheckedException("IGFS metadata cache cannot start with enabled
query indexing.");
 
+            if (metaCacheCfg.getAtomicityMode() != TRANSACTIONAL)
+                throw new IgniteCheckedException("Meta cache should be transactional: " +
cfg.getMetaCacheName());
+
             if (F.eq(cfg.getDataCacheName(), cfg.getMetaCacheName()))
                 throw new IgniteCheckedException("Cannot use same cache as both data and
meta cache: " + cfg.getName());
 
-            if (!(dataCache.configuration().getAffinityMapper() instanceof IgfsGroupDataBlocksKeyMapper))
+            if (!(dataCacheCfg.getAffinityMapper() instanceof IgfsGroupDataBlocksKeyMapper))
                 throw new IgniteCheckedException("Invalid IGFS data cache configuration (key
affinity mapper class should be " +
                     IgfsGroupDataBlocksKeyMapper.class.getSimpleName() + "): " + cfg);
 
@@ -290,7 +294,7 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
             if (maxSpaceSize > 0) {
                 // Max space validation.
                 long maxHeapSize = Runtime.getRuntime().maxMemory();
-                long offHeapSize = dataCache.configuration().getOffHeapMaxMemory();
+                long offHeapSize = dataCacheCfg.getOffHeapMaxMemory();
 
                 if (offHeapSize < 0 && maxSpaceSize > maxHeapSize)
                     // Offheap is disabled.
@@ -303,15 +307,15 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
                         ", maxIgfsSpaceSize=" + maxSpaceSize + ']');
             }
 
-            if (dataCache.configuration().getCacheMode() == PARTITIONED) {
-                int backups = dataCache.configuration().getBackups();
+            if (dataCacheCfg.getCacheMode() == PARTITIONED) {
+                int backups = dataCacheCfg.getBackups();
 
                 if (backups != 0)
                     throw new IgniteCheckedException("IGFS data cache cannot be used with
backups (set backup count " +
                         "to 0 and restart the grid): " + cfg.getDataCacheName());
             }
 
-            if (cfg.getMaxSpaceSize() == 0 && dataCache.configuration().getMemoryMode()
== OFFHEAP_VALUES)
+            if (cfg.getMaxSpaceSize() == 0 && dataCacheCfg.getMemoryMode() == OFFHEAP_VALUES)
                 U.warn(log, "IGFS max space size is not specified but data cache values are
stored off-heap (max " +
                     "space will be limited to 80% of max JVM heap size): " + cfg.getName());
 
@@ -335,6 +339,19 @@ public class IgfsProcessor extends IgfsProcessorAdapter {
     }
 
     /**
+     * @param cacheName Cache name.
+     * @return Configuration.
+     */
+    private CacheConfiguration config(String cacheName) {
+        for (CacheConfiguration ccfg : ctx.config().getCacheConfiguration()) {
+            if (F.eq(cacheName, ccfg.getName()))
+                return ccfg;
+        }
+
+        return null;
+    }
+
+    /**
      * Check IGFS config on remote node.
      *
      * @param rmtNode Remote node.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eb2e6819/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index 202aed0..90cb4ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -171,6 +171,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
         try {
             idx.onCacheStopped(cctx);
+
+            Iterator<Map.Entry<TypeId, TypeDescriptor>> it = types.entrySet().iterator();
+
+            while (it.hasNext()) {
+                Map.Entry<TypeId, TypeDescriptor> entry = it.next();
+
+                if (F.eq(cctx.name(), entry.getKey().space))
+                    it.remove();
+            }
         }
         catch (IgniteCheckedException e) {
             U.error(log, "Failed to clear indexing on cache stop (will ignore): " + cctx.name(),
e);


Mime
View raw message