Repository: ignite Updated Branches: refs/heads/master ffe0f7108 -> c8f60b27b
IGNITE-9570: MVCC: fixed failures in CacheMvccSelectForUpdateQueryAbstractTest. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c8f60b27 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c8f60b27 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c8f60b27 Branch: refs/heads/master Commit: c8f60b27bc7143aa2c82e562b889ad20b55cc420 Parents: ffe0f71 Author: devozerov <[email protected]> Authored: Thu Sep 13 10:44:03 2018 +0300 Committer: devozerov <[email protected]> Committed: Thu Sep 13 10:44:03 2018 +0300 ---------------------------------------------------------------------- ...cheMvccSelectForUpdateQueryAbstractTest.java | 60 +++++++------------- 1 file changed, 22 insertions(+), 38 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/c8f60b27/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java index 8492d2a..152dc7e 100644 --- a/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java +++ b/modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccSelectForUpdateQueryAbstractTest.java @@ -17,23 +17,13 @@ package org.apache.ignite.internal.processors.cache.mvcc; -import java.sql.Connection; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.TimeUnit; -import javax.cache.CacheException; import org.apache.ignite.Ignite; import org.apache.ignite.IgniteCache; -import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.cache.QueryEntity; import org.apache.ignite.cache.query.FieldsQueryCursor; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.configuration.CacheConfiguration; -import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; import org.apache.ignite.internal.processors.query.IgniteSQLException; import org.apache.ignite.internal.util.typedef.X; import org.apache.ignite.internal.util.typedef.internal.U; @@ -42,6 +32,14 @@ import org.apache.ignite.transactions.Transaction; import org.apache.ignite.transactions.TransactionConcurrency; import org.apache.ignite.transactions.TransactionIsolation; +import javax.cache.CacheException; +import java.sql.Connection; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.TimeUnit; + import static org.apache.ignite.cache.CacheMode.PARTITIONED; import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.connect; import static org.apache.ignite.internal.processors.cache.index.AbstractSchemaSelfTest.execute; @@ -71,6 +69,8 @@ public abstract class CacheMvccSelectForUpdateQueryAbstractTest extends CacheMvc grid(0).addCacheConfiguration(seg); + Thread.sleep(1000L); + try (Connection c = connect(grid(0))) { execute(c, "create table person (id int primary key, firstName varchar, lastName varchar) " + "with \"atomicity=transactional,cache_name=Person\""); @@ -91,21 +91,6 @@ public abstract class CacheMvccSelectForUpdateQueryAbstractTest extends CacheMvc tx.commit(); } } - - AffinityTopologyVersion curVer = grid(0).context().cache().context().exchange().readyAffinityVersion(); - - AffinityTopologyVersion nextVer = curVer.nextMinorVersion(); - - // Let's wait for rebalance to complete. - for (int i = 0; i < 3; i++) { - IgniteEx node = grid(i); - - IgniteInternalFuture<AffinityTopologyVersion> fut = - node.context().cache().context().exchange().affinityReadyFuture(nextVer); - - if (fut != null) - fut.get(); - } } /** @@ -318,19 +303,17 @@ public abstract class CacheMvccSelectForUpdateQueryAbstractTest extends CacheMvc if (!locked) fut.get(TX_TIMEOUT); else { - GridTestUtils.assertThrows(null, new Callable<Object>() { - @Override public Object call() throws Exception { - try { - return fut.get(TX_TIMEOUT); - } - catch (IgniteCheckedException e) { - if (X.hasCause(e, CacheException.class)) - throw X.cause(e, CacheException.class); - - throw e; - } - } - }, CacheException.class, "IgniteTxTimeoutCheckedException"); + try { + fut.get(); + } + catch (Exception e) { + CacheException e0 = X.cause(e, CacheException.class); + + assert e0 != null; + + assert e0.getMessage() != null && + e0.getMessage().contains("Failed to acquire lock within provided timeout"); + } } } } @@ -362,6 +345,7 @@ public abstract class CacheMvccSelectForUpdateQueryAbstractTest extends CacheMvc * @param exMsg Expected message. * @param loc Local query flag. */ + @SuppressWarnings("ThrowableNotThrown") private void assertQueryThrows(String qry, String exMsg, boolean loc) { Ignite node = grid(0);
