ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-6778 Fixed GridCacheDatabaseSharedManager#persistenceEnabled method usages
Date Fri, 03 Nov 2017 08:52:29 GMT
Repository: ignite
Updated Branches:
  refs/heads/master ef4d576b4 -> 221a55f46


IGNITE-6778 Fixed GridCacheDatabaseSharedManager#persistenceEnabled method usages


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

Branch: refs/heads/master
Commit: 221a55f4621a4f766ee7ed77f6a6bf4e3876671c
Parents: ef4d576
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Fri Nov 3 11:16:11 2017 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Fri Nov 3 11:16:11 2017 +0300

----------------------------------------------------------------------
 .../affinity/GridAffinityAssignmentCache.java   | 16 +++++++-
 .../cache/CacheAffinitySharedManager.java       |  3 +-
 .../processors/cache/CacheGroupContext.java     |  6 ++-
 .../processors/cache/GridCacheContext.java      |  4 +-
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../processors/cache/GridCacheProcessor.java    |  6 ++-
 .../cache/GridCacheSharedContext.java           |  2 +-
 .../processors/cache/GridCacheUtils.java        | 15 +++++++
 .../processors/cache/StoredCacheData.java       |  9 ++++
 .../distributed/dht/GridDhtLocalPartition.java  |  2 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |  2 +-
 .../dht/preloader/GridDhtPartitionDemander.java |  2 +-
 .../dht/preloader/GridDhtPartitionSupplier.java |  4 +-
 .../GridDhtPartitionsExchangeFuture.java        | 43 ++++++++++++--------
 .../dht/preloader/GridDhtPreloader.java         |  6 +--
 .../GridCacheDatabaseSharedManager.java         | 15 ++++---
 .../IgniteCacheDatabaseSharedManager.java       |  7 ----
 .../cluster/GridClusterStateProcessor.java      |  2 +-
 .../processors/query/GridQueryIndexing.java     |  4 +-
 .../processors/query/GridQueryProcessor.java    | 14 +++----
 ...IgniteClientCacheInitializationFailTest.java |  2 +-
 .../processors/query/h2/IgniteH2Indexing.java   | 11 +----
 22 files changed, 107 insertions(+), 70 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
