ignite-4332 Usage of cache.getEntry inside GridCacheQueryManager.runQuery 
causes to remote operations


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

Branch: refs/heads/ignite-4296
Commit: c06e4017771603df7118974758d3d6b9cadc41b5
Parents: 1a2de51
Author: Eduard Shangareev <eshangar...@gridgain.com>
Authored: Wed Nov 30 14:34:47 2016 +0300
Committer: sboikov <sboi...@gridgain.com>
Committed: Wed Nov 30 14:34:47 2016 +0300

----------------------------------------------------------------------
 .../cache/query/GridCacheQueryManager.java        | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c06e4017/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index ab8bd63..d4decb4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.IgniteInternalFuture;
 import org.apache.ignite.internal.IgniteKernal;
 import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
 import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
 import org.apache.ignite.internal.processors.cache.CacheMetricsImpl;
 import org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
@@ -1560,9 +1561,12 @@ public abstract class GridCacheQueryManager<K, V> 
extends GridCacheManagerAdapte
                         metrics.addGetTimeNanos(System.nanoTime() - start);
                     }
 
+                    K key0 = null;
+                    V val0 = null;
+
                     if (readEvt) {
-                        K key0 = (K)cctx.unwrapBinaryIfNeeded(key, 
qry.keepBinary());
-                        V val0 = (V)cctx.unwrapBinaryIfNeeded(val, 
qry.keepBinary());
+                        key0 = (K)cctx.unwrapBinaryIfNeeded(key, 
qry.keepBinary());
+                        val0 = (V)cctx.unwrapBinaryIfNeeded(val, 
qry.keepBinary());
 
                         switch (type) {
                             case SQL:
@@ -1631,12 +1635,12 @@ public abstract class GridCacheQueryManager<K, V> 
extends GridCacheManagerAdapte
                     }
 
                     if (rdc != null || trans != null) {
-                        Cache.Entry<K, V> entry;
+                        if (key0 == null)
+                            key0 = (K)cctx.unwrapBinaryIfNeeded(key, 
qry.keepBinary());
+                        if (val0 == null)
+                            val0 = (V)cctx.unwrapBinaryIfNeeded(val, 
qry.keepBinary());
 
-                        if (qry.keepBinary())
-                            entry = cache.<K, V>keepBinary().getEntry(key);
-                        else
-                            entry = cache.<K, V>getEntry(key);
+                        Cache.Entry<K, V> entry = new CacheEntryImpl(key0, 
val0);
 
                         // Reduce.
                         if (rdc != null) {

Reply via email to