ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [39/51] [abbrv] incubator-ignite git commit: IGNITE-264 - WIP
Date Wed, 25 Feb 2015 00:52:17 GMT
IGNITE-264 - WIP


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

Branch: refs/heads/ignite-264
Commit: ba7cbc045aab7073ddfe11d9f684c76681dc1caf
Parents: e929822
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Mon Feb 23 11:15:01 2015 -0800
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Mon Feb 23 11:15:01 2015 -0800

----------------------------------------------------------------------
 .../processors/cache/GridCacheMvcc.java         |  21 ---
 .../distributed/GridDistributedCacheEntry.java  |  11 +-
 .../distributed/dht/GridDhtCacheEntry.java      |   3 +-
 .../distributed/dht/GridDhtLockFuture.java      |  33 -----
 .../distributed/dht/GridDhtLockRequest.java     |  34 -----
 .../dht/GridDhtTransactionalCacheAdapter.java   |  16 +--
 .../cache/distributed/dht/GridDhtTxLocal.java   |   2 +-
 .../distributed/dht/GridDhtTxLocalAdapter.java  |   2 -
 .../distributed/near/GridNearLockRequest.java   |  43 +-----
 .../near/GridNearTransactionalCache.java        |   3 +-
 .../distributed/near/GridNearTxRemote.java      |   5 -
 .../cache/transactions/IgniteInternalTx.java    |   8 --
 .../cache/transactions/IgniteTxAdapter.java     |  10 --
 .../cache/transactions/IgniteTxHandler.java     |   2 +
 .../cache/GridCacheMvccPartitionedSelfTest.java |  38 ------
 .../processors/cache/GridCacheMvccSelfTest.java | 136 -------------------
 .../processors/cache/GridCacheTestEntryEx.java  |   8 --
 .../cache/IgniteOnePhaseCommitNearSelfTest.java |  79 ++++++++++-
 18 files changed, 89 insertions(+), 365 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
index 2e43365..18bcc05 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
@@ -323,27 +323,6 @@ public final class GridCacheMvcc<K> {
     }
 
     /**
-     * Puts owned versions in front of base.
-     *
-     * @param baseVer Base version.
-     * @param owned Owned list.
-     * @return Current owner.
-     */
-    @Nullable public GridCacheMvccCandidate<K> markOwned(GridCacheVersion baseVer,
GridCacheVersion owned) {
-        if (owned == null)
-            return anyOwner();
-
-        if (rmts != null) {
-            GridCacheMvccCandidate<K> baseCand = candidate(rmts, baseVer);
-
-            if (baseCand != null)
-                baseCand.ownerVersion(owned);
-        }
-
-        return anyOwner();
-    }
-
-    /**
      * @param parent Parent entry.
      * @param threadId Thread ID.
      * @param ver Lock version.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index c0e0bfd..cb7207d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -153,7 +153,6 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K,
V> {
      * @param timeout Lock acquire timeout.
      * @param tx Transaction flag.
      * @param implicitSingle Implicit flag.
-     * @param owned Owned candidate version.
      * @throws GridDistributedLockCancelledException If lock has been canceled.
      * @throws GridCacheEntryRemovedException If this entry is obsolete.
      */
@@ -164,8 +163,8 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K,
V> {
         GridCacheVersion ver,
         long timeout,
         boolean tx,
-        boolean implicitSingle,
-        @Nullable GridCacheVersion owned) throws GridDistributedLockCancelledException,
+        boolean implicitSingle
+    ) throws GridDistributedLockCancelledException,
         GridCacheEntryRemovedException {
         GridCacheMvccCandidate<K> prev;
         GridCacheMvccCandidate<K> owner;
@@ -202,9 +201,6 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K,
V> {
                 /*near-local*/false
             );
 
-            if (owned != null)
-                mvcc.markOwned(ver, owned);
-
             owner = mvcc.anyOwner();
 
             boolean emptyAfter = mvcc.isEmpty();
@@ -651,8 +647,7 @@ public class GridDistributedCacheEntry<K, V> extends GridCacheMapEntry<K,
V> {
                 tx.xidVersion(),
                 tx.timeout(),
                 true,
-                tx.implicitSingle(),
-                tx.ownedVersion(txKey())
+                tx.implicitSingle()
             );
 
             return true;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
index cf4f5df..40974a7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheEntry.java
@@ -255,8 +255,7 @@ public class GridDhtCacheEntry<K, V> extends GridDistributedCacheEntry<K,
V> {
                 tx.xidVersion(),
                 tx.timeout(),
                 /*tx*/true,
-                tx.implicit(),
-                null);
+                tx.implicit());
 
             return true;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/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 5a5d5e1..53c13ba 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
