ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [40/50] [abbrv] ignite git commit: IGNITE-3227 GridCacheAdapter - send part size task only to relevant nodes
Date Wed, 06 Jul 2016 18:23:39 GMT
IGNITE-3227 GridCacheAdapter - send part size task only to relevant nodes


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

Branch: refs/heads/ignite-3227
Commit: 06e5e5b972fbffa5ac3d29bcb0599d62bebd2b2d
Parents: fae394e
Author: Alexander Paschenko <alexander.a.paschenko@gmail.com>
Authored: Wed Jul 6 16:27:36 2016 +0300
Committer: Alexander Paschenko <alexander.a.paschenko@gmail.com>
Committed: Wed Jul 6 16:27:36 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheAdapter.java      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/06e5e5b9/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 31ff279..feeb61d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -3888,19 +3888,24 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
     }
 
     /** {@inheritDoc} */
-    @Override public IgniteInternalFuture<Long> sizeLongAsync(final int partition,
final CachePeekMode[] peekModes) {
+    @Override public IgniteInternalFuture<Long> sizeLongAsync(final int part, final
CachePeekMode[] peekModes) {
         assert peekModes != null;
 
         PeekModes modes = parsePeekModes(peekModes, true);
 
         IgniteClusterEx cluster = ctx.grid().cluster();
+        GridCacheAffinityManager aff = ctx.affinity();
+        AffinityTopologyVersion topVer = aff.affinityTopologyVersion();
 
         ClusterGroup grp = modes.near ? cluster.forCacheNodes(name(), true, true, false)
: cluster.forDataNodes(name());
 
         Collection<ClusterNode> nodes = grp.forPredicate(new IgnitePredicate<ClusterNode>()
{
             /** {@inheritDoc} */
             @Override public boolean apply(ClusterNode clusterNode) {
-                return clusterNode.version().compareTo(PartitionSizeLongTask.SINCE_VER) >=
0;
+                return clusterNode.version().compareTo(PartitionSizeLongTask.SINCE_VER) >
0 &&
+                    (modes.near ||
+                        (modes.primary && aff.primary(clusterNode, part, topVer))
||
+                        (modes.backup && aff.backup(clusterNode, part, topVer)));
             }
         }).nodes();
 
@@ -3910,7 +3915,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K,
V
         ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
 
         return ctx.kernalContext().task().execute(
-                new PartitionSizeLongTask(ctx.name(), ctx.affinity().affinityTopologyVersion(),
peekModes, partition), null);
+                new PartitionSizeLongTask(ctx.name(), ctx.affinity().affinityTopologyVersion(),
peekModes, part), null);
     }
 
     /** {@inheritDoc} */


Mime
View raw message