ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject ignite git commit: IGNITE-5116: Fixed stale DML plan caching in DmlStatementsProcessor.
Date Fri, 05 May 2017 11:39:47 GMT
Repository: ignite
Updated Branches:
  refs/heads/master 1af98e9b5 -> cc2a6badb


IGNITE-5116: Fixed stale DML plan caching in DmlStatementsProcessor.


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

Branch: refs/heads/master
Commit: cc2a6badb4b3b5dc0e8b3247ddead2f6374bd2e4
Parents: 1af98e9
Author: Alexander Paschenko <alexander.a.paschenko@gmail.com>
Authored: Fri May 5 14:39:37 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Fri May 5 14:39:37 2017 +0300

----------------------------------------------------------------------
 .../query/h2/DmlStatementsProcessor.java        |  9 ++++++++
 .../processors/query/h2/IgniteH2Indexing.java   |  6 ++++--
 ...niteCacheAbstractInsertSqlQuerySelfTest.java |  3 ++-
 .../IgniteCacheInsertSqlQuerySelfTest.java      | 22 ++++++++++++++++++++
 4 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cc2a6bad/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
index 4194bc7..d4109f3 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/DmlStatementsProcessor.java
@@ -120,6 +120,15 @@ public class DmlStatementsProcessor {
     }
 
     /**
+     * Handle cache stop.
+     *
+     * @param spaceName Cache name.
+     */
+    public void onCacheStop(String spaceName) {
+        planCache.remove(spaceName);
+    }
+
+    /**
      * Execute DML statement, possibly with few re-attempts in case of concurrent data modifications.
      *
      * @param spaceName Space name.

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc2a6bad/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 f7466a8..d62d7d8 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
@@ -393,7 +393,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     protected volatile GridKernalContext ctx;
 
     /** */
-    private final DmlStatementsProcessor dmlProc = new DmlStatementsProcessor();
+    private DmlStatementsProcessor dmlProc;
 
     /** */
     private DdlStatementsProcessor ddlProc;
@@ -1737,7 +1737,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             cancel = new GridQueryCancel();
 
         QueryCursorImpl<List<?>> cursor = new QueryCursorImpl<>(
-            runQueryTwoStep(cctx, twoStepQry, cctx.keepBinary(), enforceJoinOrder, qry.getTimeout(),
cancel, 
+            runQueryTwoStep(cctx, twoStepQry, cctx.keepBinary(), enforceJoinOrder, qry.getTimeout(),
cancel,
                     qry.getArgs(), qry.getPartitions()),
             cancel);
 
@@ -2320,6 +2320,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
                 }
             }, CLEANUP_STMT_CACHE_PERIOD, CLEANUP_STMT_CACHE_PERIOD);
 
+            dmlProc = new DmlStatementsProcessor();
             ddlProc = new DdlStatementsProcessor();
 
             dmlProc.start(ctx, this);
@@ -2538,6 +2539,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
         if (rmv != null) {
             space2schema.remove(emptyIfNull(rmv.spaceName));
             mapQryExec.onCacheStop(spaceName);
+            dmlProc.onCacheStop(spaceName);
 
             rmv.onDrop();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc2a6bad/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 9dc982c..929f535 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
@@ -244,6 +244,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
         ignite(0).cache("K2P").clear();
         ignite(0).cache("K22P").clear();
         ignite(0).cache("I2I").clear();
+        ignite(0).cache("I2AT").clear();
 
         super.afterTest();
     }
@@ -295,7 +296,7 @@ public abstract class IgniteCacheAbstractInsertSqlQuerySelfTest extends
GridComm
      * @param idxTypes Indexed types.
      * @return Cache configuration.
      */
-    private static CacheConfiguration cacheConfig(String name, boolean partitioned, boolean
escapeSql, Class<?>... idxTypes) {
+    static CacheConfiguration cacheConfig(String name, boolean partitioned, boolean escapeSql,
Class<?>... idxTypes) {
         return new CacheConfiguration(DEFAULT_CACHE_NAME)
             .setName(name)
             .setCacheMode(partitioned ? CacheMode.PARTITIONED : CacheMode.REPLICATED)

http://git-wip-us.apache.org/repos/asf/ignite/blob/cc2a6bad/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 27f9569..6bbd7e1 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
@@ -202,4 +202,26 @@ public class IgniteCacheInsertSqlQuerySelfTest extends IgniteCacheAbstractInsert
 
         assertEquals(resInner, res.innerTypeCol);
     }
+
+    /** */
+    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 IgniteCacheUpdateSqlQuerySelfTest.AllTypes(1L)));
+
+        p.destroy();
+
+        p = ignite(0).getOrCreateCache(cacheConfig("I2AT", true, false, Integer.class,
+            IgniteCacheUpdateSqlQuerySelfTest.AllTypes.class));
+
+        p.query(new SqlFieldsQuery("insert into AllTypes(_key, _val, dateCol) values (1,
?, null)")
+            .setArgs(new IgniteCacheUpdateSqlQuerySelfTest.AllTypes(1L)));
+
+        IgniteCacheUpdateSqlQuerySelfTest.AllTypes exp = new IgniteCacheUpdateSqlQuerySelfTest.AllTypes(1L);
+
+        exp.dateCol = null;
+
+        assertEquals(exp, p.get(1));
+    }
 }


Mime
View raw message