You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/09/19 14:46:11 UTC
[45/50] [abbrv] ignite git commit: IGNITE-6181 wip.
IGNITE-6181 wip.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eebaa6bd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eebaa6bd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eebaa6bd
Branch: refs/heads/ignite-6181-1
Commit: eebaa6bd064705516a85a8dc90a4f252e652390e
Parents: 1310008
Author: Aleksei Scherbakov <al...@gmail.com>
Authored: Fri Sep 15 13:30:45 2017 +0300
Committer: Aleksei Scherbakov <al...@gmail.com>
Committed: Fri Sep 15 13:30:45 2017 +0300
----------------------------------------------------------------------
...niteTxConfigCacheForceTxTimeoutSelfTest.java | 39 ----------------
...ollbackOnTimeoutNoDeadlockDetectionTest.java | 47 ++++++++++++++++++++
.../transactions/TxRollbackOnTimeoutTest.java | 24 +++++++++-
.../ignite/testsuites/IgniteCacheTestSuite.java | 4 +-
4 files changed, 72 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eebaa6bd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheForceTxTimeoutSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheForceTxTimeoutSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheForceTxTimeoutSelfTest.java
deleted file mode 100644
index 4420a4e..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteTxConfigCacheForceTxTimeoutSelfTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import static org.apache.ignite.IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS;
-
-/**
- * Test checks that grid transaction configuration doesn't influence system caches.
- */
-public class IgniteTxConfigCacheForceTxTimeoutSelfTest extends IgniteTxConfigCacheSelfTest {
- /** {@inheritDoc} */
- @Override protected void beforeTestsStarted() throws Exception {
- System.setProperty(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, "0");
-
- super.beforeTestsStarted();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTestsStopped() throws Exception {
- super.afterTestsStopped();
-
- System.clearProperty(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/eebaa6bd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutNoDeadlockDetectionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutNoDeadlockDetectionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutNoDeadlockDetectionTest.java
new file mode 100644
index 0000000..77c383e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutNoDeadlockDetectionTest.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache.transactions;
+
+import org.apache.ignite.transactions.TransactionTimeoutException;
+
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS;
+
+/**
+ * Tests an ability to eagerly rollback timed out transactions.
+ */
+public class TxRollbackOnTimeoutNoDeadlockDetectionTest extends TxRollbackOnTimeoutTest {
+ /** {@inheritDoc} */
+ @Override protected void beforeTestsStarted() throws Exception {
+ System.setProperty(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS, "0");
+
+ super.beforeTestsStarted();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTestsStopped() throws Exception {
+ super.afterTestsStopped();
+
+ System.clearProperty(IGNITE_TX_DEADLOCK_DETECTION_MAX_ITERS);
+ }
+
+ /** */
+ @Override protected void validateException(Exception e) {
+ assertEquals("Deadlock report is expected",
+ TransactionTimeoutException.class, e.getCause().getClass());
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/eebaa6bd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
index 4bbff17..cdf1f00 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/transactions/TxRollbackOnTimeoutTest.java
@@ -110,6 +110,12 @@ public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest {
stopAllGrids();
}
+ /** */
+ protected void validateException(Exception e) {
+ assertEquals("Deadlock report is expected",
+ TransactionDeadlockException.class, e.getCause().getCause().getClass());
+ }
+
/**
* Tests if timeout on first tx unblocks second tx waiting for the locked key.
*
@@ -276,7 +282,7 @@ public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest {
}
} catch (CacheException e) {
// No-op.
- assertTrue(X.hasCause(e, TransactionDeadlockException.class));
+ validateException(e);
}
}
}, 1, "First");
@@ -534,4 +540,20 @@ public class TxRollbackOnTimeoutTest extends GridCommonAbstractTest {
fut2.get();
}
+
+ /**
+ * Returns root cause for an exception.
+ * @param t Throwable.
+ *
+ * @return Root cause or input if none.
+ */
+ private static Throwable getRootCause(Throwable t) {
+ Throwable cause;
+ Throwable res = t;
+
+ while(null != (cause = res.getCause()) && (res != cause) )
+ res = cause;
+
+ return res;
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/eebaa6bd/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
index 35331e9..bf01c0c 100755
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite.java
@@ -102,7 +102,6 @@ import org.apache.ignite.internal.processors.cache.IgniteClientAffinityAssignmen
import org.apache.ignite.internal.processors.cache.IgniteIncompleteCacheObjectSelfTest;
import org.apache.ignite.internal.processors.cache.IgnitePutAllLargeBatchSelfTest;
import org.apache.ignite.internal.processors.cache.IgnitePutAllUpdateNonPreloadedPartitionSelfTest;
-import org.apache.ignite.internal.processors.cache.IgniteTxConfigCacheForceTxTimeoutSelfTest;
import org.apache.ignite.internal.processors.cache.IgniteTxConfigCacheSelfTest;
import org.apache.ignite.internal.processors.cache.context.IgniteCacheAtomicExecutionContextTest;
import org.apache.ignite.internal.processors.cache.context.IgniteCacheContinuousExecutionContextTest;
@@ -135,6 +134,7 @@ import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCa
import org.apache.ignite.internal.processors.cache.local.GridCacheLocalTxExceptionSelfTest;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheEntryProcessorExternalizableFailedTest;
import org.apache.ignite.internal.processors.cache.query.continuous.CacheEntryProcessorNonSerializableTest;
+import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutNoDeadlockDetectionTest;
import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutTest;
import org.apache.ignite.internal.processors.datastreamer.DataStreamProcessorSelfTest;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerImplSelfTest;
@@ -303,7 +303,6 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(CachePutEventListenerErrorSelfTest.class);
suite.addTestSuite(IgniteTxConfigCacheSelfTest.class);
- suite.addTestSuite(IgniteTxConfigCacheForceTxTimeoutSelfTest.class);
suite.addTestSuite(CacheTxFastFinishTest.class);
@@ -318,6 +317,7 @@ public class IgniteCacheTestSuite extends TestSuite {
suite.addTestSuite(IgniteIncompleteCacheObjectSelfTest.class);
suite.addTestSuite(TxRollbackOnTimeoutTest.class);
+ suite.addTestSuite(TxRollbackOnTimeoutNoDeadlockDetectionTest.class);
return suite;
}