ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [2/2] ignite git commit: ignite-5075
Date Thu, 18 May 2017 12:42:33 GMT
ignite-5075


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

Branch: refs/heads/ignite-5075
Commit: 3e4654c68c4032b525f5a0e665485bebfb835cf3
Parents: 8e70daf
Author: sboikov <sboikov@gridgain.com>
Authored: Thu May 18 12:27:28 2017 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Thu May 18 15:42:22 2017 +0300

----------------------------------------------------------------------
 .../ignite/codegen/MessageCodeGenerator.java    |  50 +------
 .../configuration/CacheConfiguration.java       |   3 +-
 .../internal/managers/discovery/DiscoCache.java |   2 +-
 .../discovery/GridDiscoveryManager.java         |  16 +--
 .../affinity/GridAffinityAssignmentCache.java   |   6 +-
 .../internal/processors/cache/CacheData.java    |   3 +-
 .../processors/cache/CacheGroupData.java        |  39 ++++--
 .../processors/cache/CacheGroupDescriptor.java  |  67 +++++++--
 .../cache/CacheGroupInfrastructure.java         | 136 +++++++++++--------
 .../cache/CacheNodeCommonDiscoveryData.java     |   8 ++
 .../processors/cache/ClusterCachesInfo.java     |  19 +--
 .../cache/ClusterCachesReconnectResult.java     |  13 +-
 .../cache/DynamicCacheDescriptor.java           |   1 +
 .../processors/cache/ExchangeActions.java       |  26 ++++
 .../processors/cache/GridCacheAttributes.java   |   3 +
 .../cache/GridCacheConcurrentMap.java           |   4 +-
 .../cache/GridCacheConcurrentMapImpl.java       |  16 ++-
 .../processors/cache/GridCacheContext.java      |  29 ++--
 .../processors/cache/GridCacheEntryInfo.java    |   1 +
 .../cache/GridCacheGroupIdMessage.java          |   2 +-
 .../processors/cache/GridCacheIdMessage.java    |   2 +-
 .../processors/cache/GridCacheMessage.java      |   1 +
 .../GridCachePartitionExchangeManager.java      |  24 ++--
 .../processors/cache/GridCachePreloader.java    |   2 +
 .../cache/GridCachePreloaderAdapter.java        |   1 -
 .../processors/cache/GridCacheProcessor.java    |  47 ++++---
 .../cache/IgniteCacheOffheapManager.java        |  25 +++-
 .../cache/database/CacheDataRowAdapter.java     |   3 +
 .../dht/GridCachePartitionedConcurrentMap.java  |   2 +-
 .../dht/GridDhtAssignmentFetchFuture.java       |   1 -
 .../distributed/dht/GridDhtLocalPartition.java  |  13 +-
 .../dht/GridDhtPartitionTopology.java           |   3 +-
 .../dht/GridDhtPartitionTopologyImpl.java       |  12 +-
 .../dht/preloader/GridDhtForceKeysFuture.java   |   1 +
 .../dht/preloader/GridDhtPartitionDemander.java |  21 +--
 .../dht/preloader/GridDhtPartitionSupplier.java |   4 +-
 .../GridDhtPartitionSupplyMessage.java          |   5 +-
 .../GridDhtPartitionsExchangeFuture.java        |  19 ++-
 .../GridDhtPartitionsSingleMessage.java         |   1 -
 .../GridCacheConditionalDeploymentSelfTest.java |   6 +
 .../processors/cache/IgniteCacheGroupsTest.java |  82 +++++++++--
 ...nabledMultiNodeWithGroupFullApiSelfTest.java |   3 +-
 .../loadtests/hashmap/GridCacheTestContext.java |   2 -
 43 files changed, 458 insertions(+), 266 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
index eb083da..99ec08a 100644
--- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
+++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java
@@ -44,25 +44,8 @@ import org.apache.ignite.internal.GridDirectCollection;
 import org.apache.ignite.internal.GridDirectMap;
 import org.apache.ignite.internal.GridDirectTransient;
 import org.apache.ignite.internal.IgniteCodeGeneratingFail;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
-import org.apache.ignite.internal.processors.cache.GridCacheGroupIdMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheIdMessage;
-import org.apache.ignite.internal.processors.cache.GridCacheMessage;
-import org.apache.ignite.internal.processors.cache.GridChangeGlobalStateMessageResponse;
-import org.apache.ignite.internal.processors.cache.distributed.GridDistributedTxFinishResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffinityAssignmentResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxFinishResponse;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxOnePhaseCommitAckRequest;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleMessage;
-import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsSingleRequest;
-import org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishResponse;
-import org.apache.ignite.internal.processors.cache.transactions.TxLocksRequest;
-import org.apache.ignite.internal.processors.cache.transactions.TxLocksResponse;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
 import org.apache.ignite.internal.util.typedef.internal.SB;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteUuid;
