ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [47/50] [abbrv] ignite git commit: IGNITE-5291: Fixed DML statement cache cleanup on cache stop. This closes #2008.
Date Thu, 01 Jun 2017 13:24:02 GMT
IGNITE-5291: Fixed DML statement cache cleanup on cache stop. This closes #2008.


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

Branch: refs/heads/ignite-5267
Commit: 98c05a28d271109a910d0ebbe6292ea869dd199b
Parents: ccf3c9b
Author: Alexander Paschenko <alexander.a.paschenko@gmail.com>
Authored: Thu Jun 1 13:04:11 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Thu Jun 1 13:04:11 2017 +0300

----------------------------------------------------------------------
 .../processors/query/h2/IgniteH2Indexing.java   |  4 +-
 ...niteCacheAbstractInsertSqlQuerySelfTest.java | 42 +++++++++++---------
 .../IgniteCacheInsertSqlQuerySelfTest.java      | 30 ++++++--------
 3 files changed, 39 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/98c05a28/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 e192008..ca591c1 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
@@ -2119,10 +2119,12 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         H2Schema schema = dflt ? schemas.get(schemaName) : schemas.remove(schemaName);
 
         if (schema != null) {
-            cacheName2schema.remove(cacheName);
             mapQryExec.onCacheStop(cacheName);
             dmlProc.onCacheStop(cacheName);
 
+            // Remove this mapping only after callback to DML proc - it needs that mapping
internally
+            cacheName2schema.remove(cacheName);
+
             // Drop tables.
             Collection<H2TableDescriptor> rmvTbls = new HashSet<>();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/98c05a28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
index 929f535..eab00df 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractInsertSqlQuerySelfTest.java
@@ -105,6 +105,11 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
     /** {@inheritDoc} */
     @Override protected void beforeTestsStarted() throws Exception {
         startGridsMultiThreaded(3, false);
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
 
         if (!isBinaryMarshaller())
             createCaches();
@@ -118,19 +123,20 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
      *
      */
     void createCaches() {
-        ignite(0).createCache(cacheConfig("S2P", true, false, String.class, Person.class,
String.class, String.class));
-        ignite(0).createCache(cacheConfig("I2P", true, false, Integer.class, Person.class));
-        ignite(0).createCache(cacheConfig("K2P", true, false, Key.class, Person.class));
-        ignite(0).createCache(cacheConfig("K22P", true, true, Key2.class, Person2.class));
-        ignite(0).createCache(cacheConfig("I2I", true, false, Integer.class, Integer.class));
-        ignite(0).createCache(cacheConfig("U2I", true, false, UUID.class, Integer.class));
+        ignite(0).getOrCreateCache(cacheConfig("S2P", true, false, String.class, Person.class,
String.class,
+            String.class));
+        ignite(0).getOrCreateCache(cacheConfig("I2P", true, false, Integer.class, Person.class));
+        ignite(0).getOrCreateCache(cacheConfig("K2P", true, false, Key.class, Person.class));
+        ignite(0).getOrCreateCache(cacheConfig("K22P", true, true, Key2.class, Person2.class));
+        ignite(0).getOrCreateCache(cacheConfig("I2I", true, false, Integer.class, Integer.class));
+        ignite(0).getOrCreateCache(cacheConfig("U2I", true, false, UUID.class, Integer.class));
     }
 
     /**
      *
      */
     final void createBinaryCaches() {
-        ignite(0).createCache(cacheConfig("U2I", true, false, UUID.class, Integer.class));
+        ignite(0).getOrCreateCache(cacheConfig("U2I", true, false, UUID.class, Integer.class));
 
         {
             CacheConfiguration s2pCcfg = cacheConfig("S2P", true, false);
@@ -150,7 +156,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             s2pCcfg.setQueryEntities(Arrays.asList(s2p, s2s));
 
-            ignite(0).createCache(s2pCcfg);
+            ignite(0).getOrCreateCache(s2pCcfg);
         }
 
         {
@@ -169,7 +175,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             i2pCcfg.setQueryEntities(Collections.singletonList(i2p));
 
-            ignite(0).createCache(i2pCcfg);
+            ignite(0).getOrCreateCache(i2pCcfg);
         }
 
         {
@@ -191,7 +197,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             k2pCcfg.setQueryEntities(Collections.singletonList(k2p));
 
-            ignite(0).createCache(k2pCcfg);
+            ignite(0).getOrCreateCache(k2pCcfg);
         }
 
         {
@@ -214,7 +220,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             k22pCcfg.setQueryEntities(Collections.singletonList(k22p));
 
-            ignite(0).createCache(k22pCcfg);
+            ignite(0).getOrCreateCache(k22pCcfg);
         }
 
         {
@@ -228,7 +234,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
             i2iCcfg.setQueryEntities(Collections.singletonList(i2i));
 
-            ignite(0).createCache(i2iCcfg);
+            ignite(0).getOrCreateCache(i2iCcfg);
         }
     }
 
@@ -239,12 +245,12 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
 
     /** {@inheritDoc} */
     @Override protected void afterTest() throws Exception {
-        ignite(0).cache("S2P").clear();
-        ignite(0).cache("I2P").clear();
-        ignite(0).cache("K2P").clear();
-        ignite(0).cache("K22P").clear();
-        ignite(0).cache("I2I").clear();
-        ignite(0).cache("I2AT").clear();
+        ignite(0).destroyCache("S2P");
+        ignite(0).destroyCache("I2P");
+        ignite(0).destroyCache("K2P");
+        ignite(0).destroyCache("K22P");
+        ignite(0).destroyCache("I2I");
+        ignite(0).destroyCache("I2AT");
 
         super.afterTest();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/98c05a28/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
index 579432f..fbf01fa 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheInsertSqlQuerySelfTest.java
@@ -30,7 +30,7 @@ import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
 import org.apache.ignite.testframework.GridTestUtils;
 
-import static org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.*;
+import static org.apache.ignite.internal.processors.cache.IgniteCacheUpdateSqlQuerySelfTest.AllTypes;
 
 /**
  *
@@ -210,25 +210,19 @@ public class IgniteCacheInsertSqlQuerySelfTest extends IgniteCacheAbstractInsert
         assertEquals(resInner, res.innerTypeCol);
     }
 
-    /** */
+    /**
+     * Check that few sequential start-stops of the cache do not affect work of DML.
+     */
     public void testCacheRestartHandling() {
-        IgniteCache<Integer, IgniteCacheUpdateSqlQuerySelfTest.AllTypes> p = ignite(0).cache("I2AT");
-
-        p.query(new SqlFieldsQuery("insert into AllTypes(_key, _val) values (1, ?)")
-            .setArgs(new AllTypes(1L)));
-
-        p.destroy();
-
-        p = ignite(0).getOrCreateCache(cacheConfig("I2AT", true, false, Integer.class,
-            AllTypes.class));
-
-        p.query(new SqlFieldsQuery("insert into AllTypes(_key, _val, dateCol) values (1,
?, null)")
-            .setArgs(new AllTypes(1L)));
-
-        AllTypes exp = new AllTypes(1L);
+        for (int i = 0; i < 4; i++) {
+            IgniteCache<Integer, IgniteCacheUpdateSqlQuerySelfTest.AllTypes> p =
+                ignite(0).getOrCreateCache(cacheConfig("I2AT", true, false, Integer.class,
+                    IgniteCacheUpdateSqlQuerySelfTest.AllTypes.class));
 
-        exp.dateCol = null;
+            p.query(new SqlFieldsQuery("insert into AllTypes(_key, _val, dateCol) values
(1, ?, null)")
+                .setArgs(new IgniteCacheUpdateSqlQuerySelfTest.AllTypes(1L)));
 
-        assertEquals(exp, p.get(1));
+            p.destroy();
+        }
     }
 }


Mime
View raw message