ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject ignite git commit: IGNITE-950-new - Fixing keepBinary for return values.
Date Mon, 02 Nov 2015 15:21:28 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-950-new 75340e0d1 -> c04cc6605


IGNITE-950-new - Fixing keepBinary for return values.


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

Branch: refs/heads/ignite-950-new
Commit: c04cc6605a330cd144a67438cec4a3168c8c2f2c
Parents: 75340e0
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Mon Nov 2 18:21:15 2015 +0300
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Mon Nov 2 18:21:15 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheReturn.java       | 21 ++++++++++++--------
 .../distributed/dht/GridDhtTxPrepareFuture.java |  6 +++---
 .../dht/atomic/GridDhtAtomicCache.java          |  3 ++-
 .../dht/atomic/GridNearAtomicUpdateFuture.java  |  6 +++---
 .../local/atomic/GridLocalAtomicCache.java      |  2 +-
 .../transactions/IgniteTxLocalAdapter.java      | 20 +++++++++----------
 6 files changed, 32 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/c04cc660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
index 22b9f8d..2f5a6ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheReturn.java
@@ -101,13 +101,13 @@ public class GridCacheReturn implements Externalizable, Message {
      * @param v Value.
      * @param success Success flag.
      */
-    public GridCacheReturn(GridCacheContext cctx, boolean loc, Object v, boolean success)
{
+    public GridCacheReturn(GridCacheContext cctx, boolean loc, boolean keepBinary, Object
v, boolean success) {
         this.loc = loc;
         this.success = success;
 
         if (v != null) {
             if (v instanceof CacheObject)
-                initValue(cctx, (CacheObject)v);
+                initValue(cctx, (CacheObject)v, keepBinary);
             else {
                 assert loc;
 
@@ -152,8 +152,8 @@ public class GridCacheReturn implements Externalizable, Message {
      * @param v Value.
      * @return This instance for chaining.
      */
-    public GridCacheReturn value(GridCacheContext cctx, CacheObject v) {
-        initValue(cctx, v);
+    public GridCacheReturn value(GridCacheContext cctx, CacheObject v, boolean keepBinary)
{
+        initValue(cctx, v, keepBinary);
 
         return this;
     }
@@ -171,10 +171,15 @@ public class GridCacheReturn implements Externalizable, Message {
      * @param success Success flag to set.
      * @return This instance for chaining.
      */
-    public GridCacheReturn set(GridCacheContext cctx, @Nullable CacheObject cacheObj, boolean
success) {
+    public GridCacheReturn set(
+        GridCacheContext cctx,
+        @Nullable CacheObject cacheObj,
+        boolean success,
+        boolean keepBinary
+    ) {
         this.success = success;
 
-        initValue(cctx, cacheObj);
+        initValue(cctx, cacheObj, keepBinary);
 
         return this;
     }
@@ -183,9 +188,9 @@ public class GridCacheReturn implements Externalizable, Message {
      * @param cctx Cache context.
      * @param cacheObj Cache object.
      */
-    private void initValue(GridCacheContext cctx, @Nullable CacheObject cacheObj) {
+    private void initValue(GridCacheContext cctx, @Nullable CacheObject cacheObj, boolean
keepBinary) {
         if (loc)
-            v = CU.value(cacheObj, cctx, true);
+            v = cctx.cacheObjectContext().unwrapPortableIfNeeded(cacheObj, keepBinary, true);
         else {
             assert cacheId == 0 || cacheId == cctx.cacheId();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/c04cc660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index 42cd9a3..87c44f7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -316,7 +316,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
      *
      */
     private void onEntriesLocked() {
-        ret = new GridCacheReturn(null, tx.localResult(), null, true);
+        ret = new GridCacheReturn(null, tx.localResult(), true, null, true);
 
         for (IgniteTxEntry writeEntry : writes) {
             IgniteTxEntry txEntry = tx.entry(writeEntry.txKey());
@@ -404,7 +404,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                             }
                         }
                         else if (retVal)
-                            ret.value(cacheCtx, val);
+                            ret.value(cacheCtx, val, txEntry.keepBinary());
                     }
 
                     if (hasFilters && !cacheCtx.isAll(cached, txEntry.filters()))
{
@@ -1553,7 +1553,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                                         false, null, null, null, false);
 
                                 if (retVal && !invoke)
-                                    ret.value(cacheCtx, info.value());
+                                    ret.value(cacheCtx, info.value(), false);
                             }
 
                             break;

http://git-wip-us.apache.org/repos/asf/ignite/blob/c04cc660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 167a334..715a763 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1199,7 +1199,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
                         }
 
                         if (retVal == null)
-                            retVal = new GridCacheReturn(ctx, node.isLocal(), null, true);
+                            retVal = new GridCacheReturn(ctx, node.isLocal(), true, null,
true);
 
                         res.returnValue(retVal);
 
@@ -1883,6 +1883,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K,
V> {
 
                         retVal = new GridCacheReturn(ctx,
                             node.isLocal(),
+                            req.keepBinary(),
                             req.returnValue() ? ret : null,
                             updRes.success());
                     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c04cc660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
index ae768ff..02c62d8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridNearAtomicUpdateFuture.java
@@ -479,7 +479,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
                 cctx.io().send(req.nodeId(), req, cctx.ioPolicy());
 
                 if (syncMode == FULL_ASYNC)
-                    onDone(new GridCacheReturn(cctx, true, null, true));
+                    onDone(new GridCacheReturn(cctx, true, true, null, true));
             }
             catch (IgniteCheckedException e) {
                 state.onSendError(req, e);
@@ -528,7 +528,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
         }
 
         if (syncMode == FULL_ASYNC)
-            onDone(new GridCacheReturn(cctx, true, null, true));
+            onDone(new GridCacheReturn(cctx, true, true, null, true));
     }
 
     /**
@@ -898,7 +898,7 @@ public class GridNearAtomicUpdateFuture extends GridFutureAdapter<Object>
                 assert pendingMappings != null;
 
                 if (size == 0)
-                    onDone(new GridCacheReturn(cctx, true, null, true));
+                    onDone(new GridCacheReturn(cctx, true, true, null, true));
                 else
                     doUpdate(pendingMappings);
             }

http://git-wip-us.apache.org/repos/asf/ignite/blob/c04cc660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index 3032261..dd01c88 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -1045,7 +1045,7 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K,
V> {
         if (err != null)
             throw err;
 
-        Object ret = res == null ? null : rawRetval ? new GridCacheReturn(ctx,  true, res.get2(),
res.get1()) :
+        Object ret = res == null ? null : rawRetval ? new GridCacheReturn(ctx,  true, keepPortable,
res.get2(), res.get1()) :
             (retval || op == TRANSFORM) ? res.get2() : res.get1();
 
         if (op == TRANSFORM && ret == null)

http://git-wip-us.apache.org/repos/asf/ignite/blob/c04cc660/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 7783d45..1001b36 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2059,7 +2059,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         @Nullable Map<KeyCacheObject, GridCacheVersion> drRmvMap,
         boolean skipStore,
         final boolean singleRmv,
-        boolean keepBinary
+        final boolean keepBinary
     ) {
         assert retval || invokeMap == null;
 
@@ -2200,7 +2200,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             if (old != null && hasFilters && !filter(entry.context(),
cacheKey, old, filter)) {
                                 skipped = skip(skipped, cacheKey);
 
-                                ret.set(cacheCtx, old, false);
+                                ret.set(cacheCtx, old, false, keepBinary);
 
                                 if (!readCommitted()) {
                                     // Enlist failed filters as reads for non-read-committed
mode,
@@ -2271,7 +2271,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                         assert txEntry.op() != TRANSFORM : txEntry;
 
                                         if (retval)
-                                            ret.set(cacheCtx, null, true);
+                                            ret.set(cacheCtx, null, true, keepBinary);
                                         else
                                             ret.success(true);
                                     }
@@ -2284,7 +2284,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                     }
 
                                     if (retval && !transform)
-                                        ret.set(cacheCtx, old, true);
+                                        ret.set(cacheCtx, old, true, keepBinary);
                                     else {
                                         if (txEntry.op() == TRANSFORM) {
                                             GridCacheVersion ver;
@@ -2312,7 +2312,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             // Pessimistic.
                             else {
                                 if (retval && !transform)
-                                    ret.set(cacheCtx, old, true);
+                                    ret.set(cacheCtx, old, true, keepBinary);
                                 else
                                     ret.success(true);
                             }
@@ -2340,7 +2340,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                         if (hasFilters && !filter(entry.context(), cacheKey, v, filter))
{
                             skipped = skip(skipped, cacheKey);
 
-                            ret.set(cacheCtx, v, false);
+                            ret.set(cacheCtx, v, false, keepBinary);
 
                             continue;
                         }
@@ -2387,7 +2387,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                         txEntry.markValid();
 
                         if (retval && !transform)
-                            ret.set(cacheCtx, v, true);
+                            ret.set(cacheCtx, v, true, keepBinary);
                         else
                             ret.success(true);
                     }
@@ -2429,7 +2429,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             assert !hasFilters && !retval;
                             assert val == null || Boolean.TRUE.equals(val) : val;
 
-                            ret.set(cacheCtx, null, val != null);
+                            ret.set(cacheCtx, null, val != null, keepBinary);
                         }
                         else {
                             CacheObject cacheVal = cacheCtx.toCacheObject(val);
@@ -2454,7 +2454,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             else {
                                 boolean success = !hasFilters || isAll(e.context(), key,
cacheVal, filter);
 
-                                ret.set(cacheCtx, cacheVal, success);
+                                ret.set(cacheCtx, cacheVal, success, keepBinary);
                             }
                         }
                     }
@@ -2605,7 +2605,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                             }
                         }
                         else
-                            ret.value(cacheCtx, v);
+                            ret.value(cacheCtx, v, txEntry.keepBinary());
                     }
 
                     boolean pass = F.isEmpty(filter) || cacheCtx.isAll(cached, filter);


Mime
View raw message