You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/09/05 08:51:30 UTC

ignite git commit: disco cache cleanup

Repository: ignite
Updated Branches:
  refs/heads/ignite-3478-1 4c50d485d -> 5e494db29


disco cache cleanup


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

Branch: refs/heads/ignite-3478-1
Commit: 5e494db2999890da90eb3a3df8b33d17b42ec31c
Parents: 4c50d48
Author: sboikov <sb...@gridgain.com>
Authored: Tue Sep 5 11:51:19 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Sep 5 11:51:19 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheAffinitySharedManager.java          | 17 +++++++++--------
 .../cache/GridCachePartitionExchangeManager.java   |  5 +++--
 .../dht/GridClientPartitionTopology.java           |  3 +++
 .../preloader/GridDhtPartitionsExchangeFuture.java | 10 +++++-----
 4 files changed, 20 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/5e494db2/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 39a5ea8..beb7a7d 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
@@ -1659,7 +1659,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         if (!aff.lastVersion().equals(topVer))
                             calculateAndInit(fut.events(), aff, topVer);
 
-                        grpHolder.topology().beforeExchange(fut, true, false);
+                        grpHolder.topology(fut.context().events().discoveryCache()).beforeExchange(fut, true, false);
                     }
                     else {
                         List<GridDhtPartitionsExchangeFuture> exchFuts = cctx.exchange().exchangeFutures();
@@ -1715,7 +1715,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         if (!aff.lastVersion().equals(topVer))
                             calculateAndInit(fut.events(), aff, topVer);
 
-                        grpHolder.topology().beforeExchange(fut, true, false);
+                        grpHolder.topology(fut.context().events().discoveryCache()).beforeExchange(fut, true, false);
                     }
                 }
 
@@ -1833,7 +1833,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
                         Map<UUID, GridDhtPartitionMap> map = affinityFullMap(aff);
 
                         for (GridDhtPartitionMap map0 : map.values())
-                            cache.topology().update(fut.exchangeId(), map0, true);
+                            cache.topology(fut.context().events().discoveryCache()).update(fut.exchangeId(), map0, true);
                     }
                 }
             });
@@ -2059,7 +2059,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
 
                 List<List<ClusterNode>> newAssignment0 = initAff ? new ArrayList<>(newAssignment) : null;
 
-                GridDhtPartitionTopology top = grpHolder.topology();
+                GridDhtPartitionTopology top = grpHolder.topology(fut.context().events().discoveryCache());
 
                 Map<Integer, List<T>> cacheAssignment = null;
 
@@ -2277,9 +2277,10 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         }
 
         /**
+         * @param discoCache Discovery data cache.
          * @return Cache topology.
          */
-        abstract GridDhtPartitionTopology topology();
+        abstract GridDhtPartitionTopology topology(DiscoCache discoCache);
 
         /**
          * @return Affinity.
@@ -2314,7 +2315,7 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         }
 
         /** {@inheritDoc} */
-        @Override public GridDhtPartitionTopology topology() {
+        @Override public GridDhtPartitionTopology topology(DiscoCache discoCache) {
             return grp.topology();
         }
     }
@@ -2390,8 +2391,8 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
         }
 
         /** {@inheritDoc} */
-        @Override public GridDhtPartitionTopology topology() {
-            return cctx.exchange().clientTopology(groupId());
+        @Override public GridDhtPartitionTopology topology(DiscoCache discoCache) {
+            return cctx.exchange().clientTopology(groupId(), discoCache);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/5e494db2/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 5ec6bfb..fe9ed29 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
@@ -719,9 +719,10 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
 
     /**
      * @param grpId Cache group ID.
+     * @param discoCache Discovery data cache.
      * @return Topology.
      */
-    public GridDhtPartitionTopology clientTopology(int grpId) {
+    public GridDhtPartitionTopology clientTopology(int grpId, DiscoCache discoCache) {
         GridClientPartitionTopology top = clientTops.get(grpId);
 
         if (top != null)
@@ -741,7 +742,7 @@ public class GridCachePartitionExchangeManager<K, V> extends GridCacheSharedMana
             aff.partitions());
 
         GridClientPartitionTopology old = clientTops.putIfAbsent(grpId,
-            top = new GridClientPartitionTopology(cctx, grpId, aff.partitions(), affKey));
+            top = new GridClientPartitionTopology(cctx, discoCache, grpId, aff.partitions(), affKey));
 
         return old != null ? old : top;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/5e494db2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index 4ac9195..e994113 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -120,17 +120,20 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
 
     /**
      * @param cctx Context.
+     * @param discoCache Discovery data cache.
      * @param grpId Group ID.
      * @param parts Number of partitions in the group.
      * @param similarAffKey Key to find caches with similar affinity.
      */
     public GridClientPartitionTopology(
         GridCacheSharedContext<?, ?> cctx,
+        DiscoCache discoCache,
         int grpId,
         int parts,
         Object similarAffKey
     ) {
         this.cctx = cctx;
+        this.discoCache = discoCache;
         this.grpId = grpId;
         this.similarAffKey = similarAffKey;
         this.parts = parts;

http://git-wip-us.apache.org/repos/asf/ignite/blob/5e494db2/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 6d85222..9589f09 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
@@ -2247,7 +2247,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     CacheGroupContext grp = cctx.cache().cacheGroup(desc.groupId());
 
                     GridDhtPartitionTopology top = grp != null ? grp.topology() :
-                        cctx.exchange().clientTopology(desc.groupId());
+                        cctx.exchange().clientTopology(desc.groupId(), events().discoveryCache());
 
                     top.beforeExchange(this, true, true);
                 }
@@ -2265,7 +2265,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                     CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
 
                     GridDhtPartitionTopology top = grp != null ? grp.topology() :
-                        cctx.exchange().clientTopology(grpId);
+                        cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
                     CachePartitionPartialCountersMap cntrs = msg.partitionUpdateCounters(grpId,
                         top.partitions());
@@ -2448,7 +2448,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 if (grpCtx != null)
                     top = grpCtx.topology();
                 else
-                    top = cctx.exchange().clientTopology(e.getKey());
+                    top = cctx.exchange().clientTopology(e.getKey(), events().discoveryCache());
 
                 assignPartitionStates(top);
             }
@@ -2829,7 +2829,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
                 ClusterNode oldest = cctx.discovery().oldestAliveServerNode(AffinityTopologyVersion.NONE);
 
                 if (oldest != null && oldest.isLocal()) {
-                    GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId);
+                    GridDhtPartitionTopology top = cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
                     CachePartitionFullCountersMap cntrMap = msg.partitionUpdateCounters(grpId,
                         top.partitions());
@@ -2858,7 +2858,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
             CacheGroupContext grp = cctx.cache().cacheGroup(grpId);
 
             GridDhtPartitionTopology top = grp != null ? grp.topology() :
-                cctx.exchange().clientTopology(grpId);
+                cctx.exchange().clientTopology(grpId, events().discoveryCache());
 
             top.update(exchId, entry.getValue(), false);
         }