Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-341 68e08291c -> 57c09252b


IGNITE-45 - Fixing tests.


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

Branch: refs/heads/ignite-341
Commit: 9875a639d03308d94f1d8c3c376eee9c1b98abb1
Parents: c620ee0
Author: Alexey Goncharuk <agoncha...@gridgain.com>
Authored: Tue Mar 24 11:51:44 2015 -0700
Committer: Alexey Goncharuk <agoncha...@gridgain.com>
Committed: Tue Mar 24 11:51:44 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheStoreManager.java |  5 ++-
 .../distributed/dht/GridDhtLockFuture.java      |  7 +++-
 .../dht/GridDhtTransactionalCacheAdapter.java   |  6 ++-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |  6 ++-
 .../dht/colocated/GridDhtColocatedCache.java    |  5 +++
 .../colocated/GridDhtColocatedLockFuture.java   |  4 +-
 .../distributed/near/GridNearLockFuture.java    |  1 +
 .../distributed/near/GridNearLockRequest.java   | 40 ++++++++++++++++----
 .../IgniteCacheNoWriteThroughAbstractTest.java  |  3 +-
 9 files changed, 62 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
index 17a732d..81363bb 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheStoreManager.java
@@ -96,8 +96,11 @@ public class GridCacheStoreManager extends 
GridCacheManagerAdapter {
             if (sesHolder0 == null) {
                 ThreadLocalSession locSes = new ThreadLocalSession();
 
-                if (ctx.resource().injectStoreSession(cfgStore, locSes))
+                if (ctx.resource().injectStoreSession(cfgStore, locSes)) {
                     sesHolder0 = locSes.sesHolder;
+
+                    sesHolders.put(cfgStore, sesHolder0);
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
index ed61814..220b0f4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
@@ -129,6 +129,9 @@ public final class GridDhtLockFuture<K, V> extends 
GridCompoundIdentityFuture<Bo
     /** TTL for read operation. */
     private long accessTtl;
 
+    /** Need return value flag. */
+    private boolean needReturnValue;
+
     /**
      * @param cctx Cache context.
      * @param nearNodeId Near node ID.
@@ -149,6 +152,7 @@ public final class GridDhtLockFuture<K, V> extends 
GridCompoundIdentityFuture<Bo
         @NotNull AffinityTopologyVersion topVer,
         int cnt,
         boolean read,
+        boolean needReturnValue,
         long timeout,
         GridDhtTxLocalAdapter tx,
         long threadId,
@@ -165,6 +169,7 @@ public final class GridDhtLockFuture<K, V> extends 
GridCompoundIdentityFuture<Bo
         this.nearLockVer = nearLockVer;
         this.topVer = topVer;
         this.read = read;
+        this.needReturnValue = needReturnValue;
         this.timeout = timeout;
         this.filter = filter;
         this.tx = tx;
@@ -929,7 +934,7 @@ public final class GridDhtLockFuture<K, V> extends 
GridCompoundIdentityFuture<Bo
      *
      */
     private void loadMissingFromStore() {
-        if (cctx.loadPreviousValue() && cctx.readThrough() && read) {
+        if (cctx.loadPreviousValue() && cctx.readThrough() && needReturnValue) 
{
             final Map<KeyCacheObject, GridDhtCacheEntry> loadMap = new 
LinkedHashMap<>();
 
             final GridCacheVersion ver = version();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
index 5d4c236..737e3ed 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTransactionalCacheAdapter.java
@@ -610,6 +610,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
             tx.topologyVersion(),
             keys.size(),
             isRead,
+            retval,
             timeout,
             tx,
             tx.threadId(),
@@ -725,6 +726,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
                                 req.topologyVersion(),
                                 cnt,
                                 req.txRead(),
+                                req.needReturnValue(),
                                 req.timeout(),
                                 tx,
                                 req.threadId(),
@@ -836,6 +838,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, 
V> extends GridDhtCach
                                 req.onePhaseCommit(),
                                 req.messageId(),
                                 req.txRead(),
+                                req.needReturnValue(),
                                 req.accessTtl());
 
                             final GridDhtTxLocal t = tx;
@@ -1276,12 +1279,11 @@ public abstract class 
GridDhtTransactionalCacheAdapter<K, V> extends GridDhtCach
      * @param entry Entry.
      * @param nodes Nodes.
      * @param map Map.
-     * @throws IgniteCheckedException If failed.
      */
     @SuppressWarnings( {"MismatchedQueryAndUpdateOfCollection"})
     private void map(GridCacheEntryEx entry,
         @Nullable Iterable<? extends ClusterNode> nodes,
-        Map<ClusterNode, List<KeyCacheObject>> map) throws 
IgniteCheckedException {
+        Map<ClusterNode, List<KeyCacheObject>> map) {
         if (nodes != null) {
             for (ClusterNode n : nodes) {
                 List<KeyCacheObject> keys = map.get(n);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
index c0a2673..d76a730 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocalAdapter.java
@@ -508,6 +508,7 @@ public abstract class GridDhtTxLocalAdapter extends 
IgniteTxLocalAdapter {
         boolean onePhaseCommit,
         long msgId,
         final boolean read,
+        final boolean needRetVal,
         long accessTtl
     ) {
         try {
@@ -589,7 +590,7 @@ public abstract class GridDhtTxLocalAdapter extends 
IgniteTxLocalAdapter {
             if (log.isDebugEnabled())
                 log.debug("Lock keys: " + passedKeys);
 
-            return obtainLockAsync(cacheCtx, ret, passedKeys, read, skipped, 
accessTtl, null);
+            return obtainLockAsync(cacheCtx, ret, passedKeys, read, 
needRetVal, skipped, accessTtl, null);
         }
         catch (IgniteCheckedException e) {
             setRollbackOnly();
@@ -613,6 +614,7 @@ public abstract class GridDhtTxLocalAdapter extends 
IgniteTxLocalAdapter {
         GridCacheReturn ret,
         final Collection<KeyCacheObject> passedKeys,
         final boolean read,
+        final boolean needRetVal,
         final Set<KeyCacheObject> skipped,
         final long accessTtl,
         @Nullable final CacheEntryPredicate[] filter) {
@@ -630,7 +632,7 @@ public abstract class GridDhtTxLocalAdapter extends 
IgniteTxLocalAdapter {
             this,
             isInvalidate(),
             read,
-            /*retval*/false,
+            needRetVal,
             isolation,
             accessTtl,
             CU.empty0());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 6fd60dd..cdf1638 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -617,6 +617,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
         final AffinityTopologyVersion topVer,
         final Collection<KeyCacheObject> keys,
         final boolean txRead,
+        final boolean retval,
         final long timeout,
         final long accessTtl,
         @Nullable final CacheEntryPredicate[] filter
@@ -638,6 +639,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
                     topVer,
                     keys,
                     txRead,
+                    retval,
                     timeout,
                     accessTtl,
                     filter);
@@ -660,6 +662,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
                             topVer,
                             keys,
                             txRead,
+                            retval,
                             timeout,
                             accessTtl,
                             filter);
@@ -690,6 +693,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
         AffinityTopologyVersion topVer,
         final Collection<KeyCacheObject> keys,
         final boolean txRead,
+        boolean retval,
         final long timeout,
         final long accessTtl,
         @Nullable final CacheEntryPredicate[] filter) {
@@ -702,6 +706,7 @@ public class GridDhtColocatedCache<K, V> extends 
GridDhtTransactionalCacheAdapte
                 topVer,
                 cnt,
                 txRead,
+                retval,
                 timeout,
                 tx,
                 threadId,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 6ee13f7..3087dff 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -604,7 +604,7 @@ public final class GridDhtColocatedLockFuture<K, V> extends 
GridCompoundIdentity
             if (mapAsPrimary(keys, topVer))
                 return;
 
-            ConcurrentLinkedDeque8<GridNearLockMapping> mappings = new 
ConcurrentLinkedDeque8<>();
+            Deque<GridNearLockMapping> mappings = new 
ConcurrentLinkedDeque8<>();
 
             // Assign keys to primary nodes.
             GridNearLockMapping map = null;
@@ -699,6 +699,7 @@ public final class GridDhtColocatedLockFuture<K, V> extends 
GridCompoundIdentity
                                         implicitTx(),
                                         implicitSingleTx(),
                                         read,
+                                        retval,
                                         isolation(),
                                         isInvalidate(),
                                         timeout,
@@ -872,6 +873,7 @@ public final class GridDhtColocatedLockFuture<K, V> extends 
GridCompoundIdentity
             topVer,
             keys,
             read,
+            retval,
             timeout,
             accessTtl,
             filter);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
index e668592..c3d138e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockFuture.java
@@ -850,6 +850,7 @@ public final class GridNearLockFuture<K, V> extends 
GridCompoundIdentityFuture<B
                                             implicitTx(),
                                             implicitSingleTx(),
                                             read,
+                                            retval,
                                             isolation(),
                                             isInvalidate(),
                                             timeout,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
index 9b0ecc6..696cea4 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearLockRequest.java
@@ -78,6 +78,9 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
     /** TTL for read operation. */
     private long accessTtl;
 
+    /** Flag indicating whether cache operation requires a previous value. */
+    private boolean retVal;
+
     /**
      * Empty constructor required for {@link Externalizable}.
      */
@@ -119,6 +122,7 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
         boolean implicitTx,
         boolean implicitSingleTx,
         boolean isRead,
+        boolean retVal,
         TransactionIsolation isolation,
         boolean isInvalidate,
         long timeout,
@@ -157,6 +161,7 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
         this.subjId = subjId;
         this.taskNameHash = taskNameHash;
         this.accessTtl = accessTtl;
+        this.retVal = retVal;
 
         dhtVers = new GridCacheVersion[keyCnt];
     }
@@ -263,6 +268,13 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
     }
 
     /**
+     * @return Need return value flag.
+     */
+    public boolean needReturnValue() {
+        return retVal;
+    }
+
+    /**
      * Adds a key.
      *
      * @param key Key.
@@ -390,24 +402,30 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
                 writer.incrementState();
 
             case 30:
-                if (!writer.writeUuid("subjId", subjId))
+                if (!writer.writeBoolean("retVal", retVal))
                     return false;
 
                 writer.incrementState();
 
             case 31:
-                if (!writer.writeBoolean("syncCommit", syncCommit))
+                if (!writer.writeUuid("subjId", subjId))
                     return false;
 
                 writer.incrementState();
 
             case 32:
-                if (!writer.writeInt("taskNameHash", taskNameHash))
+                if (!writer.writeBoolean("syncCommit", syncCommit))
                     return false;
 
                 writer.incrementState();
 
             case 33:
+                if (!writer.writeInt("taskNameHash", taskNameHash))
+                    return false;
+
+                writer.incrementState();
+
+            case 34:
                 if (!writer.writeMessage("topVer", topVer))
                     return false;
 
@@ -494,7 +512,7 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
                 reader.incrementState();
 
             case 30:
-                subjId = reader.readUuid("subjId");
+                retVal = reader.readBoolean("retVal");
 
                 if (!reader.isLastRead())
                     return false;
@@ -502,7 +520,7 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
                 reader.incrementState();
 
             case 31:
-                syncCommit = reader.readBoolean("syncCommit");
+                subjId = reader.readUuid("subjId");
 
                 if (!reader.isLastRead())
                     return false;
@@ -510,7 +528,7 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
                 reader.incrementState();
 
             case 32:
-                taskNameHash = reader.readInt("taskNameHash");
+                syncCommit = reader.readBoolean("syncCommit");
 
                 if (!reader.isLastRead())
                     return false;
@@ -518,6 +536,14 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
                 reader.incrementState();
 
             case 33:
+                taskNameHash = reader.readInt("taskNameHash");
+
+                if (!reader.isLastRead())
+                    return false;
+
+                reader.incrementState();
+
+            case 34:
                 topVer = reader.readMessage("topVer");
 
                 if (!reader.isLastRead())
@@ -537,7 +563,7 @@ public class GridNearLockRequest extends 
GridDistributedLockRequest {
 
     /** {@inheritDoc} */
     @Override public byte fieldsCount() {
-        return 34;
+        return 35;
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9875a639/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java
----------------------------------------------------------------------
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java
index cb01cff..588bdda 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/integration/IgniteCacheNoWriteThroughAbstractTest.java
@@ -225,7 +225,8 @@ public abstract class IgniteCacheNoWriteThroughAbstractTest 
extends IgniteCacheA
                         storeMap.put(key, key);
 
                         try (Transaction tx = 
ignite(0).transactions().txStart(concurrency, isolation)) {
-                            assertEquals(key, cache.getAndPut(key, -1));
+                            assertEquals("For concurrency=" + concurrency +
+                                ", isolation=" + isolation + ']', key, 
cache.getAndPut(key, -1));
 
                             tx.commit();
                         }

Reply via email to