ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [23/50] [abbrv] ignite git commit: Cleanup indexing twoStepCache on cache destroy.
Date Wed, 09 Mar 2016 09:27:38 GMT
Cleanup indexing twoStepCache on cache destroy.


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

Branch: refs/heads/ignite-1786
Commit: 4e108ad5194eb70671533ff4fe440a5963b72b85
Parents: a4391d7
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Mar 2 10:59:16 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Mar 2 10:59:16 2016 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   |  8 ++++
 .../cache/CacheQueryNewClientSelfTest.java      | 43 ++++++++++++--------
 2 files changed, 33 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/4e108ad5/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index a0e9c58..caf49e8 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -1626,6 +1626,14 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             catch (IgniteCheckedException e) {
                 U.error(log, "Failed to drop schema on cache stop (will ignore): " + U.maskName(ccfg.getName()),
e);
             }
+
+            for (Iterator<Map.Entry<T3<String, String, Boolean>, TwoStepCachedQuery>>
it = twoStepCache.entrySet().iterator();
+                 it.hasNext();) {
+                Map.Entry<T3<String, String, Boolean>, TwoStepCachedQuery> e
= it.next();
+
+                if (F.eq(e.getKey().get1(), ccfg.getName()))
+                    it.remove();
+            }
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/4e108ad5/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryNewClientSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryNewClientSelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryNewClientSelfTest.java
index 6e7a038..a9f5b51 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryNewClientSelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/CacheQueryNewClientSelfTest.java
@@ -54,39 +54,46 @@ public class CacheQueryNewClientSelfTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     public void testQueryFromNewClient() throws Exception {
-        Ignite server = startGrid("server");
+        Ignite srv = startGrid("server");
 
-        IgniteCache<Integer, Integer> cache1 = server.createCache(new CacheConfiguration<Integer,
Integer>().
-            setName("cache1").setIndexedTypes(Integer.class, Integer.class));
-        IgniteCache<Integer, Integer> cache2 = server.createCache(new CacheConfiguration<Integer,
Integer>().
-            setName("cache2").setIndexedTypes(Integer.class, Integer.class));
+        for (int iter = 0; iter < 2; iter++) {
+            log.info("Iteration: " + iter);
 
-        for (int i = 0; i < 10; i++) {
-            cache1.put(i, i);
-            cache2.put(i, i);
-        }
+            IgniteCache<Integer, Integer> cache1 = srv.createCache(new CacheConfiguration<Integer,
Integer>().
+                setName("cache1").setIndexedTypes(Integer.class, Integer.class));
+            IgniteCache<Integer, Integer> cache2 = srv.createCache(new CacheConfiguration<Integer,
Integer>().
+                setName("cache2").setIndexedTypes(Integer.class, Integer.class));
 
-        Ignition.setClientMode(true);
+            for (int i = 0; i < 10; i++) {
+                cache1.put(i, i);
+                cache2.put(i, i);
+            }
 
-        Ignite client = startGrid("client");
+            Ignition.setClientMode(true);
 
-        IgniteCache<Integer, Integer> cache = client.cache("cache1");
+            Ignite client = (iter == 0) ? startGrid("client") : grid("client");
 
-        List<List<?>> res = cache.query(new SqlFieldsQuery(
-            "select i1._val, i2._val from Integer i1 cross join \"cache2\".Integer i2")).getAll();
+            IgniteCache<Integer, Integer> cache = client.cache("cache1");
 
-        assertEquals(100, res.size());
+            List<List<?>> res = cache.query(new SqlFieldsQuery(
+                "select i1._val, i2._val from Integer i1 cross join \"cache2\".Integer i2")).getAll();
+
+            assertEquals(100, res.size());
+
+            srv.destroyCache(cache1.getName());
+            srv.destroyCache(cache2.getName());
+        }
     }
 
     /**
      * @throws Exception If failed.
      */
     public void testQueryFromNewClientCustomSchemaName() throws Exception {
-        Ignite server = startGrid("server");
+        Ignite srv = startGrid("server");
 
-        IgniteCache<Integer, Integer> cache1 = server.createCache(new CacheConfiguration<Integer,
Integer>().
+        IgniteCache<Integer, Integer> cache1 = srv.createCache(new CacheConfiguration<Integer,
Integer>().
             setName("cache1").setSqlSchema("cache1_sql").setIndexedTypes(Integer.class, Integer.class));
-        IgniteCache<Integer, Integer> cache2 = server.createCache(new CacheConfiguration<Integer,
Integer>().
+        IgniteCache<Integer, Integer> cache2 = srv.createCache(new CacheConfiguration<Integer,
Integer>().
             setName("cache2").setSqlSchema("cache2_sql").setIndexedTypes(Integer.class, Integer.class));
 
         for (int i = 0; i < 10; i++) {


Mime
View raw message