ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [37/46] ignite git commit: IGNITE-257 - Fixed and uncommented tests.
Date Fri, 02 Oct 2015 10:58:51 GMT
IGNITE-257 - Fixed and uncommented tests.


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

Branch: refs/heads/ignite-1093-2
Commit: cdc5b49f31973d4c973dc465f7c01ce2eb4c8c89
Parents: 343191b
Author: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Authored: Fri Sep 25 17:58:51 2015 -0700
Committer: Alexey Goncharuk <alexey.goncharuk@gmail.com>
Committed: Fri Sep 25 17:58:51 2015 -0700

----------------------------------------------------------------------
 .../near/GridNearTxFinishFuture.java            |  4 +--
 .../cache/distributed/near/GridNearTxLocal.java | 19 +++++++++--
 .../transactions/IgniteTxLocalAdapter.java      | 35 ++++++++++++++------
 .../IgniteTxExceptionAbstractSelfTest.java      |  3 ++
 .../GridCacheColocatedTxExceptionSelfTest.java  |  5 ---
 .../near/GridCacheNearTxExceptionSelfTest.java  |  5 ---
 .../GridCacheReplicatedTxExceptionSelfTest.java |  5 ---
 .../GridCacheLocalTxExceptionSelfTest.java      |  5 ---
 8 files changed, 47 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/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 ab6dc3c..85311cc 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();
@@ -333,7 +333,7 @@ public final class GridNearTxFinishFuture<K, V> extends GridCompoundIdentityFutu
      * Initializes future.
      */
     void finish() {
-        if (tx.needCheckBackup()) {
+        if (tx.onNeedCheckBackup()) {
             assert tx.onePhaseCommit();
 
             checkBackup();

http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index a4e06c3..8975b4a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -114,7 +114,7 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     private Map<IgniteTxKey, IgniteCacheExpiryPolicy> accessMap;
 
     /** */
-    private boolean needCheckBackup;
+    private Boolean needCheckBackup;
 
     /** */
     private boolean hasRemoteLocks;
@@ -255,8 +255,23 @@ public class GridNearTxLocal extends GridDhtTxLocalAdapter {
     /**
      * @return If need to check tx commit on backup.
      */
+    public boolean onNeedCheckBackup() {
+        Boolean check = needCheckBackup;
+
+        if (check != null && check) {
+            needCheckBackup = false;
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * @return If backup check was requested.
+     */
     public boolean needCheckBackup() {
-        return needCheckBackup;
+        return needCheckBackup != null;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/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 6ca1f72..aa0ffe8 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
@@ -1120,11 +1120,13 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
             state(commit ? COMMITTED : ROLLED_BACK);
 
-            boolean needsCompletedVersions = commit && 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;
+            }
         }
     }
 
@@ -2895,11 +2897,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;
+                            }
                         }
                     }));
                 }
@@ -3118,9 +3126,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/cdc5b49f/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/cdc5b49f/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/cdc5b49f/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;
     }

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

http://git-wip-us.apache.org/repos/asf/ignite/blob/cdc5b49f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
index 2fae99b..63a900d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalTxExceptionSelfTest.java
@@ -27,11 +27,6 @@ import static org.apache.ignite.cache.CacheMode.LOCAL;
  */
 public class GridCacheLocalTxExceptionSelfTest extends IgniteTxExceptionAbstractSelfTest
{
     /** {@inheritDoc} */
-    @Override protected void beforeTestsStarted() throws Exception {
-        fail("https://issues.apache.org/jira/browse/IGNITE-257");
-    }
-
-    /** {@inheritDoc} */
     @Override protected int gridCount() {
         return 1;
     }


Mime
View raw message