You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2015/09/14 19:36:00 UTC

ignite git commit: IGNITE-257 - Heuristic exception fixes.

Repository: ignite
Updated Branches:
  refs/heads/ignite-257 [created] dce579200


IGNITE-257 - Heuristic exception fixes.


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

Branch: refs/heads/ignite-257
Commit: dce57920007d06ce93ca44cc836a8836e892e435
Parents: e5f1681
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Sep 14 10:35:38 2015 -0700
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Sep 14 10:35:38 2015 -0700

----------------------------------------------------------------------
 .../near/GridNearTxFinishFuture.java            |  2 +-
 .../transactions/IgniteTxLocalAdapter.java      | 35 ++++++++++++++------
 .../IgniteTxExceptionAbstractSelfTest.java      |  3 ++
 .../GridCacheColocatedTxExceptionSelfTest.java  |  5 ---
 .../near/GridCacheNearTxExceptionSelfTest.java  |  5 ---
 5 files changed, 29 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/dce57920/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 ddc8be5..0818e72 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
@@ -268,7 +268,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
             if (tx.onePhaseCommit()) {
                 finishOnePhase();
 
-                tx.tmFinish(err == null);
+                tx.tmFinish(commit && err == null);
             }
 
             Throwable th = this.err.get();

http://git-wip-us.apache.org/repos/asf/ignite/blob/dce57920/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 00b91dd..77e6275 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
@@ -1118,11 +1118,13 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
             state(commit ? COMMITTED : ROLLED_BACK);
 
-            boolean needsCompletedVersions = needsCompletedVersions();
+            if (commit) {
+                boolean needsCompletedVersions = needsCompletedVersions();
 
-            assert !needsCompletedVersions || completedBase != null;
-            assert !needsCompletedVersions || committedVers != null;
-            assert !needsCompletedVersions || rolledbackVers != null;
+                assert !needsCompletedVersions || completedBase != null : "Missing completed base for transaction: " + this;
+                assert !needsCompletedVersions || committedVers != null : "Missing committed versions for transaction: " + this;
+                assert !needsCompletedVersions || rolledbackVers != null : "Missing rolledback versions for transaction: " + this;
+            }
         }
     }
 
@@ -2893,11 +2895,17 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     }
 
                     return nonInterruptable(commitAsync().chain(new CX1<IgniteInternalFuture<IgniteInternalTx>, GridCacheReturn>() {
-                        @Override
-                        public GridCacheReturn applyx(IgniteInternalFuture<IgniteInternalTx> txFut) throws IgniteCheckedException {
-                            txFut.get();
+                        @Override public GridCacheReturn applyx(IgniteInternalFuture<IgniteInternalTx> txFut) throws IgniteCheckedException {
+                            try {
+                                txFut.get();
+
+                                return implicitRes;
+                            }
+                            catch (IgniteCheckedException | RuntimeException e) {
+                                rollbackAsync();
 
-                            return implicitRes;
+                                throw e;
+                            }
                         }
                     }));
                 }
@@ -3116,9 +3124,16 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                     return nonInterruptable(commitAsync().chain(new CX1<IgniteInternalFuture<IgniteInternalTx>, GridCacheReturn>() {
                         @Override public GridCacheReturn applyx(IgniteInternalFuture<IgniteInternalTx> txFut)
                             throws IgniteCheckedException {
-                            txFut.get();
+                            try {
+                                txFut.get();
 
-                            return implicitRes;
+                                return implicitRes;
+                            }
+                            catch (IgniteCheckedException | RuntimeException e) {
+                                rollbackAsync();
+
+                                throw e;
+                            }
                         }
                     }));
                 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/dce57920/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
index 10b47fe..3311608 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxExceptionAbstractSelfTest.java
@@ -368,6 +368,9 @@ public abstract class IgniteTxExceptionAbstractSelfTest extends GridCacheAbstrac
 
         for (Integer key : keys)
             checkUnlocked(key);
+
+        for (int i = 0; i < gridCount(); i++)
+            assertEquals(0, ((IgniteKernal)ignite(0)).internalCache(null).context().tm().idMapSize());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/dce57920/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
index 5514ff6..b5d79e1 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridCacheColocatedTxExceptionSelfTest.java
@@ -28,11 +28,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
  */
 public class GridCacheColocatedTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
-    }
-
-    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return PARTITIONED;
     }

http://git-wip-us.apache.org/repos/asf/ignite/blob/dce57920/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
index 67bccac..d6e3804 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearTxExceptionSelfTest.java
@@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
  */
 public class GridCacheNearTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest {
     /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
-    }
-
-    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return PARTITIONED;
     }