@@ -858,8 +858,6 @@ public final class GridDhtLockFuture<K, V> extends GridCompoundIdentityFuture<Bo
                             if (needVal)
                                 // Mark last added key as needed to be preloaded.
                                 req.markLastKeyForPreload();
-
-                            it.set(addOwned(req, e));
                         }
 
                         add(fut); // Append new future.
@@ -884,37 +882,6 @@ public final class GridDhtLockFuture<K, V> extends GridCompoundIdentityFuture<Bo
         }
     }
 
-    /**
-     * @param req Request.
-     * @param e Entry.
-     * @return Entry.
-     * @throws IgniteCheckedException If failed.
-     */
-    private GridDhtCacheEntry<K, V> addOwned(GridDhtLockRequest<K, V> req, GridDhtCacheEntry<K,
V> e)
-        throws IgniteCheckedException {
-        while (true) {
-            try {
-                GridCacheMvccCandidate<K> added = e.candidate(lockVer);
-
-                assert added != null;
-                assert added.dhtLocal();
-
-                if (added.ownerVersion() != null)
-                    req.owned(e.key(), e.getOrMarshalKeyBytes(), added.ownerVersion());
-
-                break;
-            }
-            catch (GridCacheEntryRemovedException ignore) {
-                if (log.isDebugEnabled())
-                    log.debug("Got removed entry when creating DHT lock request (will retry):
" + e);
-
-                e = cctx.dht().entryExx(e.key(), topVer);
-            }
-        }
-
-        return e;
-    }
-
     /** {@inheritDoc} */
     @Override public int hashCode() {
         return futId.hashCode();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
index b5952cb..eacefee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockRequest.java
@@ -22,7 +22,6 @@ import org.apache.ignite.internal.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.version.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
@@ -58,11 +57,6 @@ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K,
V> {
     /** Mini future ID. */
     private IgniteUuid miniId;
 
-    /** Owner mapped version, if any. */
-    @GridToStringInclude
-    @GridDirectTransient
-    private Map<K, GridCacheVersion> owned;
-
     /** Owner mapped version bytes. */
     private byte[] ownedBytes;
 
@@ -264,28 +258,6 @@ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K,
V> {
     }
 
     /**
-     * Sets owner and its mapped version.
-     *
-     * @param key Key.
-     * @param keyBytes Key bytes.
-     * @param ownerMapped Owner mapped version.
-     */
-    public void owned(K key, byte[] keyBytes, GridCacheVersion ownerMapped) {
-        if (owned == null)
-            owned = new GridLeanMap<>(3);
-
-        owned.put(key, ownerMapped);
-    }
-
-    /**
-     * @param key Key.
-     * @return Owner and its mapped versions.
-     */
-    @Nullable public GridCacheVersion owned(K key) {
-        return owned == null ? null : owned.get(key);
-    }
-
-    /**
      * @param idx Entry index to check.
      * @return {@code True} if near entry should be invalidated.
      */
@@ -313,9 +285,6 @@ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K,
V> {
         super.prepareMarshal(ctx);
 
         assert F.isEmpty(nearKeys) || !F.isEmpty(nearKeyBytes);
-
-        if (owned != null)
-            ownedBytes = CU.marshal(ctx, owned);
     }
 
     /** {@inheritDoc} */
@@ -324,9 +293,6 @@ public class GridDhtLockRequest<K, V> extends GridDistributedLockRequest<K,
V> {
 
         if (nearKeys == null && nearKeyBytes != null)
             nearKeys = unmarshalCollection(nearKeyBytes, ctx, ldr);
-
-        if (ownedBytes != null)
-            owned = ctx.marshaller().unmarshal(ownedBytes, ldr);
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/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 4cabb47..6a4ff97 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
@@ -233,8 +233,7 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends
GridDhtCach
                             req.version(),
                             req.timeout(),
                             tx != null,
-                            tx != null && tx.implicitSingle(),
-                            null
+                            tx != null && tx.implicitSingle()
                         );
 
                         // Invalidate key in near cache, if any.
@@ -667,18 +666,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends
GridDhtCach
 
         IgniteInternalFuture<Object> keyFut = null;
 
-        if (req.onePhaseCommit()) {
-            boolean forceKeys = req.hasTransforms() || req.filter() != null;
-
-            if (!forceKeys) {
-                for (int i = 0; i < req.keysCount() && !forceKeys; i++)
-                    forceKeys |= req.returnValue(i);
-            }
-
-            if (forceKeys)
-                keyFut = ctx.dht().dhtPreloader().request(keys, req.topologyVersion());
-        }
-
         if (keyFut == null)
             keyFut = new GridFinishedFutureEx<>();
 
@@ -824,7 +811,6 @@ public abstract class GridDhtTransactionalCacheAdapter<K, V> extends
GridDhtCach
                             IgniteInternalFuture<GridCacheReturn<V>> txFut =
tx.lockAllAsync(
                                 cacheCtx,
                                 entries,
-                                req.onePhaseCommit(),
                                 req.messageId(),
                                 req.txRead(),
                                 req.accessTtl());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
index 953956c..c07db74 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxLocal.java
@@ -116,7 +116,7 @@ public class GridDhtTxLocal<K, V> extends GridDhtTxLocalAdapter<K,
V> implements
     ) {
         super(
             cctx,
-            onePhaseCommit ? nearXidVer : cctx.versions().onReceivedAndNext(nearNodeId, nearXidVer),
+            cctx.versions().onReceivedAndNext(nearNodeId, nearXidVer),
             implicit,
             implicitSingle,
             sys,

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/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 3ea25ca..c9be37a 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
@@ -472,7 +472,6 @@ public abstract class GridDhtTxLocalAdapter<K, V> extends IgniteTxLocalAdapter<K
     /**
      * @param cacheCtx Cache context.
      * @param entries Entries to lock.
-     * @param onePhaseCommit One phase commit flag.
      * @param msgId Message ID.
      * @param read Read flag.
      * @param accessTtl TTL for read operation.
@@ -482,7 +481,6 @@ public abstract class GridDhtTxLocalAdapter<K, V> extends IgniteTxLocalAdapter<K
     IgniteInternalFuture<GridCacheReturn<V>> lockAllAsync(
         GridCacheContext<K, V> cacheCtx,
         List<GridCacheEntryEx<K, V>> entries,
-        boolean onePhaseCommit,
         long msgId,
         final boolean read,
         long accessTtl

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/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 df59ac4..7ae59b5 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
@@ -60,9 +60,6 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
     /** Implicit transaction with one key flag. */
     private boolean implicitSingleTx;
 
-    /** One phase commit flag. */
-    private boolean onePhaseCommit;
-
     /** Array of mapped DHT versions for this entry. */
     @GridToStringInclude
     private GridCacheVersion[] dhtVers;
@@ -195,20 +192,6 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
     }
 
     /**
-     * @return One phase commit flag.
-     */
-    public boolean onePhaseCommit() {
-        return onePhaseCommit;
-    }
-
-    /**
-     * @param onePhaseCommit One phase commit flag.
-     */
-    public void onePhaseCommit(boolean onePhaseCommit) {
-        this.onePhaseCommit = onePhaseCommit;
-    }
-
-    /**
      * @return Sync commit flag.
      */
     public boolean syncCommit() {
@@ -372,30 +355,24 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
                 writer.incrementState();
 
             case 25:
-                if (!writer.writeBoolean("onePhaseCommit", onePhaseCommit))
-                    return false;
-
-                writer.incrementState();
-
-            case 26:
                 if (!writer.writeUuid("subjId", subjId))
                     return false;
 
                 writer.incrementState();
 
-            case 27:
+            case 26:
                 if (!writer.writeBoolean("syncCommit", syncCommit))
                     return false;
 
                 writer.incrementState();
 
-            case 28:
+            case 27:
                 if (!writer.writeInt("taskNameHash", taskNameHash))
                     return false;
 
                 writer.incrementState();
 
-            case 29:
+            case 28:
                 if (!writer.writeLong("topVer", topVer))
                     return false;
 
@@ -471,14 +448,6 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
                 readState++;
 
             case 25:
-                onePhaseCommit = reader.readBoolean("onePhaseCommit");
-
-                if (!reader.isLastRead())
-                    return false;
-
-                readState++;
-
-            case 26:
                 subjId = reader.readUuid("subjId");
 
                 if (!reader.isLastRead())
@@ -486,7 +455,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
 
                 readState++;
 
-            case 27:
+            case 26:
                 syncCommit = reader.readBoolean("syncCommit");
 
                 if (!reader.isLastRead())
@@ -494,7 +463,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
 
                 readState++;
 
-            case 28:
+            case 27:
                 taskNameHash = reader.readInt("taskNameHash");
 
                 if (!reader.isLastRead())
@@ -502,7 +471,7 @@ public class GridNearLockRequest<K, V> extends GridDistributedLockRequest<K,
V>
 
                 readState++;
 
-            case 29:
+            case 28:
                 topVer = reader.readLong("topVer");
 
                 if (!reader.isLastRead())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
index f1d96d8..8f4700f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTransactionalCache.java
@@ -318,8 +318,7 @@ public class GridNearTransactionalCache<K, V> extends GridNearCacheAdapter<K,
V>
                                 req.version(),
                                 req.timeout(),
                                 tx != null,
-                                tx != null && tx.implicitSingle(),
-                                req.owned(entry.key())
+                                tx != null && tx.implicitSingle()
                             );
 
                             assert cands.isEmpty() : "Received non-empty candidates in dht
lock request: " + cands;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
index 6bbf0b4..fd0105e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxRemote.java
@@ -178,11 +178,6 @@ public class GridNearTxRemote<K, V> extends GridDistributedTxRemoteAdapter<K,
V>
         return false; // Serializable will be enforced on primary mode.
     }
 
-    /** {@inheritDoc} */
-    @Override public GridCacheVersion ownedVersion(IgniteTxKey<K> key) {
-        return owned == null ? null : owned.get(key);
-    }
-
     /**
      * @return Near transaction ID.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
index 43735fe..f497316 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteInternalTx.java
@@ -296,14 +296,6 @@ public interface IgniteInternalTx<K, V> extends AutoCloseable,
GridTimeoutObject
     public Set<Integer> invalidPartitions();
 
     /**
-     * Gets owned version for near remote transaction.
-     *
-     * @param key Key to get version for.
-     * @return Owned version, if any.
-     */
-    @Nullable public GridCacheVersion ownedVersion(IgniteTxKey<K> key);
-
-    /**
      * Gets ID of additional node involved. For example, in DHT case, other node is
      * near node ID.
      *

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 6d5e60c..fc0153d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -632,11 +632,6 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
     }
 
     /** {@inheritDoc} */
-    @Override public GridCacheVersion ownedVersion(IgniteTxKey<K> key) {
-        return null;
-    }
-
-    /** {@inheritDoc} */
     @Override public long startTime() {
         return startTime;
     }
@@ -1637,11 +1632,6 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
         }
 
         /** {@inheritDoc} */
-        @Nullable @Override public GridCacheVersion ownedVersion(IgniteTxKey key) {
-            throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
-        }
-
-        /** {@inheritDoc} */
         @Nullable @Override public UUID otherNodeId() {
             throw new IllegalStateException("Deserialized transaction can only be used as
read-only.");
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
index 604a737..880d6a5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxHandler.java
@@ -296,6 +296,8 @@ public class IgniteTxHandler<K, V> {
             if (req.onePhaseCommit()) {
                 assert req.last();
                 assert F.isEmpty(req.lastBackups()) || req.lastBackups().size() <= 1;
+
+                tx.onePhaseCommit(true);
             }
 
             if (req.returnValue())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
index 71cb0fc..7dddd3a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccPartitionedSelfTest.java
@@ -156,44 +156,6 @@ public class GridCacheMvccPartitionedSelfTest extends GridCommonAbstractTest
{
     }
 
     /**
-     * Tests remote candidates.
-     */
-    public void testNearLocalsWithOwned() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
-
-        GridCacheTestEntryEx<String, String> entry = new GridCacheTestEntryEx<>(cache.context(),
"1");
-
-        UUID node1 = UUID.randomUUID();
-
-        GridCacheVersion ver1 = version(1);
-        GridCacheVersion ver2 = version(2);
-
-        GridCacheMvccCandidate<String> c1 = entry.addRemote(node1, 1, ver1, 0, false,
true);
-        GridCacheMvccCandidate<String> c2 = entry.addNearLocal(node1, 1, ver2, 0, true);
-
-        Collection<GridCacheMvccCandidate<String>> rmtCands = entry.remoteMvccSnapshot();
-        Collection<GridCacheMvccCandidate<String>> nearLocCands = entry.localCandidates();
-
-        assertEquals(1, nearLocCands.size());
-        assertEquals(ver2, nearLocCands.iterator().next().version());
-
-        assertEquals(1, rmtCands.size());
-        assertEquals(ver1, rmtCands.iterator().next().version());
-
-        entry.orderOwned(ver1, ver2);
-
-        entry.readyNearLocal(ver2, ver2);
-
-        checkRemote(c1, ver1, false, false);
-
-        assertFalse(c1.owner());
-
-        checkLocal(c2, ver2, true, false, false);
-
-        assertNull(entry.anyOwner());
-    }
-
-    /**
      * Tests salvageRemote method
      */
     public void testSalvageRemote() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
index ade4966..c197102 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java
@@ -255,142 +255,6 @@ public class GridCacheMvccSelfTest extends GridCommonAbstractTest {
     }
 
     /**
-     * Tests that orderOwned does not reorder owned locks.
-     */
-    public void testNearRemoteWithOwned() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
-
-        GridCacheTestEntryEx<String, String> entry = new GridCacheTestEntryEx<>(cache.context(),
"1");
-
-        UUID node1 = UUID.randomUUID();
-
-        GridCacheVersion ver1 = version(1);
-        GridCacheVersion ver2 = version(2);
-        GridCacheVersion ver3 = version(3);
-        GridCacheVersion ver4 = version(4);
-
-        GridCacheMvccCandidate<String> c1 = entry.addRemote(node1, 1, ver1, 0, false,
true);
-        GridCacheMvccCandidate<String> c2 = entry.addRemote(node1, 1, ver2, 0, false,
true);
-        GridCacheMvccCandidate<String> c3 = entry.addRemote(node1, 1, ver3, 0, false,
true);
-        GridCacheMvccCandidate<String> c4 = entry.addRemote(node1, 1, ver4, 0, false,
true);
-
-        GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c1, c2, c3, c4};
-
-        Collection<GridCacheMvccCandidate<String>> rmtCands = entry.remoteMvccSnapshot();
-
-        assert rmtCands.size() == 4;
-        assert rmtCands.iterator().next().version().equals(ver1);
-
-        entry.orderOwned(ver1, ver2);
-
-        rmtCands = entry.remoteMvccSnapshot();
-
-        int i = 0;
-
-        for (GridCacheMvccCandidate<String> cand : rmtCands) {
-            assertTrue(cand == candArr[i]);
-
-            assertTrue(ver2.equals(cand.ownerVersion()) || cand != c1);
-
-            i++;
-        }
-    }
-
-    /**
-     * Tests that orderOwned does not reorder owned locks.
-     */
-    public void testNearRemoteWithOwned1() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
-
-        GridCacheTestEntryEx<String, String> entry = new GridCacheTestEntryEx<>(cache.context(),
"1");
-
-        UUID node1 = UUID.randomUUID();
-
-        GridCacheVersion ver1 = version(1);
-        GridCacheVersion ver2 = version(2);
-        GridCacheVersion ver3 = version(3);
-        GridCacheVersion ver4 = version(4);
-        GridCacheVersion ver5 = version(5);
-        GridCacheVersion ver6 = version(6);
-
-        GridCacheMvccCandidate<String> c1 = entry.addRemote(node1, 1, ver1, 0, false,
true);
-        GridCacheMvccCandidate<String> c2 = entry.addRemote(node1, 1, ver2, 0, false,
true);
-        GridCacheMvccCandidate<String> c3 = entry.addRemote(node1, 1, ver3, 0, false,
true);
-        GridCacheMvccCandidate<String> c4 = entry.addRemote(node1, 1, ver4, 0, false,
true);
-        GridCacheMvccCandidate<String> c5 = entry.addRemote(node1, 1, ver5, 0, false,
true);
-        GridCacheMvccCandidate<String> c6 = entry.addRemote(node1, 1, ver6, 0, false,
true);
-
-        GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c1, c2, c3, c4,
c5, c6};
-
-        Collection<GridCacheMvccCandidate<String>> cands = entry.remoteMvccSnapshot();
-
-        assert cands.size() == 6;
-        assert cands.iterator().next().version().equals(ver1);
-
-        entry.orderOwned(ver1, ver3);
-
-        cands = entry.remoteMvccSnapshot();
-
-        int i = 0;
-
-        for (GridCacheMvccCandidate<String> cand : cands) {
-            assert cand == candArr[i];
-
-            assertTrue(ver3.equals(cand.ownerVersion()) || cand != c1);
-
-            i++;
-        }
-    }
-
-    /**
-     * Tests that orderOwned does not reorder owned locks.
-     */
-    public void testNearRemoteWithOwned2() {
-        GridCacheAdapter<String, String> cache = grid.internalCache();
-
-        GridCacheTestEntryEx<String, String> entry = new GridCacheTestEntryEx<>(cache.context(),
"1");
-
-        UUID node1 = UUID.randomUUID();
-
-        GridCacheVersion ver0 = version(0);
-        GridCacheVersion ver1 = version(1);
-        GridCacheVersion ver2 = version(2);
-        GridCacheVersion ver3 = version(3);
-        GridCacheVersion ver4 = version(4);
-        GridCacheVersion ver5 = version(5);
-        GridCacheVersion ver6 = version(6);
-
-        GridCacheMvccCandidate<String> c0 = entry.addRemote(node1, 1, ver0, 0, false,
true);
-        GridCacheMvccCandidate<String> c1 = entry.addRemote(node1, 1, ver1, 0, false,
true);
-        GridCacheMvccCandidate<String> c2 = entry.addRemote(node1, 1, ver2, 0, false,
true);
-        GridCacheMvccCandidate<String> c3 = entry.addRemote(node1, 1, ver3, 0, false,
true);
-        GridCacheMvccCandidate<String> c4 = entry.addRemote(node1, 1, ver4, 0, false,
true);
-        GridCacheMvccCandidate<String> c5 = entry.addRemote(node1, 1, ver5, 0, false,
true);
-        GridCacheMvccCandidate<String> c6 = entry.addRemote(node1, 1, ver6, 0, false,
true);
-
-        GridCacheMvccCandidate[] candArr = new GridCacheMvccCandidate[] {c0, c1, c2, c3,
c4, c5, c6};
-
-        Collection<GridCacheMvccCandidate<String>> cands = entry.remoteMvccSnapshot();
-
-        assert cands.size() == 7;
-        assert cands.iterator().next().version().equals(ver0);
-
-        entry.orderOwned(ver1, ver2);
-
-        cands = entry.remoteMvccSnapshot();
-
-        int i = 0;
-
-        for (GridCacheMvccCandidate<String> cand : cands) {
-            assert cand == candArr[i];
-
-            assertTrue(ver2.equals(cand.ownerVersion()) || cand != c1);
-
-            i++;
-        }
-    }
-
-    /**
      * Tests remote candidates.
      */
     public void testLocal() {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 094c815..8263f76 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -204,14 +204,6 @@ public class GridCacheTestEntryEx<K, V> extends GridMetadataAwareAdapter
impleme
     }
 
     /**
-     * @param baseVer Base version.
-     * @param owned Owned.
-     */
-    public void orderOwned(GridCacheVersion baseVer, GridCacheVersion owned) {
-        mvcc.markOwned(baseVer, owned);
-    }
-
-    /**
      * @param ver Lock version to acquire or set to ready.
      * @return Current owner.
      */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba7cbc04/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
