ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [10/12] ignite git commit: IGNITE-6568: Fixed cache configuration persistence logic. This closes #2815.
Date Tue, 10 Oct 2017 11:40:20 GMT
IGNITE-6568: Fixed cache configuration persistence logic. This closes #2815.


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

Branch: refs/heads/ignite-3478
Commit: bf99fd3ab8a187ba901c75b7647c833758d0e18f
Parents: 5f67cf2
Author: Alexander Paschenko <alexander.a.paschenko@gmail.com>
Authored: Tue Oct 10 10:05:12 2017 +0300
Committer: devozerov <vozerov@gridgain.com>
Committed: Tue Oct 10 10:05:12 2017 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheAffinitySharedManager.java | 15 ++++++++-------
 .../internal/processors/cache/ClusterCachesInfo.java |  1 +
 .../processors/query/GridQueryProcessor.java         |  2 ++
 .../IgnitePersistentStoreSchemaLoadTest.java         |  2 ++
 4 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/bf99fd3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index 741e204..a413ade 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -2500,7 +2500,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
          * @param desc Description.
          */
         private DynamicCacheDescriptor registerCache(DynamicCacheDescriptor desc) {
-            saveCacheConfiguration(desc.cacheConfiguration());
+            saveCacheConfiguration(desc.cacheConfiguration(), desc.sql());
 
             return registeredCaches.put(desc.cacheId(), desc);
         }
@@ -2509,8 +2509,6 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
          * @param grpDesc Group description.
          */
         private CacheGroupDescriptor registerGroup(CacheGroupDescriptor grpDesc) {
-            saveCacheConfiguration(grpDesc.config());
-
             return registeredGrps.put(grpDesc.groupId(), grpDesc);
         }
 
@@ -2591,13 +2589,16 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
 
     /**
      * @param cfg cache configuration
+     * @param sql SQL flag.
      */
-    private void saveCacheConfiguration(CacheConfiguration<?, ?> cfg) {
+    private void saveCacheConfiguration(CacheConfiguration<?, ?> cfg, boolean sql)
{
         if (cctx.pageStore() != null && cctx.database().persistenceEnabled() &&
!cctx.kernalContext().clientNode()) {
             try {
-                cctx.pageStore().storeCacheData(
-                    new StoredCacheData(cfg),
-                    false);
+                StoredCacheData data = new StoredCacheData(cfg);
+
+                data.sql(sql);
+
+                cctx.pageStore().storeCacheData(data, false);
             }
             catch (IgniteCheckedException e) {
                 U.error(log(), "Error while saving cache configuration on disk, cfg = " +
cfg, e);

http://git-wip-us.apache.org/repos/asf/ignite/blob/bf99fd3a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 5e2c8db..b4cc9c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -1219,6 +1219,7 @@ class ClusterCachesInfo {
                         req.startCacheConfiguration(ccfg);
                         req.cacheType(ctx.cache().cacheType(ccfg.getName()));
                         req.schema(new QuerySchema(storedCfg.queryEntities()));
+                        req.sql(storedCfg.sql());
 
                         reqs.add(req);
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/bf99fd3a/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 0d8ee47..3a1cdb7 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
@@ -2564,6 +2564,8 @@ public class GridQueryProcessor extends GridProcessorAdapter {
                 if (desc.schema() != null)
                     data.queryEntities(desc.schema().entities());
 
+                data.sql(desc.sql());
+
                 cctx.pageStore().storeCacheData(data, true);
             }
             catch (IgniteCheckedException e) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/bf99fd3a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
index 85ce4d8..a408596 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/database/IgnitePersistentStoreSchemaLoadTest.java
@@ -208,6 +208,8 @@ public class IgnitePersistentStoreSchemaLoadTest extends GridCommonAbstractTest
         node.active(true);
 
         checkDynamicSchemaChanges(node, SQL_CACHE_NAME);
+
+        node.context().query().querySqlFieldsNoCache(new SqlFieldsQuery("drop table \"Person\""),
false).getAll();
     }
 
     /** */


Mime
View raw message