ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agoncha...@apache.org
Subject [49/50] [abbrv] ignite git commit: IGNITE-264 - Fixing compatibility
Date Thu, 03 Sep 2015 01:03:58 GMT
IGNITE-264 - Fixing compatibility


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

Branch: refs/heads/ignite-264
Commit: 7d5d9cd6b4c63f545f2f512db6b7e5cf62cbc531
Parents: da02efc
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Wed Sep 2 14:25:25 2015 -0700
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Wed Sep 2 14:25:25 2015 -0700

----------------------------------------------------------------------
 .../near/GridNearTxFinishFuture.java            | 20 +++++++++++++++++++-
 .../cache/transactions/IgniteTxHandler.java     |  4 +++-
 2 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5d9cd6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
index 9b9fe86..ddc8be5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxFinishFuture.java
@@ -50,6 +50,7 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.lang.IgniteClosure;
+import org.apache.ignite.lang.IgniteProductVersion;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.transactions.TransactionRollbackException;
 import org.jetbrains.annotations.Nullable;
@@ -63,6 +64,9 @@ import static org.apache.ignite.transactions.TransactionState.UNKNOWN;
 public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFuture<IgniteInternalTx>
     implements GridCacheFuture<IgniteInternalTx> {
     /** */
+    public static final IgniteProductVersion FINISH_NEAR_ONE_PHASE_SINCE = IgniteProductVersion.fromString("1.4.0");
+
+    /** */
     private static final long serialVersionUID = 0L;
 
     /** Logger reference. */
@@ -438,7 +442,12 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
                     finishReq.checkCommitted(true);
 
                     try {
-                        cctx.io().send(backup, finishReq, tx.ioPolicy());
+                        if (FINISH_NEAR_ONE_PHASE_SINCE.compareTo(backup.version()) <=
0)
+                            cctx.io().send(backup, finishReq, tx.ioPolicy());
+                        else
+                            mini.onDone(new IgniteTxHeuristicCheckedException("Failed to
check for tx commit on " +
+                                "the backup node (node has an old Ignite version) [rmtNodeId="
+ backup.id() +
+                                ", ver=" + backup.version() + ']'));
                     }
                     catch (ClusterTopologyCheckedException e) {
                         mini.onResult(e);
@@ -460,6 +469,8 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
         if (F.isEmpty(tx.mappings()))
             return false;
 
+        assert tx.mappings().size() == 1;
+
         boolean finish = false;
 
         for (Integer cacheId : tx.activeCacheIds()) {
@@ -472,6 +483,13 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             }
         }
 
+        if (finish) {
+            GridDistributedTxMapping mapping = F.first(tx.mappings().values());
+
+            if (FINISH_NEAR_ONE_PHASE_SINCE.compareTo(mapping.node().version()) > 0)
+                finish = false;
+        }
+
         return finish;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/7d5d9cd6/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 5627201..5ef5629 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
@@ -75,6 +75,7 @@ import org.jetbrains.annotations.Nullable;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.SYSTEM_POOL;
 import static org.apache.ignite.internal.managers.communication.GridIoPolicy.UTILITY_CACHE_POOL;
 import static org.apache.ignite.internal.processors.cache.GridCacheUtils.isNearEnabled;
+import static org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxFinishFuture.FINISH_NEAR_ONE_PHASE_SINCE;
 import static org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx.FinalizationStatus.USER_FINISH;
 import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
 import static org.apache.ignite.transactions.TransactionConcurrency.PESSIMISTIC;
@@ -392,7 +393,8 @@ public class IgniteTxHandler {
 
             tx.transactionNodes(req.transactionNodes());
 
-            if (req.near())
+            // Set near on originating node flag only if the sender node has new version.
+            if (req.near() && FINISH_NEAR_ONE_PHASE_SINCE.compareTo(nearNode.version())
<= 0)
                 tx.nearOnOriginatingNode(true);
 
             if (req.onePhaseCommit()) {


Mime
View raw message