IGNITE-10582: MVCC TX: Exception handling fixed. This closes #5839.
authorAndrey V. Mashenkov <andrey.mashenkov@gmail.com>
Thu, 14 Feb 2019 12:59:47 +0000 (15:59 +0300)
committerIgor Seliverstov <gvvinblade@gmail.com>
Thu, 14 Feb 2019 12:59:47 +0000 (15:59 +0300)
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxyImpl.java
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryFutureAdapter.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteClusterActivateDeactivateTestWithPersistence.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/IgniteRebalanceOnCachesStoppingOrDestroyingTest.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccTransactionsTest.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheAssignmentNodeRestartsTest.java
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/IgniteLogicalRecoveryTest.java

index a3ca605..a305e7c 100644 (file)
@@ -799,6 +799,9 @@ public class IgniteCacheProxyImpl<K, V> extends AsyncSupportAdapter<IgniteCache<
 
             return (QueryCursor<R>)query(qry, projection(qry.isLocal()));
         }
+        catch (IgniteCheckedException e) {
+            throw cacheException(e);
+        }
         catch (Exception e) {
             if (e instanceof CacheException)
                 throw (CacheException)e;
index 4330cd0..e316da5 100644 (file)
@@ -251,7 +251,7 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
         if (error() != null) {
             clear();
 
-            throw new IgniteCheckedException("Query execution failed: " + qry, error());
+            throw U.cast(error());
         }
     }
 
@@ -374,13 +374,16 @@ public abstract class GridCacheQueryFutureAdapter<K, V, R> extends GridFutureAda
                 synchronized (this) {
                     enqueue(Collections.emptyList());
 
-                    onDone(new IgniteCheckedException(nodeId != null ?
-                        S.toString("Failed to execute query on node",
-                            "query", qry, true,
-                            "nodeId", nodeId, false) :
-                        S.toString("Failed to execute query locally",
-                            "query", qry, true),
-                        err));
+                    if (err instanceof IgniteCheckedException)
+                        onDone(err);
+                    else
+                        onDone(new IgniteCheckedException(nodeId != null ?
+                            S.toString("Failed to execute query on node",
+                                "query", qry, true,
+                                "nodeId", nodeId, false) :
+                            S.toString("Failed to execute query locally",
+                                "query", qry, true),
+                            err));
 
                     onPage(nodeId, true);
 
index 24e76d4..c38809f 100644 (file)
@@ -42,9 +42,7 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.spi.IgniteSpiException;
 import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Test;
 
 import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
@@ -116,8 +114,6 @@ public class IgniteClusterActivateDeactivateTestWithPersistence extends IgniteCl
      */
     @Test
     public void testDeactivateInactiveCluster() throws Exception {
-        Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10582", MvccFeatureChecker.forcedMvcc());
-
         ccfgs = new CacheConfiguration[] {
             new CacheConfiguration<>("test_cache_1")
                 .setGroupName("test_cache")
index 6e04b12..49f35e3 100644 (file)
@@ -46,9 +46,7 @@ import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.lang.IgniteRunnable;
 import org.apache.ignite.plugin.extensions.communication.Message;
 import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi;
-import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assume;
 import org.junit.Test;
 
 /**
@@ -140,8 +138,6 @@ public class IgniteRebalanceOnCachesStoppingOrDestroyingTest extends GridCommonA
      * @throws Exception If failed.
      */
     private void testStopCachesOnDeactivation(String groupName) throws Exception {
-        Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10582", MvccFeatureChecker.forcedMvcc());
-
         performTest(ig -> {
             ig.cluster().active(false);
 
@@ -201,8 +197,6 @@ public class IgniteRebalanceOnCachesStoppingOrDestroyingTest extends GridCommonA
      * @throws Exception If failed.
      */
     private void testDestroySpecificCacheAndCacheGroup(String groupName) throws Exception {
-        Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10582", MvccFeatureChecker.forcedMvcc());
-
         performTest(ig -> {
             ig.destroyCaches(Arrays.asList(CACHE_1, CACHE_3, CACHE_4));
 
index 1459f0a..0d78daa 100644 (file)
@@ -1356,6 +1356,12 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
                         reader.apply(idx, caches, stop);
                     }
                     catch (Throwable e) {
+                        if (restartMode != null && X.hasCause(e, ClusterTopologyException.class)) {
+                            log.info("Writer error: " + e);
+
+                            return null;
+                        }
+
                         error("Unexpected error: " + e, e);
 
                         stop.set(true);
index 2542c50..ad19735 100644 (file)
@@ -2169,7 +2169,6 @@ public class CacheMvccTransactionsTest extends CacheMvccAbstractTest {
     /**
      * @throws Exception If failed.
      */
-    @Ignore("https://issues.apache.org/jira/browse/IGNITE-10582")
     @Test
     public void testNodesRestartNoHang() throws Exception {
         final int srvs = 4;
index a07388c..8832755 100644 (file)
@@ -42,9 +42,7 @@ import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
 import org.apache.ignite.internal.util.typedef.G;
 import org.apache.ignite.lang.IgniteUuid;
 import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.MvccFeatureChecker;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.junit.Assume;
 import org.junit.Test;
 
 import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
@@ -125,8 +123,6 @@ public class IgnitePdsCacheAssignmentNodeRestartsTest extends GridCommonAbstract
     @Test
     public void testAssignmentAfterRestarts() throws Exception {
         try {
-            Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-10582", MvccFeatureChecker.forcedMvcc());
-
             System.setProperty(IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC, "true");
 
             final int gridsCnt = 5;
index abbbaa4..6b23881 100644 (file)
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache.persistence.db;
 
+import com.google.common.collect.Lists;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -28,7 +29,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
-import com.google.common.collect.Lists;
 import org.apache.ignite.Ignite;
 import org.apache.ignite.IgniteCache;
 import org.apache.ignite.IgniteIllegalStateException;
@@ -61,7 +61,6 @@ import org.apache.ignite.testframework.GridTestUtils;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -258,7 +257,6 @@ public class IgniteLogicalRecoveryTest extends GridCommonAbstractTest {
     /**
      *
      */
-    @Ignore("https://issues.apache.org/jira/browse/IGNITE-10582")
     @Test
     public void testRecoveryWithMvccCaches() throws Exception {
         List<CacheConfiguration> dynamicCaches = Lists.newArrayList(