index cbc4eae..c451b77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/affinity/GridAffinityAssignmentCache.java
@@ -589,8 +589,20 @@ public class GridAffinityAssignmentCache {
 
             IgniteInternalFuture<AffinityTopologyVersion> fut = readyFuture(topVer);
 
-            if (fut != null)
-                fut.get();
+            if (fut != null) {
+                Thread curTh = Thread.currentThread();
+
+                String threadName = curTh.getName();
+
+                try {
+                    curTh.setName(threadName + " (waiting " + topVer + ")");
+
+                    fut.get();
+                }
+                finally {
+                    curTh.setName(threadName);
+                }
+            }
         }
         catch (IgniteCheckedException e) {
             throw new IgniteException("Failed to wait for affinity ready future for topology
version: " + topVer,

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/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 efcb501..8441a5e 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
@@ -2594,8 +2594,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
      * @param sql SQL flag.
      */
     private void saveCacheConfiguration(CacheConfiguration<?, ?> cfg, boolean sql)
{
-        if (cctx.pageStore() != null && cctx.database().persistenceEnabled() &&
-            CU.isPersistentCache(cfg, cctx.gridConfig().getDataStorageConfiguration()) &&
+        if (cctx.pageStore() != null && CU.isPersistentCache(cfg, cctx.gridConfig().getDataStorageConfiguration())
&&
             !cctx.kernalContext().clientNode()) {
             try {
                 StoredCacheData data = new StoredCacheData(cfg);

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index 18acacf..d9523e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -342,7 +342,9 @@ public class CacheGroupContext {
     public GridCacheContext singleCacheContext() {
         List<GridCacheContext> caches = this.caches;
 
-        assert !sharedGroup() && caches.size() == 1 : ctx.kernalContext().isStopping();
+        assert !sharedGroup() && caches.size() == 1 :
+            "stopping=" +  ctx.kernalContext().isStopping() + ", groupName=" + ccfg.getGroupName()
+
+            ", caches=" + caches;
 
         return caches.get(0);
     }
@@ -484,7 +486,7 @@ public class CacheGroupContext {
      * @return {@code True} if fast eviction is allowed.
      */
     public boolean allowFastEviction() {
-        return ctx.database().persistenceEnabled() && !queriesEnabled();
+        return persistenceEnabled() && !queriesEnabled();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 34d3c97..3581f9f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -2038,9 +2038,9 @@ public class GridCacheContext<K, V> implements Externalizable
{
         boolean result = affinityNode() && rebalanceEnabled() && hasPartition(part,
affNodes, topVer);
 
         // When persistence is enabled, only reading from partitions with OWNING state is
allowed.
-        assert !result || !ctx.cache().context().database().persistenceEnabled() ||
+        assert !result || !group().persistenceEnabled() ||
             topology().partitionState(localNodeId(), part) == OWNING :
-            "result = " + result + ", persistenceEnabled = " + ctx.cache().context().database().persistenceEnabled()
+
+            "result = " + result + ", persistenceEnabled = " + group().persistenceEnabled()
+
                 ", partitionState = " + topology().partitionState(localNodeId(), part);
 
         return result;

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index e46e4d2..778a46e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2545,7 +2545,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
 
             boolean walEnabled = !cctx.isNear() && cctx.group().persistenceEnabled();
 
-            if (cctx.shared().database().persistenceEnabled()) {
+            if (cctx.group().persistenceEnabled()) {
                 unswap(false);
 
                 if (!isNew()) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/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 021807a..01d0d41 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
@@ -1026,7 +1026,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
                     assert desc != null : cctx.name();
 
-                    ctx.query().onCacheStop0(cctx.name(), false);
+                    boolean rmvIdx = !cache.context().group().persistenceEnabled();
+
+                    ctx.query().onCacheStop0(cctx.name(), rmvIdx);
                     ctx.query().onCacheStart0(cctx, desc.schema());
                 }
             }
@@ -1150,7 +1152,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         cache.stop();
 
-        ctx.kernalContext().query().onCacheStop(ctx, destroy);
+        ctx.kernalContext().query().onCacheStop(ctx, !cache.context().group().persistenceEnabled()
|| destroy);
 
         if (isNearEnabled(ctx)) {
             GridDhtCacheAdapter dht = ctx.near().dht();

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
index d8614b5..5bf1343 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java
@@ -206,7 +206,7 @@ public class GridCacheSharedContext<K, V> {
 
         locStoreCnt = new AtomicInteger();
 
-        if (dbMgr != null && dbMgr.persistenceEnabled())
+        if (dbMgr != null && CU.isPersistenceEnabled(kernalCtx.config()))
             dhtAtomicUpdCnt = new AtomicIntegerArray(kernalCtx.config().getSystemThreadPoolSize());
 
         msgLog = kernalCtx.log(CU.CACHE_MSG_LOG_CATEGORY);

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 1f289d0..53fb4d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1686,6 +1686,21 @@ public class GridCacheUtils {
         if (dsCfg == null)
             return false;
 
+        // Special handling for system cache is needed.
+        if (isSystemCache(ccfg.getName())) {
+            if (dsCfg.getDefaultDataRegionConfiguration().isPersistenceEnabled())
+                return true;
+
+            if (dsCfg.getDataRegionConfigurations() != null) {
+                for (DataRegionConfiguration drConf : dsCfg.getDataRegionConfigurations())
{
+                    if (drConf.isPersistenceEnabled())
+                        return true;
+                }
+            }
+
+            return false;
+        }
+
         String regName = ccfg.getDataRegionName();
 
         if (regName == null || regName.equals(dsCfg.getDefaultDataRegionConfiguration().getName()))

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
index 39c3cd1..5a88036 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/StoredCacheData.java
@@ -22,7 +22,9 @@ import java.util.Collection;
 import org.apache.ignite.cache.QueryEntity;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.A;
+import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.marshaller.jdk.JdkMarshaller;
 
 /**
@@ -36,9 +38,11 @@ public class StoredCacheData implements Serializable {
     private static final long serialVersionUID = 0L;
 
     /** Cache configuration. */
+    @GridToStringInclude
     private final CacheConfiguration<?, ?> ccfg;
 
     /** Query entities. */
+    @GridToStringInclude
     private Collection<QueryEntity> qryEntities;
 
     /** SQL flag - {@code true} if cache was created with {@code CREATE TABLE}. */
@@ -90,4 +94,9 @@ public class StoredCacheData implements Serializable {
     public void sql(boolean sql) {
         this.sql = sql;
     }
+
+    /** {@inheritDoc} */
+    @Override public String toString() {
+        return S.toString(StoredCacheData.class, this);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index cedd466..c813a57 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -500,7 +500,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl
implements
      * @return {@code true} if cas succeeds.
      */
     private boolean casState(long state, GridDhtPartitionState toState) {
-        if (ctx.database().persistenceEnabled() && grp.dataRegion().config().isPersistenceEnabled())
{
+        if (grp.persistenceEnabled()) {
             synchronized (this) {
                 boolean update = this.state.compareAndSet(state, setPartState(state, toState));
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 380066a..7abe09b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -1355,7 +1355,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology
{
 
                 GridDhtPartitionMap nodeMap = partMap.get(ctx.localNodeId());
 
-                if (nodeMap != null && ctx.database().persistenceEnabled() &&
readyTopVer.initialized()) {
+                if (nodeMap != null && grp.persistenceEnabled() && readyTopVer.initialized())
{
                     for (Map.Entry<Integer, GridDhtPartitionState> e : nodeMap.entrySet())
{
                         int p = e.getKey();
                         GridDhtPartitionState state = e.getValue();

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
index b0ac657..ed296cd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionDemander.java
@@ -517,7 +517,7 @@ public class GridDhtPartitionDemander {
 
         for (Integer part : parts) {
             try {
-                if (ctx.database().persistenceEnabled()) {
+                if (grp.persistenceEnabled()) {
                     if (partCntrs == null)
                         partCntrs = new HashMap<>(parts.size(), 1.0f);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
index e25ace7..6eb31ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionSupplier.java
@@ -304,12 +304,12 @@ class GridDhtPartitionSupplier {
                                 d.isHistorical(part) ? d.partitionCounter(part) : null);
 
                             if (!iter.historical()) {
-                                assert !grp.shared().database().persistenceEnabled() || !d.isHistorical(part);
+                                assert !grp.persistenceEnabled() || !d.isHistorical(part);
 
                                 s.clean(part);
                             }
                             else
-                                assert grp.shared().database().persistenceEnabled() &&
d.isHistorical(part);
+                                assert grp.persistenceEnabled() && d.isHistorical(part);
                         }
                         else
                             iter = (IgniteRebalanceIterator)sctx.entryIt;

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index abfefe8..d29293e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -711,12 +711,16 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
         List<T2<DynamicCacheDescriptor, NearCacheConfiguration>> caches =
             cctx.cache().cachesToStartOnLocalJoin();
 
-        if (cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode())
{
+        if (!cctx.kernalContext().clientNode()) {
             List<DynamicCacheDescriptor> startDescs = new ArrayList<>();
 
             if (caches != null) {
-                for (T2<DynamicCacheDescriptor, NearCacheConfiguration> c : caches)
-                    startDescs.add(c.get1());
+                for (T2<DynamicCacheDescriptor, NearCacheConfiguration> c : caches)
{
+                    DynamicCacheDescriptor startDesc = c.get1();
+
+                    if (CU.isPersistentCache(startDesc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration()))
+                        startDescs.add(startDesc);
+                }
             }
 
             cctx.database().readCheckpointAndRestoreMemory(startDescs);
@@ -805,11 +809,15 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             try {
                 cctx.activate();
 
-                if (cctx.database().persistenceEnabled() && !cctx.kernalContext().clientNode())
{
+                if (!cctx.kernalContext().clientNode()) {
                     List<DynamicCacheDescriptor> startDescs = new ArrayList<>();
 
-                    for (ExchangeActions.CacheActionData startReq : exchActions.cacheStartRequests())
-                        startDescs.add(startReq.descriptor());
+                    for (ExchangeActions.CacheActionData startReq : exchActions.cacheStartRequests())
{
+                        DynamicCacheDescriptor desc = startReq.descriptor();
+
+                        if (CU.isPersistentCache(desc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration()))
+                            startDescs.add(desc);
+                    }
 
                     cctx.database().readCheckpointAndRestoreMemory(startDescs);
                 }
@@ -2437,22 +2445,21 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
      *
      */
     private void assignPartitionsStates() {
-        if (cctx.database().persistenceEnabled()) {
-            for (Map.Entry<Integer, CacheGroupDescriptor> e : cctx.affinity().cacheGroups().entrySet())
{
-                if (e.getValue().config().getCacheMode() == CacheMode.LOCAL)
-                    continue;
+        for (Map.Entry<Integer, CacheGroupDescriptor> e : cctx.affinity().cacheGroups().entrySet())
{
+            CacheGroupDescriptor grpDesc = e.getValue();
+            if (grpDesc.config().getCacheMode() == CacheMode.LOCAL)
+                continue;
 
-                GridDhtPartitionTopology top;
+            if (!CU.isPersistentCache(grpDesc.config(), cctx.gridConfig().getDataStorageConfiguration()))
+                continue;
 
-                CacheGroupContext grpCtx = cctx.cache().cacheGroup(e.getKey());
+            CacheGroupContext grpCtx = cctx.cache().cacheGroup(e.getKey());
 
-                if (grpCtx != null)
-                    top = grpCtx.topology();
-                else
-                    top = cctx.exchange().clientTopology(e.getKey(), events().discoveryCache());
+            GridDhtPartitionTopology top = grpCtx != null ?
+                grpCtx.topology() :
+                cctx.exchange().clientTopology(e.getKey(), events().discoveryCache());
 
-                assignPartitionStates(top);
-            }
+            assignPartitionStates(top);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index c8d1041..0b499fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -220,7 +220,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
 
                 ClusterNode histSupplier = null;
 
-                if (ctx.database().persistenceEnabled() && exchFut != null) {
+                if (grp.persistenceEnabled() && exchFut != null) {
                     UUID nodeId = exchFut.partitionHistorySupplier(grp.groupId(), p);
 
                     if (nodeId != null)
@@ -235,7 +235,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
                         continue; // For.
                     }
 
-                    assert ctx.database().persistenceEnabled();
+                    assert grp.persistenceEnabled();
                     assert remoteOwners(p, topVer).contains(histSupplier) : remoteOwners(p,
topVer);
 
                     GridDhtPartitionDemandMessage msg = assigns.get(histSupplier);
@@ -250,7 +250,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
                     msg.addPartition(p, true);
                 }
                 else {
-                    if (ctx.database().persistenceEnabled()) {
+                    if (grp.persistenceEnabled()) {
                         if (part.state() == RENTING || part.state() == EVICTED) {
                             IgniteInternalFuture<?> rentFut = part.rent(false);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 2dcee89..e07aef7 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -893,11 +893,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
     }
 
     /** {@inheritDoc} */
-    @Override public boolean persistenceEnabled() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
     @Override public void onCacheGroupsStopped(
         Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps
     ) {
@@ -1980,6 +1975,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
         /** Shutdown now. */
         private volatile boolean shutdownNow;
 
+        /** */
+        private long lastCpTs;
+
         /**
          * @param gridName Grid name.
          * @param name Thread name.
@@ -2369,6 +2367,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
 
                 long cpTs = System.currentTimeMillis();
 
+                // This can happen in an unlikely event of two checkpoints happening
+                // within a currentTimeMillis() granularity window.
+                if (cpTs == lastCpTs)
+                    cpTs++;
+
+                lastCpTs = cpTs;
+
                 CheckpointEntry cpEntry = writeCheckpointEntry(
                     tmpWriteBuf,
                     cpTs,

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index f00edbe..8771f6a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -667,13 +667,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
         }
     }
 
-    /**
-     *
-     */
-    public boolean persistenceEnabled() {
-        return false;
-    }
-
     /** {@inheritDoc} */
     @Override public boolean checkpointLockIsHeldByThread() {
         return true;

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 3cd0451..927fd90 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -454,7 +454,7 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
 
         List<StoredCacheData> storedCfgs = null;
 
-        if (activate && sharedCtx.database().persistenceEnabled()) {
+        if (activate && CU.isPersistenceEnabled(ctx.config())) {
             try {
                 Map<String, StoredCacheData> cfgs = ctx.cache().context().pageStore().readCacheConfigurations();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
index b0a3831..7a5cbc7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java
@@ -195,10 +195,10 @@ public interface GridQueryIndexing {
      * Unregisters cache.
      *
      * @param cacheName Cache name.
-     * @param destroy Destroy flag.
+     * @param rmvIdx If {@code true}, will remove index.
      * @throws IgniteCheckedException If failed to drop cache schema.
      */
-    public void unregisterCache(String cacheName, boolean destroy) throws IgniteCheckedException;
+    public void unregisterCache(String cacheName, boolean rmvIdx) throws IgniteCheckedException;
 
     /**
      * Registers type if it was not known before or updates it otherwise.

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/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 4886b1b..aa947ff 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
@@ -846,9 +846,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
     /**
      * @param cctx Cache context.
-     * @param destroy Destroy flag.
+     * @param removeIdx If {@code true}, will remove index.
      */
-    public void onCacheStop(GridCacheContext cctx, boolean destroy) {
+    public void onCacheStop(GridCacheContext cctx, boolean removeIdx) {
         if (idx == null)
             return;
 
@@ -856,7 +856,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
             return;
 
         try {
-            onCacheStop0(cctx.name(), destroy);
+            onCacheStop0(cctx.name(), removeIdx);
         }
         finally {
             busyLock.leaveBusy();
@@ -1527,9 +1527,9 @@ public class GridQueryProcessor extends GridProcessorAdapter {
      * Use with {@link #busyLock} where appropriate.
      *
      * @param cacheName Cache name.
-     * @param destroy Destroy flag.
+     * @param rmvIdx If {@code true}, will remove index.
      */
-    public void onCacheStop0(String cacheName, boolean destroy) {
+    public void onCacheStop0(String cacheName, boolean rmvIdx) {
         if (idx == null)
             return;
 
@@ -1567,7 +1567,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
 
             // Notify indexing.
             try {
-                idx.unregisterCache(cacheName, destroy);
+                idx.unregisterCache(cacheName, rmvIdx);
             }
             catch (Exception e) {
                 U.error(log, "Failed to clear indexing on cache unregister (will ignore):
" + cacheName, e);
@@ -2558,7 +2558,7 @@ public class GridQueryProcessor extends GridProcessorAdapter {
     private void saveCacheConfiguration(DynamicCacheDescriptor desc) {
         GridCacheSharedContext cctx = ctx.cache().context();
 
-        if (cctx.pageStore() != null && cctx.database().persistenceEnabled() &&
!cctx.kernalContext().clientNode() &&
+        if (cctx.pageStore() != null && !cctx.kernalContext().clientNode() &&
             CU.isPersistentCache(desc.cacheConfiguration(), cctx.gridConfig().getDataStorageConfiguration()))
{
             CacheConfiguration cfg = desc.cacheConfiguration();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
index b0b758a..9126e96 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClientCacheInitializationFailTest.java
@@ -299,7 +299,7 @@ public class IgniteClientCacheInitializationFailTest extends GridCommonAbstractT
         }
 
         /** {@inheritDoc} */
-        @Override public void unregisterCache(String spaceName, boolean destroy) throws IgniteCheckedException
{
+        @Override public void unregisterCache(String spaceName, boolean rmvIdx) throws IgniteCheckedException
{
             // No-op
         }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/221a55f4/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 a861614..4a9faa1 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
@@ -2272,11 +2272,6 @@ public class IgniteH2Indexing implements GridQueryIndexing {
 
         mapQryExec.cancelLazyWorkers();
 
-        if (ctx != null && !ctx.cache().context().database().persistenceEnabled())
{
-            for (H2Schema schema : schemas.values())
-                schema.dropAll();
-        }
-
         for (Connection c : conns)
             U.close(c, log);
 
@@ -2334,7 +2329,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
     }
 
     /** {@inheritDoc} */
-    @Override public void unregisterCache(String cacheName, boolean destroy) {
+    @Override public void unregisterCache(String cacheName, boolean rmvIdx) {
         String schemaName = schema(cacheName);
 
         H2Schema schema = schemas.get(schemaName);
@@ -2352,9 +2347,7 @@ public class IgniteH2Indexing implements GridQueryIndexing {
             for (H2TableDescriptor tbl : schema.tables()) {
                 if (F.eq(tbl.cache().name(), cacheName)) {
                     try {
-                        boolean removeIdx = !ctx.cache().context().database().persistenceEnabled()
|| destroy;
-
-                        tbl.table().setRemoveIndexOnDestroy(removeIdx);
+                        tbl.table().setRemoveIndexOnDestroy(rmvIdx);
 
                         dropTable(tbl);
                     }


Mime
View raw message