@@ -187,34 +170,7 @@ public class MessageCodeGenerator {
 
 //        gen.generateAll(true);
 
-        gen.generateAndWrite(GridCacheIdMessage.class);
-        gen.generateAndWrite(GridCacheGroupIdMessage.class);
-
-        gen.generateAndWrite(GridCacheEntryInfo.class);
-
-        gen.generateAndWrite(GridCacheMessage.class);
-
-        gen.generateAndWrite(GridDhtPartitionSupplyMessage.class);
-        gen.generateAndWrite(GridDhtPartitionDemandMessage.class);
-
-        gen.generateAndWrite(TxLocksRequest.class);
-        gen.generateAndWrite(TxLocksResponse.class);
-
-        gen.generateAndWrite(GridDhtTxOnePhaseCommitAckRequest.class);
-        gen.generateAndWrite(GridChangeGlobalStateMessageResponse.class);
-
-        gen.generateAndWrite(GridDhtPartitionsFullMessage.class);
-        gen.generateAndWrite(GridDhtPartitionsSingleMessage.class);
-        gen.generateAndWrite(GridDhtPartitionsSingleRequest.class);
-
-        gen.generateAndWrite(GridDhtAffinityAssignmentRequest.class);
-        gen.generateAndWrite(GridDhtAffinityAssignmentResponse.class);
-
-        gen.generateAndWrite(GridDistributedTxFinishResponse.class);
-        gen.generateAndWrite(GridDhtTxFinishResponse.class);
-        gen.generateAndWrite(GridNearTxFinishResponse.class);
-
-        gen.generateAndWrite(GridDhtPartitionsAbstractMessage.class);
+//        gen.generateAndWrite(GridChangeGlobalStateMessageResponse.class);
 
 //        gen.generateAndWrite(GridNearAtomicUpdateRequest.class);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
index 37c6127..5f44811 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/CacheConfiguration.java
@@ -201,7 +201,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
     /** Cache name. */
     private String name;
 
-    /** */
+    /** Cache group name. */
     private String grpName;
 
     /** Name of {@link MemoryPolicyConfiguration} for this cache */
@@ -456,6 +456,7 @@ public class CacheConfiguration<K, V> extends MutableConfiguration<K, V> {
         writeSync = cc.getWriteSynchronizationMode();
     }
 
+    // TODO IGNTIE-5075.
     public String getGroupName() {
         return grpName;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
index b9c7614..22c2d07 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/DiscoCache.java
@@ -91,7 +91,7 @@ public class DiscoCache {
      * @param allNodesWithCaches All nodes with at least one cache configured.
      * @param rmtNodesWithCaches Remote nodes with at least one cache configured.
      * @param allCacheNodes Cache nodes by cache name.
-     * @param cacheGrpAffNodes Affinity cache nodes by cache group ID.
+     * @param cacheGrpAffNodes Affinity nodes by cache group ID.
      * @param nodeMap Node map.
      * @param nearEnabledCaches Caches where at least one node has near cache enabled.
      * @param alives Alive nodes.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index ed013df..b1eb3de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -318,7 +318,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
      */
     public void addCacheGroup(CacheGroupDescriptor grpDesc, IgnitePredicate<ClusterNode> filter, CacheMode cacheMode) {
         CacheGroupAffinity old = registeredCacheGrps.put(grpDesc.groupId(),
-            new CacheGroupAffinity(grpDesc.groupName(), filter, cacheMode));
+            new CacheGroupAffinity(filter, cacheMode));
 
         assert old == null : old;
     }
@@ -1814,10 +1814,10 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
             snap.discoCache : discoCacheHist.get(topVer);
 
         if (cache == null) {
-            CacheGroupAffinity grpAff = registeredCacheGrps.get(grpId);
+            CacheGroupDescriptor desc = ctx.cache().cacheGroupDescriptors().get(grpId);
 
             throw new IgniteException("Failed to resolve nodes topology [" +
-                "cacheGrp=" + (grpAff != null ? grpAff.grpName : "N/A") +
+                "cacheGrp=" + (desc != null ? desc.cacheOrGroupName() : "N/A") +
                 ", topVer=" + topVer +
                 ", history=" + discoCacheHist.keySet() +
                 ", snap=" + snap +
@@ -2704,24 +2704,18 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
      *
      */
     private static class CacheGroupAffinity {
-        /** */
-        private final String grpName;
-
-        /** Cache filter. */
+        /** Nodes filter. */
         private final IgnitePredicate<ClusterNode> cacheFilter;
 
         /** Cache mode. */
         private final CacheMode cacheMode;
 
         /**
-         * @param grpName Group name.
          * @param cacheFilter Node filter.
          * @param cacheMode Cache mode.
          */
-        CacheGroupAffinity(String grpName,
-            IgnitePredicate<ClusterNode> cacheFilter,
+        CacheGroupAffinity(IgnitePredicate<ClusterNode> cacheFilter,
             CacheMode cacheMode) {
-            this.grpName = grpName;
             this.cacheFilter = cacheFilter;
             this.cacheMode = cacheMode;
         }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 48d7a44..88f8b7a 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
@@ -60,7 +60,7 @@ public class GridAffinityAssignmentCache {
     /** Cleanup history size. */
     private final int MAX_HIST_SIZE = getInteger(IGNITE_AFFINITY_HISTORY_SIZE, 500);
 
-    /** Group name. */
+    /** Group name if specified or cache name. */
     private final String cacheOrGrpName;
 
     /** Group ID. */
@@ -134,7 +134,7 @@ public class GridAffinityAssignmentCache {
         assert ctx != null;
         assert aff != null;
         assert nodeFilter != null;
-        assert grpId != 0;
+        assert grpId > 0;
 
         this.ctx = ctx;
         this.aff = aff;
@@ -463,7 +463,7 @@ public class GridAffinityAssignmentCache {
             if (cache == null) {
                 throw new IllegalStateException("Getting affinity for topology version earlier than affinity is " +
                     "calculated [locNode=" + ctx.discovery().localNode() +
-                    ", group=" + cacheOrGrpName +
+                    ", grp=" + cacheOrGrpName +
                     ", topVer=" + topVer +
                     ", head=" + head.get().topologyVersion() +
                     ", history=" + affCache.keySet() +

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheData.java
index c4207a9..a2a1ee1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheData.java
@@ -64,6 +64,7 @@ public class CacheData implements Serializable {
     /**
      * @param cacheCfg Cache configuration.
      * @param cacheId Cache ID.
+     * @param grpId Cache group ID.
      * @param cacheType Cache ID.
      * @param deploymentId Cache deployment ID.
      * @param schema Query schema.
@@ -86,7 +87,7 @@ public class CacheData implements Serializable {
         assert rcvdFrom != null : cacheCfg.getName();
         assert deploymentId != null : cacheCfg.getName();
         assert template || cacheId != 0 : cacheCfg.getName();
-        assert template || grpId != 0 : cacheCfg.getName();
+        assert template || grpId > 0 : cacheCfg.getName();
 
         this.cacheCfg = cacheCfg;
         this.cacheId = cacheId;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
index 96525a0..9c1afff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupData.java
@@ -35,13 +35,13 @@ public class CacheGroupData implements Serializable {
     private static final long serialVersionUID = 0L;
 
     /** */
-    private final String grpName;
+    private final int grpId;
 
     /** */
-    private final int grpId;
+    private final String grpName;
 
     /** */
-    private AffinityTopologyVersion startTopVer;
+    private final AffinityTopologyVersion startTopVer;
 
     /** */
     private final UUID rcvdFrom;
@@ -50,7 +50,7 @@ public class CacheGroupData implements Serializable {
     private final IgniteUuid deploymentId;
 
     /** */
-    private final CacheConfiguration cacheCfg;
+    private final CacheConfiguration<?, ?> cacheCfg;
 
     /** */
     @GridToStringInclude
@@ -61,6 +61,7 @@ public class CacheGroupData implements Serializable {
      * @param grpName Group name.
      * @param grpId  Group ID.
      * @param rcvdFrom Node ID cache group received from.
+     * @param startTopVer Start version for dynamically started group.
      * @param deploymentId Deployment ID.
      * @param caches Cache group caches.
      */
@@ -69,7 +70,7 @@ public class CacheGroupData implements Serializable {
         @Nullable String grpName,
         int grpId,
         UUID rcvdFrom,
-        AffinityTopologyVersion startTopVer,
+        @Nullable AffinityTopologyVersion startTopVer,
         IgniteUuid deploymentId,
         Map<String, Integer> caches) {
         assert cacheCfg != null;
@@ -85,34 +86,56 @@ public class CacheGroupData implements Serializable {
         this.caches = caches;
     }
 
-    public AffinityTopologyVersion startTopologyVersion() {
+    /**
+     * @return Start version for dynamically started group.
+     */
+    @Nullable public AffinityTopologyVersion startTopologyVersion() {
         return startTopVer;
     }
 
+    /**
+     * @return Node ID group was received from.
+     */
     public UUID receivedFrom() {
         return rcvdFrom;
     }
 
-    public String groupName() {
+    /**
+     * @return Group name.
+     */
+    @Nullable public String groupName() {
         return grpName;
     }
 
+    /**
+     * @return Group ID.
+     */
     public int groupId() {
         return grpId;
     }
 
+    /**
+     * @return Deployment ID.
+     */
     public IgniteUuid deploymentId() {
         return deploymentId;
     }
 
-    public CacheConfiguration config() {
+    /**
+     * @return Configuration.
+     */
+    public CacheConfiguration<?, ?> config() {
         return cacheCfg;
     }
 
+    /**
+     * @return Group caches.
+     */
     Map<String, Integer> caches() {
         return caches;
     }
 
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheGroupData.class, this);
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
index eb82992..7876792 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupDescriptor.java
@@ -33,29 +33,29 @@ import org.jetbrains.annotations.Nullable;
  */
 public class CacheGroupDescriptor {
     /** */
+    private final int grpId;
+
+    /** */
     private final String grpName;
 
     /** */
-    private final int grpId;
+    private final AffinityTopologyVersion startTopVer;
+
+    /** */
+    private final UUID rcvdFrom;
 
     /** */
     private final IgniteUuid deploymentId;
 
     /** */
     @GridToStringExclude
-    private final CacheConfiguration cacheCfg;
+    private final CacheConfiguration<?, ?> cacheCfg;
 
     /** */
     @GridToStringInclude
     private Map<String, Integer> caches;
 
     /** */
-    private final UUID rcvdFrom;
-
-    /** */
-    private AffinityTopologyVersion startTopVer;
-
-    /** */
     private AffinityTopologyVersion rcvdFromVer;
 
     /**
@@ -63,6 +63,7 @@ public class CacheGroupDescriptor {
      * @param grpName Group name.
      * @param grpId  Group ID.
      * @param rcvdFrom Node ID cache group received from.
+     * @param startTopVer Start version for dynamically started group.
      * @param deploymentId Deployment ID.
      * @param caches Cache group caches.
      */
@@ -71,7 +72,7 @@ public class CacheGroupDescriptor {
         @Nullable String grpName,
         int grpId,
         UUID rcvdFrom,
-        AffinityTopologyVersion startTopVer,
+        @Nullable AffinityTopologyVersion startTopVer,
         IgniteUuid deploymentId,
         Map<String, Integer> caches) {
         assert cacheCfg != null;
@@ -86,17 +87,27 @@ public class CacheGroupDescriptor {
         this.caches = caches;
     }
 
+    /**
+     * @return Node ID group was received from.
+     */
     public UUID receivedFrom() {
         return rcvdFrom;
     }
 
+    /**
+     * @return Deployment ID.
+     */
     public IgniteUuid deploymentId() {
         return deploymentId;
     }
 
+    /**
+     * @param cacheName Cache name
+     * @param cacheId Cache ID.
+     */
     void onCacheAdded(String cacheName, int cacheId) {
         assert cacheName != null;
-        assert cacheId != 0;
+        assert cacheId != 0 : cacheName;
 
         Map<String, Integer> caches = new HashMap<>(this.caches);
 
@@ -105,6 +116,10 @@ public class CacheGroupDescriptor {
         this.caches = caches;
     }
 
+    /**
+     * @param cacheName Cache name
+     * @param cacheId Cache ID.
+     */
     void onCacheStopped(String cacheName, int cacheId) {
         assert cacheName != null;
         assert cacheId != 0;
@@ -118,30 +133,51 @@ public class CacheGroupDescriptor {
         this.caches = caches;
     }
 
+    /**
+     * @return {@code True} if group contains cache.
+     */
     boolean hasCaches() {
         return caches != null && !caches.isEmpty();
     }
 
+    /**
+     * @return {@code True} if group can contain multiple caches.
+     */
     public boolean sharedGroup() {
         return grpName != null;
     }
 
+    /**
+     * @return Group name if it is specified, otherwise cache name.
+     */
     public String cacheOrGroupName() {
         return grpName != null ? grpName : cacheCfg.getName();
     }
 
-    public String groupName() {
+    /**
+     * @return Group name or {@code null} if group name was not specified for cache.
+     */
+    @Nullable public String groupName() {
         return grpName;
     }
 
+    /**
+     * @return Group ID.
+     */
     public int groupId() {
         return grpId;
     }
 
-    public CacheConfiguration config() {
+    /**
+     * @return Configuration.
+     */
+    public CacheConfiguration<?, ?> config() {
         return cacheCfg;
     }
 
+    /**
+     * @return Group caches.
+     */
     public Map<String, Integer> caches() {
         return caches;
     }
@@ -149,24 +185,25 @@ public class CacheGroupDescriptor {
     /**
      * @return Topology version when node provided cache configuration was started.
      */
-    @Nullable public AffinityTopologyVersion receivedFromStartVersion() {
+    @Nullable AffinityTopologyVersion receivedFromStartVersion() {
         return rcvdFromVer;
     }
 
     /**
      * @param rcvdFromVer Topology version when node provided cache configuration was started.
      */
-    public void receivedFromStartVersion(AffinityTopologyVersion rcvdFromVer) {
+    void receivedFromStartVersion(AffinityTopologyVersion rcvdFromVer) {
         this.rcvdFromVer = rcvdFromVer;
     }
 
     /**
-     * @return Start topology version.
+     * @return Start version for dynamically started group.
      */
     @Nullable public AffinityTopologyVersion startTopologyVersion() {
         return startTopVer;
     }
 
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheGroupDescriptor.class, this, "cacheName", cacheCfg.getName());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
index b744e2c..1e28144 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupInfrastructure.java
@@ -59,26 +59,47 @@ import static org.apache.ignite.internal.managers.communication.GridIoPolicy.AFF
  *
  */
 public class CacheGroupInfrastructure {
+    /** Group ID (can be changed after client reconnect). */
+    private int grpId;
+
+    /** Node ID cache group was received from. */
+    private final UUID rcvdFrom;
+
     /** */
-    private final IgniteLogger log;
+    private final AffinityTopologyVersion locStartVer;
 
     /** */
-    private GridAffinityAssignmentCache aff;
+    private final CacheConfiguration<?, ?> ccfg;
 
     /** */
-    private int grpId;
+    private final GridCacheSharedContext ctx;
 
     /** */
-    private UUID rcvdFrom;
+    private final boolean affNode;
 
     /** */
-    private final AffinityTopologyVersion locStartVer;
+    private final CacheType cacheType;
+
+    /** IO policy. */
+    private final byte ioPlc;
 
     /** */
-    private final CacheConfiguration ccfg;
+    private final boolean depEnabled;
 
     /** */
-    private final GridCacheSharedContext ctx;
+    private final boolean storeCacheId;
+
+    /** Flag indicating that this cache group is in a recovery mode due to partitions loss. */
+    private boolean needsRecovery;
+
+    /** */
+    private final List<GridCacheContext> caches;
+
+    /** */
+    private final IgniteLogger log;
+
+    /** */
+    private GridAffinityAssignmentCache aff;
 
     /** */
     private GridDhtPartitionTopologyImpl top;
@@ -86,13 +107,10 @@ public class CacheGroupInfrastructure {
     /** */
     private IgniteCacheOffheapManager offheapMgr;
 
-    /** Preloader. */
+    /** */
     private GridCachePreloader preldr;
 
     /** */
-    private final boolean affNode;
-
-    /** Memory policy. */
     private final MemoryPolicy memPlc;
 
     /** */
@@ -104,34 +122,21 @@ public class CacheGroupInfrastructure {
     /** ReuseList instance this group is associated with */
     private final ReuseList reuseList;
 
-    /** */
-    private final CacheType cacheType;
-
-    /** IO policy. */
-    private final byte ioPlc;
-
-    /** */
-    private boolean depEnabled;
-
-    /** */
-    private boolean storeCacheId;
-
-    /** Flag indicating that this cache is in a recovery mode. */
-    // TODO IGNITE-5075 see GridCacheContext#needsRecovery
-    private boolean needsRecovery;
-
-    /** */
-    private final List<GridCacheContext> caches;
-
     /**
      * @param grpId Group ID.
      * @param ctx Context.
+     * @param rcvdFrom Node ID cache group was received from.
      * @param cacheType Cache type.
      * @param ccfg Cache configuration.
      * @param affNode Affinity node flag.
+     * @param memPlc Memory policy.
      * @param cacheObjCtx Cache object context.
+     * @param freeList Free list.
+     * @param reuseList Reuse list.
+     * @param locStartVer Topology version when group was started on local node.
      */
-    CacheGroupInfrastructure(GridCacheSharedContext ctx,
+    CacheGroupInfrastructure(
+        GridCacheSharedContext ctx,
         int grpId,
         UUID rcvdFrom,
         CacheType cacheType,
@@ -142,7 +147,7 @@ public class CacheGroupInfrastructure {
         FreeList freeList,
         ReuseList reuseList,
         AffinityTopologyVersion locStartVer) {
-        assert grpId != 0 : "Invalid group ID [cache=" + ccfg.getName() + ", grpName=" + ccfg.getGroupName() + ']';
+        assert grpId > 0 : "Invalid group ID [cache=" + ccfg.getName() + ", grpName=" + ccfg.getGroupName() + ']';
         assert ccfg != null;
         assert memPlc != null || !affNode;
 
@@ -215,13 +220,28 @@ public class CacheGroupInfrastructure {
      * @param cctx Cache context.
      * @throws IgniteCheckedException If failed.
      */
-    public void onCacheStarted(GridCacheContext cctx) throws IgniteCheckedException {
+    void onCacheStarted(GridCacheContext cctx) throws IgniteCheckedException {
         addCacheContext(cctx);
 
         offheapMgr.onCacheStarted(cctx);
     }
 
     /**
+     * @param cacheName Cache name.
+     * @return {@code True} if group contains cache with given name.
+     */
+    public boolean hasCache(String cacheName) {
+        synchronized (caches) {
+            for (int i = 0; i < caches.size(); i++) {
+                if (caches.get(i).name().equals(cacheName))
+                    return true;
+            }
+
+            return false;
+        }
+    }
+
+    /**
      * @param cctx Cache context.
      */
     private void addCacheContext(GridCacheContext cctx) {
@@ -345,20 +365,26 @@ public class CacheGroupInfrastructure {
         }
     }
 
+    /**
+     * @param part Partition.
+     * @param key Key.
+     * @param evtNodeId Event node ID.
+     * @param type Event type.
+     * @param newVal New value.
+     * @param hasNewVal Has new value flag.
+     * @param oldVal Old values.
+     * @param hasOldVal Has old value flag.
+     * @param keepBinary Keep binary flag.
+     */
     public void addCacheEvent(
         int part,
         KeyCacheObject key,
         UUID evtNodeId,
-        @Nullable IgniteUuid xid,
-        @Nullable Object lockId,
         int type,
         @Nullable CacheObject newVal,
         boolean hasNewVal,
         @Nullable CacheObject oldVal,
         boolean hasOldVal,
-        UUID subjId,
-        @Nullable String cloClsName,
-        @Nullable String taskName,
         boolean keepBinary
     ) {
         synchronized (caches) {
@@ -368,26 +394,36 @@ public class CacheGroupInfrastructure {
                 cctx.events().addEvent(part,
                     key,
                     evtNodeId,
-                    xid,
-                    lockId,
+                    (IgniteUuid)null,
+                    null,
                     type,
                     newVal,
                     hasNewVal,
                     oldVal,
                     hasOldVal,
-                    subjId,
-                    cloClsName,
-                    taskName,
+                    null,
+                    null,
+                    null,
                     keepBinary);
             }
         }
     }
 
-    // TODO IGNITE-5075: need separate caches with/without queries?
+    // TODO IGNITE-5075
     public boolean queriesEnabled() {
         return QueryUtils.isEnabled(ccfg);
     }
 
+    // TODO IGNITE-5075 see GridCacheContext#allowFastEviction
+    public boolean allowFastEviction() {
+        return false;
+    }
+
+    // TODO IGNITE-5075.
+    public boolean isDrEnabled() {
+        return false;
+    }
+
     /**
      * @return Free List.
      */
@@ -461,11 +497,6 @@ public class CacheGroupInfrastructure {
         this.needsRecovery = needsRecovery;
     }
 
-    public boolean allowFastEviction() {
-        // TODO IGNITE-5075 see GridCacheContext#allowFastEviction
-        return false;
-    }
-
     /**
      * @return Topology version when group was started on local node.
      */
@@ -495,7 +526,7 @@ public class CacheGroupInfrastructure {
     }
 
     /**
-     * @return Group name.
+     * @return Group name or {@code null} if group name was not specified for cache.
      */
     @Nullable public String name() {
         return ccfg.getGroupName();
@@ -522,11 +553,6 @@ public class CacheGroupInfrastructure {
         return ccfg.getGroupName() != null;
     }
 
-    // TODO IGNITE-5075.
-    public boolean isDrEnabled() {
-        return false;
-    }
-
     /**
      *
      */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheNodeCommonDiscoveryData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheNodeCommonDiscoveryData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheNodeCommonDiscoveryData.java
index c799871..da6fc76 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheNodeCommonDiscoveryData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheNodeCommonDiscoveryData.java
@@ -51,6 +51,8 @@ class CacheNodeCommonDiscoveryData implements Serializable {
     /**
      * @param caches Started caches.
      * @param templates Configured templates.
+     * @param cacheGrps Started cache groups.
+     * @param cacheGrpIdGen Current counter for group ID assignment.
      * @param clientNodesMap Information about cache client nodes.
      */
     CacheNodeCommonDiscoveryData(Map<String, CacheData> caches,
@@ -71,10 +73,16 @@ class CacheNodeCommonDiscoveryData implements Serializable {
         this.clientNodesMap = clientNodesMap;
     }
 
+    /**
+     * @return Current counter for group ID assignment.
+     */
     int currentCacheGroupId() {
         return cacheGrpIdGen;
     }
 
+    /**
+     * @return Started cache groups.
+     */
     Map<Integer, CacheGroupData> cacheGroups() {
         return cacheGrps;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 c6cee00..830ce2c 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
@@ -46,7 +46,6 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.spi.discovery.DiscoveryDataBag;
-
 import org.jetbrains.annotations.Nullable;
 
 import static org.apache.ignite.cache.CacheMode.LOCAL;
@@ -691,6 +690,7 @@ class ClusterCachesInfo {
 
         assert cacheGrpIdGen > 0 : cacheGrpIdGen;
 
+        // Replace locally registered data with actual data received from cluster.
         registeredCaches.clear();
         registeredCacheGrps.clear();
         ctx.discovery().onLocalNodeJoin();
@@ -932,7 +932,7 @@ class ClusterCachesInfo {
 
     /**
      * @param grpName Group name.
-     * @return Group descriptor.
+     * @return Group descriptor if group found.
      */
     @Nullable private CacheGroupDescriptor cacheGroupByName(String grpName) {
         assert grpName != null;
@@ -961,17 +961,18 @@ class ClusterCachesInfo {
     }
 
     /**
-     * @param exchActions
-     * @param startedCacheCfg
-     * @param cacheId
-     * @param rcvdFrom
-     * @param deploymentId
-     * @return
+     * @param exchActions Optional exchange actions to update if new group was added.
+     * @param curTopVer Current topology version if dynamic cache started.
+     * @param startedCacheCfg Cache configuration.
+     * @param cacheId Cache ID.
+     * @param rcvdFrom Node ID cache was recived from.
+     * @param deploymentId Deployment ID.
+     * @return Group descriptor.
      */
     private CacheGroupDescriptor registerCacheGroup(
         @Nullable ExchangeActions exchActions,
         @Nullable AffinityTopologyVersion curTopVer,
-        CacheConfiguration startedCacheCfg,
+        CacheConfiguration<?, ?> startedCacheCfg,
         Integer cacheId,
         UUID rcvdFrom,
         IgniteUuid deploymentId) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesReconnectResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesReconnectResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesReconnectResult.java
index e204cac..42f203d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesReconnectResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesReconnectResult.java
@@ -17,10 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.internal.util.typedef.internal.S;
-
 import java.util.Map;
 import java.util.Set;
+import org.apache.ignite.internal.util.typedef.internal.S;
 
 /**
  *
@@ -38,6 +37,7 @@ class ClusterCachesReconnectResult {
     /**
      * @param stoppedCacheGrps Stopped cache groups.
      * @param stoppedCaches Stopped caches.
+     * @param newCacheGrpIds New cache group IDs.
      */
     ClusterCachesReconnectResult(Set<Integer> stoppedCacheGrps,
         Set<String> stoppedCaches,
@@ -47,14 +47,23 @@ class ClusterCachesReconnectResult {
         this.newCacheGrpIds = newCacheGrpIds;
     }
 
+    /**
+     * @return New cache group IDs.
+     */
     Map<Integer, Integer> newCacheGroupIds() {
         return newCacheGrpIds;
     }
 
+    /**
+     * @return Stopped cache groups.
+     */
     Set<Integer> stoppedCacheGroups() {
         return stoppedCacheGrps;
     }
 
+    /**
+     * @return Stopped caches.
+     */
     Set<String> stoppedCaches() {
         return stoppedCaches;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
index 01ac9ae..7f9148e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
@@ -97,6 +97,7 @@ public class DynamicCacheDescriptor {
      * @param ctx Context.
      * @param cacheCfg Cache configuration.
      * @param cacheType Cache type.
+     * @param grpDesc Group descriptor.
      * @param template {@code True} if this is template configuration.
      * @param rcvdFrom ID of node provided cache configuration
      * @param staticCfg {@code True} if cache statically configured.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
index dd4ce01..b878d38 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ExchangeActions.java
@@ -63,6 +63,8 @@ public class ExchangeActions {
     boolean clientOnlyExchange() {
         return F.isEmpty(cachesToStart) &&
             F.isEmpty(cachesToStop) &&
+            F.isEmpty(cacheGrpsToStart) &&
+            F.isEmpty(cacheGroupsToStop()) &&
             F.isEmpty(cachesToResetLostParts);
     }
 
@@ -294,17 +296,29 @@ public class ExchangeActions {
         cachesToResetLostParts = add(cachesToResetLostParts, req, desc);
     }
 
+    /**
+     * @param grpDesc Group descriptor.
+     */
     void addCacheGroupToStart(CacheGroupDescriptor grpDesc) {
+        assert grpDesc != null;
+
         if (cacheGrpsToStart == null)
             cacheGrpsToStart = new ArrayList<>();
 
         cacheGrpsToStart.add(grpDesc);
     }
 
+    /**
+     * @return Cache groups to start.
+     */
     public List<CacheGroupDescriptor> cacheGroupsToStart() {
         return cacheGrpsToStart != null ? cacheGrpsToStart : Collections.<CacheGroupDescriptor>emptyList();
     }
 
+    /**
+     * @param grpId Group ID.
+     * @return {@code True} if given cache group starting.
+     */
     public boolean cacheGroupStarting(int grpId) {
         if (cacheGrpsToStart != null) {
             for (CacheGroupDescriptor grp : cacheGrpsToStart) {
@@ -316,17 +330,29 @@ public class ExchangeActions {
         return false;
     }
 
+    /**
+     * @param grpDesc Group descriptor.
+     */
     void addCacheGroupToStop(CacheGroupDescriptor grpDesc) {
+        assert grpDesc != null;
+
         if (cacheGrpsToStop == null)
             cacheGrpsToStop = new ArrayList<>();
 
         cacheGrpsToStop.add(grpDesc);
     }
 
+    /**
+     * @return Cache groups to start.
+     */
     public List<CacheGroupDescriptor> cacheGroupsToStop() {
         return cacheGrpsToStop != null ? cacheGrpsToStop : Collections.<CacheGroupDescriptor>emptyList();
     }
 
+    /**
+     * @param grpId Group ID.
+     * @return {@code True} if given cache group stopping.
+     */
     public boolean cacheGroupStopping(int grpId) {
         if (cacheGrpsToStop != null) {
             for (CacheGroupDescriptor grp : cacheGrpsToStop) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
index ca640f2..a9ad353 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAttributes.java
@@ -279,6 +279,9 @@ public class GridCacheAttributes implements Serializable {
         return className(ccfg.getNodeFilter());
     }
 
+    /**
+     * @return Topology validator class name.
+     */
     String topologyValidatorClassName() {
         return className(ccfg.getTopologyValidator());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
index 48101d7..6a464d0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMap.java
@@ -30,14 +30,14 @@ public interface GridCacheConcurrentMap {
      * HashMap. Returns null if the HashMap contains no mapping
      * for this key.
      *
-     * @param ctx Context.
+     * @param ctx Cache context.
      * @param key Key.
      * @return Entry.
      */
     @Nullable public GridCacheMapEntry getEntry(GridCacheContext ctx, KeyCacheObject key);
 
     /**
-     * @param ctx Context.
+     * @param ctx Cache context.
      * @param topVer Topology version.
      * @param key Key.
      * @param create Create flag.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
index e1a1fa4..1faa596 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentMapImpl.java
@@ -69,8 +69,11 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM
         final boolean touch) {
         ConcurrentMap<KeyCacheObject, GridCacheMapEntry> map = entriesMap(ctx.cacheId(), create);
 
-        if (map == null)
+        if (map == null) {
+            assert !create;
+
             return null;
+        }
 
         GridCacheMapEntry cur = null;
         GridCacheMapEntry created = null;
@@ -205,7 +208,14 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM
         }
     }
 
-    protected abstract ConcurrentMap<KeyCacheObject, GridCacheMapEntry> entriesMap(int cacheId, boolean create);
+    /**
+     * @param cacheId Cache ID.
+     * @param create Create flag.
+     * @return Map for given cache ID.
+     */
+    @Nullable protected abstract ConcurrentMap<KeyCacheObject, GridCacheMapEntry> entriesMap(
+        int cacheId,
+        boolean create);
 
     /**
      *
@@ -238,7 +248,7 @@ public abstract class GridCacheConcurrentMapImpl implements GridCacheConcurrentM
 
         ConcurrentMap<KeyCacheObject, GridCacheMapEntry> map = entriesMap(ctx.cacheId(), false);
 
-        boolean rmv = map.remove(entry.key(), entry);
+        boolean rmv = map != null ? map.remove(entry.key(), entry) : null;
 
         if (rmv) {
             if (ctx.events().isRecordable(EVT_CACHE_ENTRY_DESTROYED)) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 92e002d..e5c47ab 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
@@ -135,6 +135,9 @@ public class GridCacheContext<K, V> implements Externalizable {
     /** Cache shared context. */
     private GridCacheSharedContext<K, V> sharedCtx;
 
+    /** Cache group. */
+    private CacheGroupInfrastructure grp;
+
     /** Logger. */
     private IgniteLogger log;
 
@@ -201,9 +204,6 @@ public class GridCacheContext<K, V> implements Externalizable {
     /** Cache type. */
     private CacheType cacheType;
 
-    /** */
-    private CacheGroupInfrastructure grp;
-
     /** IO policy. */
     private byte plc;
 
@@ -228,9 +228,6 @@ public class GridCacheContext<K, V> implements Externalizable {
     /** Topology version when cache was started on local node. */
     private AffinityTopologyVersion locStartTopVer;
 
-    /** */
-    private UUID rcvdFrom;
-
     /** Dynamic cache deployment ID. */
     private IgniteUuid dynamicDeploymentId;
 
@@ -263,6 +260,7 @@ public class GridCacheContext<K, V> implements Externalizable {
      * @param ctx Kernal context.
      * @param sharedCtx Cache shared context.
      * @param cacheCfg Cache configuration.
+     * @param grp Cache group.
      * @param cacheType Cache type.
      * @param affNode {@code True} if local node is affinity node.
      * @param updatesAllowed Updates allowed flag.
@@ -286,7 +284,6 @@ public class GridCacheContext<K, V> implements Externalizable {
         CacheGroupInfrastructure grp,
         CacheType cacheType,
         AffinityTopologyVersion locStartTopVer,
-        UUID rcvdFrom,
         boolean affNode,
         boolean updatesAllowed,
 
@@ -303,7 +300,6 @@ public class GridCacheContext<K, V> implements Externalizable {
         CacheDataStructuresManager dataStructuresMgr,
         GridCacheTtlManager ttlMgr,
         GridCacheDrManager drMgr,
-        IgniteCacheOffheapManager offheapMgr,
         CacheConflictResolutionManager<K, V> rslvrMgr,
         CachePluginManager pluginMgr,
         GridCacheAffinityManager affMgr
@@ -324,7 +320,6 @@ public class GridCacheContext<K, V> implements Externalizable {
         assert ttlMgr != null;
         assert rslvrMgr != null;
         assert pluginMgr != null;
-        assert offheapMgr != null;
 
         this.ctx = ctx;
         this.sharedCtx = sharedCtx;
@@ -332,7 +327,6 @@ public class GridCacheContext<K, V> implements Externalizable {
         this.grp = grp;
         this.cacheType = cacheType;
         this.locStartTopVer = locStartTopVer;
-        this.rcvdFrom = rcvdFrom;
         this.affNode = affNode;
         this.updatesAllowed = updatesAllowed;
         this.depEnabled = ctx.deploy().enabled() && !cacheObjects().isBinaryEnabled(cacheCfg);
@@ -373,12 +367,15 @@ public class GridCacheContext<K, V> implements Externalizable {
         itHolder = new CacheWeakQueryIteratorsHolder(log);
     }
 
+    /**
+     * @return Cache group ID.
+     */
     public int groupId() {
         return grp.groupId();
     }
 
     /**
-     * @return Cache group infrastructure.
+     * @return Cache group.
      */
     public CacheGroupInfrastructure group() {
         return grp;
@@ -458,13 +455,6 @@ public class GridCacheContext<K, V> implements Externalizable {
     }
 
     /**
-     * @return Node ID cache was received from.
-     */
-    public UUID receivedFrom() {
-        return rcvdFrom;
-    }
-
-    /**
      * @return Topology version when cache was started on local node.
      */
     public AffinityTopologyVersion startTopologyVersion() {
@@ -857,6 +847,9 @@ public class GridCacheContext<K, V> implements Externalizable {
         return topology(cache);
     }
 
+    /**
+     * @return DHT cache.
+     */
     public GridDhtCacheAdapter dhtCache() {
         GridCacheAdapter<K, V> cache = this.cache;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
index 852d95d..968d65d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryInfo.java
@@ -317,6 +317,7 @@ public class GridCacheEntryInfo implements Message {
     }
 
     /**
+     * @param ctx Cache object context.
      * @return Marshalled size.
      */
     public int marshalledSize(CacheObjectContext ctx) throws IgniteCheckedException {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
index 67ca115..09c143b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGroupIdMessage.java
@@ -24,7 +24,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 
 /**
- *
+ * Message related to particular cache group.
  */
 public abstract class GridCacheGroupIdMessage extends GridCacheMessage {
     /** Cache group ID. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
index f27f3c2..6c20bdd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIdMessage.java
@@ -24,7 +24,7 @@ import org.apache.ignite.plugin.extensions.communication.MessageReader;
 import org.apache.ignite.plugin.extensions.communication.MessageWriter;
 
 /**
- *
+ * Message related to particular cache.
  */
 public abstract class GridCacheIdMessage extends GridCacheMessage {
     /** Cache ID. */

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
index 6578bc8..11916e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMessage.java
@@ -280,6 +280,7 @@ public abstract class GridCacheMessage implements Message {
     /**
      * @param info Entry to marshal.
      * @param ctx Context.
+     * @param cacheObjCtx Cache object context.
      * @throws IgniteCheckedException If failed.
      */
     protected final void marshalInfo(GridCacheEntryInfo info,

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index 7351d26..ffbd090 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@ -94,7 +94,6 @@ import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.internal.util.worker.GridWorker;
 import org.apache.ignite.lang.IgniteBiInClosure;
-import org.apache.ignite.lang.IgniteInClosure;
 import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.thread.IgniteThread;
@@ -555,22 +554,22 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     }
 
     /**
-     * @param cacheId Cache ID.
+     * @param grpId Cache group ID.
      * @param exchFut Exchange future.
      * @return Topology.
      */
-    public GridDhtPartitionTopology clientTopology(int cacheId, GridDhtPartitionsExchangeFuture exchFut) {
-        GridClientPartitionTopology top = clientTops.get(cacheId);
+    public GridDhtPartitionTopology clientTopology(int grpId, GridDhtPartitionsExchangeFuture exchFut) {
+        GridClientPartitionTopology top = clientTops.get(grpId);
 
         if (top != null)
             return top;
 
         Object affKey = null;
 
-        DynamicCacheDescriptor desc = cctx.cache().cacheDescriptor(cacheId);
+        CacheGroupDescriptor grpDesc = cctx.cache().cacheGroupDescriptors().get(grpId);
 
-        if (desc != null) {
-            CacheConfiguration ccfg = desc.cacheConfiguration();
+        if (grpDesc != null) {
+            CacheConfiguration<?, ?> ccfg = grpDesc.config();
 
             AffinityFunction aff = ccfg.getAffinity();
 
@@ -580,8 +579,8 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
                 aff.partitions());
         }
 
-        GridClientPartitionTopology old = clientTops.putIfAbsent(cacheId,
-            top = new GridClientPartitionTopology(cctx, cacheId, exchFut, affKey));
+        GridClientPartitionTopology old = clientTops.putIfAbsent(grpId,
+            top = new GridClientPartitionTopology(cctx, grpId, exchFut, affKey));
 
         return old != null ? old : top;
     }
@@ -594,11 +593,11 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
     }
 
     /**
-     * @param cacheId Cache ID.
+     * @param grpId Cache group ID.
      * @return Client partition topology.
      */
-    public GridClientPartitionTopology clearClientTopology(int cacheId) {
-        return clientTops.remove(cacheId);
+    public GridClientPartitionTopology clearClientTopology(int grpId) {
+        return clientTops.remove(grpId);
     }
 
     /**
@@ -950,6 +949,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
         GridDhtPartitionFullMap map,
         Object affKey) {
         assert map != null;
+
         Integer dupDataCache = null;
 
         if (compress && affKey != null && !m.containsGroup(grpId)) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index 9b847b1..0ac0272 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -124,6 +124,7 @@ public interface GridCachePreloader {
     /**
      * Requests that preloader sends the request for the key.
      *
+     * @param cctx Cache context.
      * @param keys Keys to request.
      * @param topVer Topology version, {@code -1} if not required.
      * @return Future to complete when all keys are preloaded.
@@ -135,6 +136,7 @@ public interface GridCachePreloader {
     /**
      * Requests that preloader sends the request for the key.
      *
+     * @param cctx Cache context.
      * @param req Message with keys to request.
      * @param topVer Topology version, {@code -1} if not required.
      * @return Future to complete when all keys are preloaded.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index e0a6063..df563f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -21,7 +21,6 @@ import java.util.Collection;
 import java.util.UUID;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteLogger;
-import org.apache.ignite.cache.affinity.AffinityFunction;
 import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtFuture;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 1174728..662d558 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
@@ -173,6 +173,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     private GridCacheSharedContext<?, ?> sharedCtx;
 
     /** */
+    private final ConcurrentMap<Integer, CacheGroupInfrastructure> cacheGrps = new ConcurrentHashMap<>();
+
+    /** */
     private final Map<String, GridCacheAdapter<?, ?>> caches;
 
     /** Caches stopped from onKernalStop callback. */
@@ -208,9 +211,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     /** Internal cache names. */
     private final Set<String> internalCaches;
 
-    /** */
-    private ConcurrentMap<Integer, CacheGroupInfrastructure> cacheGrps = new ConcurrentHashMap<>();
-
     /**
      * @param ctx Kernal context.
      */
@@ -904,8 +904,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         for (int i = 0, size = syncFuts.size(); i < size; i++)
             syncFuts.get(i).get();
 
-        // TODO IGNITE-5075.
-        // assert ctx.config().isDaemon() || caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started";
+        assert ctx.config().isDaemon() || caches.containsKey(CU.UTILITY_CACHE_NAME) : "Utility cache should be started";
 
         if (!ctx.clientNode() && !ctx.isDaemon())
             addRemovedItemsCleanupTask(Long.getLong(IGNITE_CACHE_REMOVED_ENTRIES_TTL, 10_000));
@@ -1290,8 +1289,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         U.stopLifecycleAware(log, lifecycleAwares(cache.configuration(), ctx.store().configuredStore()));
 
-        if (log.isInfoEnabled())
-            log.info("Stopped cache: " + cache.name());
+        if (log.isInfoEnabled()) {
+            if (ctx.group().sharedGroup())
+                log.info("Stopped cache [cacheName=" + cache.name() + ", group=" + ctx.group().name() + ']');
+            else
+                log.info("Stopped cache [cacheName=" + cache.name() + ']');
+        }
 
         if (sharedCtx.pageStore() != null) {
             try {
@@ -1390,7 +1393,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
     /**
      * @param cfg Cache configuration to use to create cache.
-     * @param grp Cache group infrastructure.
+     * @param grp Cache group.
      * @param pluginMgr Cache plugin manager.
      * @param desc Cache descriptor.
      * @param locStartTopVer Current topology version.
@@ -1463,7 +1466,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         CacheConflictResolutionManager rslvrMgr = pluginMgr.createComponent(CacheConflictResolutionManager.class);
         GridCacheDrManager drMgr = pluginMgr.createComponent(GridCacheDrManager.class);
         CacheStoreManager storeMgr = pluginMgr.createComponent(CacheStoreManager.class);
-        IgniteCacheOffheapManager offheapMgr = pluginMgr.createComponent(IgniteCacheOffheapManager.class);
 
         storeMgr.initialize(cfgStore, sesHolders);
 
@@ -1474,10 +1476,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             grp,
             desc.cacheType(),
             locStartTopVer,
-            desc.receivedFrom(),
             affNode,
             updatesAllowed,
-
             /*
              * Managers in starting order!
              * ===========================
@@ -1490,7 +1490,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             dataStructuresMgr,
             ttlMgr,
             drMgr,
-            offheapMgr,
             rslvrMgr,
             pluginMgr,
             affMgr
@@ -1605,10 +1604,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 grp,
                 desc.cacheType(),
                 locStartTopVer,
-                desc.receivedFrom(),
                 affNode,
                 true,
-
                 /*
                  * Managers in starting order!
                  * ===========================
@@ -1621,7 +1618,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                 dataStructuresMgr,
                 ttlMgr,
                 drMgr,
-                offheapMgr,
                 rslvrMgr,
                 pluginMgr,
                 affMgr
@@ -1843,6 +1839,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
     }
 
     /**
+     * @param grpDesc Cache group descriptor.
      * @param startCfg Start configuration.
      * @param reqNearCfg Near configuration if specified for client cache start request.
      * @param desc Cache descriptor.
@@ -1932,6 +1929,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         onKernalStart(cache);
     }
 
+    /**
+     * @param desc Group descriptor.
+     * @param cacheType Cache type.
+     * @param affNode Affinity node flag.
+     * @param cacheObjCtx Cache object context.
+     * @param exchTopVer Current topology version.
+     * @return Started cache group.
+     * @throws IgniteCheckedException If failed.
+     */
     private CacheGroupInfrastructure startCacheGroup(
         CacheGroupDescriptor desc,
         CacheType cacheType,
@@ -1963,7 +1969,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         CacheGroupInfrastructure old = cacheGrps.put(desc.groupId(), grp);
 
-        assert old == null;
+        assert old == null : old.name();
 
         return grp;
     }
@@ -2798,7 +2804,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
             }
             else if (rebalanceOrder < 0)
                 throw new IgniteCheckedException("Rebalance order cannot be negative for cache (fix configuration and restart " +
-                    "the node) [cacheName=" + U.maskName(cfg.getName()) + ", rebalanceOrder=" + rebalanceOrder + ']');
+                    "the node) [cacheName=" + cfg.getName() + ", rebalanceOrder=" + rebalanceOrder + ']');
         }
 
         return maxOrder;
@@ -2829,11 +2835,11 @@ public class GridCacheProcessor extends GridProcessorAdapter {
                         if (nodeHashObj.hashCode() == topNodeHashObj.hashCode()) {
                             String errMsg = "Failed to add node to topology because it has the same hash code for " +
                                 "partitioned affinity as one of existing nodes [cacheName=" +
-                                U.maskName(cfg.getName()) + ", existingNodeId=" + topNode.id() + ']';
+                                cfg.getName() + ", existingNodeId=" + topNode.id() + ']';
 
                             String sndMsg = "Failed to add node to topology because it has the same hash code for " +
                                 "partitioned affinity as one of existing nodes [cacheName=" +
-                                U.maskName(cfg.getName()) + ", existingNodeId=" + topNode.id() + ']';
+                                cfg.getName() + ", existingNodeId=" + topNode.id() + ']';
 
                             return new IgniteNodeValidationResult(topNode.id(), errMsg, sndMsg);
                         }
@@ -3096,6 +3102,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
         return cachesInfo.registeredCaches();
     }
 
+    /**
+     * @return Cache group descriptors.
+     */
     public Map<Integer, CacheGroupDescriptor> cacheGroupDescriptors() {
         return cachesInfo.registeredCacheGroups();
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index a3f44af..d344e20 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -100,7 +100,7 @@ public interface IgniteCacheOffheapManager {
     @Nullable public CacheDataRow read(GridCacheMapEntry entry) throws IgniteCheckedException;
 
     /**
-     * @param cctx Context.
+     * @param cctx Cache context.
      * @param key Key.
      * @return Cached row, if available, null otherwise.
      * @throws IgniteCheckedException If failed.
@@ -128,6 +128,7 @@ public interface IgniteCacheOffheapManager {
     /**
      * @param p Partition ID.
      * @param store Data store.
+     * @throws IgniteCheckedException If failed.
      */
     public void destroyCacheDataStore(int p, CacheDataStore store) throws IgniteCheckedException;
 
@@ -137,6 +138,7 @@ public interface IgniteCacheOffheapManager {
     public boolean containsKey(GridCacheMapEntry entry);
 
     /**
+     * @param cctx Cache context.
      * @param c Closure.
      * @throws IgniteCheckedException If failed.
      */
@@ -151,6 +153,7 @@ public interface IgniteCacheOffheapManager {
     public long expiredSize() throws IgniteCheckedException;
 
     /**
+     * @param cctx Cache context.
      * @param key Key.
      * @param part Partition.
      * @param c Tree update closure.
@@ -160,6 +163,7 @@ public interface IgniteCacheOffheapManager {
         throws IgniteCheckedException;
 
     /**
+     * @param cctx Cache context.
      * @param key  Key.
      * @param val  Value.
      * @param ver  Version.
@@ -181,6 +185,7 @@ public interface IgniteCacheOffheapManager {
     ) throws IgniteCheckedException;
 
     /**
+     * @param cctx Cache context.
      * @param key Key.
      * @param partId Partition number.
      * @param part Partition.
@@ -200,6 +205,7 @@ public interface IgniteCacheOffheapManager {
     public int onUndeploy(ClassLoader ldr);
 
     /**
+     * @param cacheId Cache ID.
      * @param primary Primary entries flag.
      * @param backup Backup entries flag.
      * @param topVer Topology version.
@@ -213,12 +219,18 @@ public interface IgniteCacheOffheapManager {
         throws IgniteCheckedException;
 
     /**
+     * @param cacheId Cache ID.
      * @param part Partition.
      * @return Partition data iterator.
      * @throws IgniteCheckedException If failed.
      */
     public GridIterator<CacheDataRow> iteratorForCache(int cacheId, final int part) throws IgniteCheckedException;
 
+    /**
+     * @param part Partition number.
+     * @return Iterator for given partition.
+     * @throws IgniteCheckedException
+     */
     public GridIterator<CacheDataRow> partitionIterator(final int part) throws IgniteCheckedException;
 
     /**
@@ -265,11 +277,13 @@ public interface IgniteCacheOffheapManager {
     /**
      * Clears offheap entries.
      *
+     * @param cctx Cache context.
      * @param readers {@code True} to clear readers.
      */
     public void clear(GridCacheContext cctx, boolean readers);
 
     /**
+     * @param cacheId Cache ID.
      * @param part Partition.
      * @return Number of entries in given partition.
      */
@@ -304,7 +318,7 @@ public interface IgniteCacheOffheapManager {
     public ReuseList reuseListForIndex(String idxName) throws IgniteCheckedException;
 
     /**
-     *
+     * @param cacheId Cache ID.
      * @return Number of entries.
      */
     public long cacheEntriesCount(int cacheId);
@@ -345,6 +359,9 @@ public interface IgniteCacheOffheapManager {
          */
         int cacheSize(int cacheId);
 
+        /**
+         * @return Total size.
+         */
         int fullSize();
 
         /**
@@ -368,6 +385,7 @@ public interface IgniteCacheOffheapManager {
         public Long initialUpdateCounter();
 
         /**
+         * @param cctx Cache context.
          * @param key Key.
          * @param val Value.
          * @param ver Version.
@@ -385,6 +403,7 @@ public interface IgniteCacheOffheapManager {
             @Nullable CacheDataRow oldRow) throws IgniteCheckedException;
 
         /**
+         * @param cctx Cache context.
          * @param key Key.
          * @param part Partition.
          * @param val Value.
@@ -433,6 +452,7 @@ public interface IgniteCacheOffheapManager {
         public GridCursor<? extends CacheDataRow> cursor() throws IgniteCheckedException;
 
         /**
+         * @param cacheId Cache ID.
          * @return Data cursor.
          * @throws IgniteCheckedException If failed.
          */
@@ -458,6 +478,7 @@ public interface IgniteCacheOffheapManager {
         /**
          * Clears all the records associated with logical cache with given ID.
          *
+         * @param cacheId Cache ID.
          * @throws IgniteCheckedException If failed.
          */
         public void clear(int cacheId) throws IgniteCheckedException;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
index de9bdbc..aef39a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/database/CacheDataRowAdapter.java
@@ -109,6 +109,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
      * @param sharedCtx Shared context.
      * @param pageMem Page memory.
      * @param rowData Row data.
+     * @throws IgniteCheckedException If failed.
      */
     public final void initFromLink(
         @Nullable CacheGroupInfrastructure grp,
@@ -184,6 +185,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
     }
 
     /**
+     * @param sharedCtx Cache shared context.
      * @param coctx Cache object context.
      * @param buf Buffer.
      * @param keyOnly {@code true} If need to read only key object.
@@ -250,6 +252,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
     }
 
     /**
+     * @param sharedCtx Cache shared context.
      * @param coctx Cache object context.
      * @param addr Address.
      * @param rowData Required row data.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
index fd6a281..63a47ca 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCachePartitionedConcurrentMap.java
@@ -38,7 +38,7 @@ import org.jetbrains.annotations.Nullable;
  * An implementation of GridCacheConcurrentMap that will delegate all method calls to corresponding local partition.
  */
 public class GridCachePartitionedConcurrentMap implements GridCacheConcurrentMap {
-    /** Context. */
+    /** Cache group. */
     private final CacheGroupInfrastructure grp;
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAssignmentFetchFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAssignmentFetchFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAssignmentFetchFuture.java
index a06ff78..8746320 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAssignmentFetchFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtAssignmentFetchFuture.java
@@ -34,7 +34,6 @@ import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
 import org.apache.ignite.internal.managers.discovery.DiscoCache;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
 import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
-import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
 import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
 import org.apache.ignite.internal.util.future.GridFutureAdapter;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 20dbdc8..bbb3cc5 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
@@ -108,7 +108,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
     @GridToStringExclude
     private final GridFutureAdapter<?> rent;
 
-    /** Context. */
+    /** */
     private final GridCacheSharedContext ctx;
 
     /** */
@@ -188,7 +188,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
             }
         };
 
-        int delQueueSize = CU.isSystemCache(grp.config().getName()) ? 100 :
+        int delQueueSize = grp.systemCache() ? 100 :
             Math.max(MAX_DELETE_QUEUE_SIZE / grp.affinity().partitions(), 20);
 
         rmvQueueMaxSize = U.ceilPow2(delQueueSize);
@@ -977,16 +977,11 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
                                 grp.addCacheEvent(cached.partition(),
                                     cached.key(),
                                     ctx.localNodeId(),
-                                    null,
-                                    null,
                                     EVT_CACHE_REBALANCE_OBJECT_UNLOADED,
                                     null,
                                     false,
                                     cached.rawGet(),
                                     cached.hasValue(),
-                                    null,
-                                    null,
-                                    null,
                                     false);
                             }
                         }
@@ -1031,7 +1026,9 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl implements
 
                         GridCacheMapEntry cached = putEntryIfObsoleteOrAbsent(cctx,
                             grp.affinity().lastVersion(),
-                            row.key(),  true, false);
+                            row.key(),
+                            true,
+                            false);
 
                         if (cached instanceof GridDhtCacheEntry && ((GridDhtCacheEntry)cached).clearInternal(clearVer, extras)) {
                             if (rec) {

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index 1e38cec..cceeca7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -88,7 +88,7 @@ public interface GridDhtPartitionTopology {
     public boolean stopping();
 
     /**
-     * @return Cache ID.
+     * @return Cache group ID.
      */
     public int groupId();
 
@@ -134,6 +134,7 @@ public interface GridDhtPartitionTopology {
     public void releasePartitions(int... parts);
 
     /**
+     * @param part Partition number.
      * @return Local partition.
      * @throws GridDhtInvalidPartitionException If partition is evicted or absent and
      *      does not belong to this node.

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 a47d854..5876304 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
@@ -136,10 +136,13 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
     private volatile boolean treatAllPartAsLoc;
 
     /**
-     * @param ctx Context.
+     * @param ctx Cache shared context.
+     * @param grp Cache group.
      * @param entryFactory Entry factory.
      */
-    public GridDhtPartitionTopologyImpl(GridCacheSharedContext ctx, CacheGroupInfrastructure grp, GridCacheMapEntryFactory entryFactory) {
+    public GridDhtPartitionTopologyImpl(GridCacheSharedContext ctx,
+        CacheGroupInfrastructure grp,
+        GridCacheMapEntryFactory entryFactory) {
         assert ctx != null;
         assert grp != null;
         assert entryFactory != null;
@@ -597,6 +600,11 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
         waitForRent();
     }
 
+    /**
+     * @param p Partition number.
+     * @param topVer Topology version.
+     * @return {@code True} if given partition belongs to local node.
+     */
     private boolean partitionLocalNode(int p, AffinityTopologyVersion topVer) {
         return grp.affinity().nodes(p, topVer).contains(ctx.localNode());
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
index 845619d..b83f054 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtForceKeysFuture.java
@@ -117,6 +117,7 @@ public final class GridDhtForceKeysFuture<K, V> extends GridCompoundFuture<Objec
     ) {
         assert topVer.topologyVersion() != 0 : topVer;
         assert !F.isEmpty(keys) : keys;
+        assert cctx.isDht();
 
         this.cctx = cctx;
         this.keys = keys;

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e4654c6/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 1e24ec3..c9a6525 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
@@ -123,7 +123,7 @@ public class GridDhtPartitionDemander {
 
         boolean enabled = grp.rebalanceEnabled() && !ctx.kernalContext().clientNode();
 
-        rebalanceFut = new RebalanceFuture();//Dummy.
+        rebalanceFut = new RebalanceFuture(); //Dummy.
 
         if (!enabled) {
             // Calling onDone() immediately since preloading is disabled.
@@ -238,17 +238,6 @@ public class GridDhtPartitionDemander {
     }
 
     /**
-     * @param part Partition.
-     * @param type Type.
-     * @param discoEvt Discovery event.
-     */
-    private void rebalanceEvent(int part, int type, DiscoveryEvent discoEvt) {
-        assert discoEvt != null;
-
-        grp.addRebalanceEvent(part, type, discoEvt.eventNode(), discoEvt.type(), discoEvt.timestamp());
-    }
-
-    /**
      * Sets last exchange future.
      *
      * @param lastFut Last future to set.
@@ -469,7 +458,7 @@ public class GridDhtPartitionDemander {
 
                     initD.topic(rebalanceTopics.get(cnt));
                     initD.updateSequence(fut.updateSeq);
-                    initD.timeout(grp.config().getRebalanceTimeout());
+                    initD.timeout(cfg.getRebalanceTimeout());
 
                     synchronized (fut) {
                         if (fut.isDone())
@@ -625,7 +614,7 @@ public class GridDhtPartitionDemander {
                         boolean reserved = part.reserve();
 
                         assert reserved : "Failed to reserve partition [igniteInstanceName=" +
-                            ctx.igniteInstanceName() + ", grp=" + grp.name() + ", part=" + part + ']';
+                            ctx.igniteInstanceName() + ", grp=" + grp.cacheOrGroupName() + ", part=" + part + ']';
 
                         part.lock();
 
@@ -835,8 +824,8 @@ public class GridDhtPartitionDemander {
         private final long updateSeq;
 
         /**
-         * @param assigns Assigns.
          * @param grp Cache group.
+         * @param assigns Assigns.
          * @param log Logger.
          * @param updateSeq Update sequence.
          */
@@ -923,7 +912,7 @@ public class GridDhtPartitionDemander {
                 if (isDone())
                     return;
 
-                U.log(log, ("Cancelled rebalancing [grp=" + grp.name() +
+                U.log(log, ("Cancelled rebalancing [cache=" + grp.cacheOrGroupName() +
                     ", fromNode=" + nodeId + ", topology=" + topologyVersion() +
                     ", time=" + (U.currentTimeMillis() - remaining.get(nodeId).get1()) + " ms]"));
 


Mime
View raw message