index 5fc3be1..d57482e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteOnePhaseCommitNearSelfTest.java
@@ -20,14 +20,29 @@ package org.apache.ignite.internal.processors.cache;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
 import org.apache.ignite.cache.affinity.*;
+import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.managers.communication.*;
+import org.apache.ignite.internal.processors.cache.distributed.dht.*;
+import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.util.lang.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+import org.apache.ignite.plugin.extensions.communication.*;
+import org.apache.ignite.spi.*;
+import org.apache.ignite.spi.communication.tcp.*;
 import org.apache.ignite.testframework.*;
 import org.apache.ignite.testframework.junits.common.*;
 import org.apache.ignite.transactions.*;
 
 import javax.cache.*;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.*;
+
+import static org.apache.ignite.transactions.TransactionConcurrency.*;
+import static org.apache.ignite.transactions.TransactionIsolation.*;
 
 /**
  * Checks one-phase commit scenarios.
@@ -39,12 +54,19 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest
{
     /** */
     private int backups = 1;
 
+    /** */
+    private static Map<Class<?>, AtomicInteger> msgCntMap = new ConcurrentHashMap<>();
+
     /** {@inheritDoc} */
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
         cfg.setCacheConfiguration(cacheConfiguration(gridName));
 
+        cfg.getTransactionConfiguration().setTxSerializableEnabled(true);
+
+        cfg.setCommunicationSpi(new MessageCountingCommunicationSpi());
+
         return cfg;
     }
 
