ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-1811 Optimized cache 'get' on affinity node.
Date Wed, 13 Jan 2016 08:19:41 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-1811 34f62f10f -> e817363bf


ignite-1811 Optimized cache 'get' on affinity node.


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

Branch: refs/heads/ignite-1811
Commit: e817363bfd05666a58c9ebf8cca7e64427da8310
Parents: 34f62f1
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Jan 13 11:19:31 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Jan 13 11:19:31 2016 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/GridCacheContext.java     |  2 +-
 .../cache/distributed/dht/GridPartitionedGetFuture.java |  2 +-
 .../distributed/dht/GridPartitionedSingleGetFuture.java |  7 +++++--
 .../cache/distributed/near/GridNearGetFuture.java       | 12 +++++-------
 4 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/e817363b/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 1b9e081..31252e1 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
@@ -1969,7 +1969,7 @@ public class GridCacheContext<K, V> implements Externalizable
{
      * @return {@code True} if cache 'get' operation is allowed to get entry locally.
      */
     public boolean allowFastLocalRead(int part, List<ClusterNode> affNodes, AffinityTopologyVersion
topVer) {
-        return affinityNode() && hasPartition(part, affNodes, topVer);
+        return affinityNode() && rebalanceEnabled() && hasPartition(part,
affNodes, topVer);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/e817363b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
index 9ed9dc8..982c6d3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedGetFuture.java
@@ -504,7 +504,7 @@ public class GridPartitionedGetFuture<K, V> extends CacheDistributedGetFutureAda
                     }
                 }
 
-                boolean topStable = topVer.equals(cctx.topology().topologyVersion());
+                boolean topStable = cctx.isReplicated() || topVer.equals(cctx.topology().topologyVersion());
 
                 // Entry not found, do not continue search if topology did not change and
there is no store.
                 return !cctx.store().configured() && (topStable || partitionOwned(part));

http://git-wip-us.apache.org/repos/asf/ignite/blob/e817363b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
index ffd7f23..ed5cf92 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridPartitionedSingleGetFuture.java
@@ -441,11 +441,14 @@ public class GridPartitionedSingleGetFuture extends GridFutureAdapter<Object>
im
                     }
                 }
 
-                boolean topStable = topVer.equals(cctx.topology().topologyVersion());
+                boolean topStable = cctx.isReplicated() || topVer.equals(cctx.topology().topologyVersion());
 
                 // Entry not found, complete future with null result if topology did not
change and there is no store.
                 if (!cctx.store().configured() && (topStable || partitionOwned(part)))
{
-                    setResult(null, null);
+                    if (skipVals)
+                        setSkipValueResult(false, null);
+                    else
+                        setResult(null, null);
 
                     return true;
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/e817363b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
index eb39112..0cb130a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearGetFuture.java
@@ -470,7 +470,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
                 if (v == null) {
                     boolean fastLocGet = allowLocRead && cctx.allowFastLocalRead(part,
affNodes, topVer);
 
-                    if (fastLocGet && localDhtGet(key, part, topVer, affNodes, isNear))
+                    if (fastLocGet && localDhtGet(key, part, topVer, isNear))
                         break;
 
                     ClusterNode affNode = affinityNode(affNodes);
@@ -483,6 +483,9 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
                         }
                     }
 
+                    if (cctx.cache().configuration().isStatisticsEnabled() && !skipVals
&& !affNode.isLocal())
+                        cache().metrics0().onRead(false);
+
                     LinkedHashMap<KeyCacheObject, Boolean> keys = mapped.get(affNode);
 
                     if (keys != null && keys.containsKey(key)) {
@@ -547,14 +550,12 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
      * @param key Key.
      * @param part Partition.
      * @param topVer Topology version.
-     * @param affNodes All affinity nodes.
      * @param nearRead {@code True} if tried to read from near cache.
      * @return {@code True} if there is no need to further search value.
      */
     private boolean localDhtGet(KeyCacheObject key,
         int part,
         AffinityTopologyVersion topVer,
-        List<ClusterNode> affNodes,
         boolean nearRead) {
         GridDhtCacheAdapter<K, V> dht = cache().dht();
 
@@ -618,10 +619,7 @@ public final class GridNearGetFuture<K, V> extends CacheDistributedGetFutureAdap
                     return true;
                 }
                 else {
-                    if (cctx.cache().configuration().isStatisticsEnabled() && !skipVals
&& !affNodes.get(0).isLocal())
-                        cache().metrics0().onRead(false);
-
-                    boolean topStable = topVer.equals(cctx.topology().topologyVersion());
+                    boolean topStable = cctx.isReplicated() || topVer.equals(cctx.topology().topologyVersion());
 
                     // Entry not found, do not continue search if topology did not change
and there is no store.
                     return !cctx.store().configured() && (topStable || partitionOwned(part));


Mime
View raw message