@@ -93,10 +115,13 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest
{
     private void checkKey(IgniteTransactions transactions, Cache<Object, Object> cache,
int key) throws Exception {
         cache.put(key, key);
 
-        finalCheck(key);
+        finalCheck(key, true);
+
+        TransactionIsolation[] isolations = {READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE};
+        TransactionConcurrency[] concurrencies = {OPTIMISTIC, PESSIMISTIC};
 
-        for (TransactionIsolation isolation : TransactionIsolation.values()) {
-            for (TransactionConcurrency concurrency : TransactionConcurrency.values()) {
+        for (TransactionIsolation isolation : isolations) {
+            for (TransactionConcurrency concurrency : concurrencies) {
                 info("Checking transaction [isolation=" + isolation + ", concurrency=" +
concurrency + ']');
 
                 try (Transaction tx = transactions.txStart(concurrency, isolation)) {
@@ -105,7 +130,7 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest
{
                     tx.commit();
                 }
 
-                finalCheck(key);
+                finalCheck(key, true);
             }
         }
     }
@@ -113,7 +138,7 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest
{
     /**
      * @throws Exception If failed.
      */
-    private void finalCheck(final int key) throws Exception {
+    private void finalCheck(final int key, boolean onePhase) throws Exception {
         GridTestUtils.waitForCondition(new GridAbsPredicate() {
             @Override public boolean apply() {
                 try {
@@ -150,6 +175,27 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest
{
                 }
             }
         }, 10_000);
+
+        if (onePhase) {
+            assertMessageCount(GridNearTxPrepareRequest.class, 1);
+            assertMessageCount(GridDhtTxPrepareRequest.class, 1);
+            assertMessageCount(GridNearTxFinishRequest.class, 1);
+            assertMessageCount(GridDhtTxFinishRequest.class, 0);
+
+            msgCntMap.clear();
+        }
+    }
+
+    /**
+     * @param cls Class to check.
+     * @param cnt Expected count.
+     */
+    private void assertMessageCount(Class<?> cls, int cnt) {
+        AtomicInteger val = msgCntMap.get(cls);
+
+        int iVal = val == null ? 0 : val.get();
+
+        assertEquals("Invalid message count for class: " + cls.getSimpleName(), cnt, iVal);
     }
 
     /**
@@ -170,4 +216,27 @@ public class IgniteOnePhaseCommitNearSelfTest extends GridCommonAbstractTest
{
             key++;
         }
     }
+
+    /**
+     *
+     */
+    private static class MessageCountingCommunicationSpi extends TcpCommunicationSpi {
+        /** {@inheritDoc} */
+        @Override public void sendMessage(ClusterNode node, MessageAdapter msg) throws IgniteSpiException
{
+            if (msg instanceof GridIoMessage) {
+                GridIoMessage ioMsg = (GridIoMessage)msg;
+
+                Class<?> cls = ioMsg.message().getClass();
+
+                AtomicInteger cntr = msgCntMap.get(cls);
+
+                if (cntr == null)
+                    cntr = F.addIfAbsent(msgCntMap, cls, new AtomicInteger());
+
+                cntr.incrementAndGet();
+            }
+
+            super.sendMessage(node, msg);
+        }
+    }
 }


Mime
View raw message