Fixed IgniteClientCacheStartFailoverTest.testRebalanceStateConcurrentStart in MVCC mode. Fixes
@@ -28,6 +28,7 @@ import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
+import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.CacheAtomicityMode;
@@ -44,12 +45,14 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtAffini
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsFullMessage;
import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtPartitionTopology;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiPredicate;
import org.apache.ignite.lang.IgnitePredicate;
import org.apache.ignite.plugin.extensions.communication.Message;
import org.apache.ignite.testframework.GridTestUtils;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.TransactionSerializationException;
import org.junit.Ignore;
import org.junit.Test;
@@ -365,9 +368,29 @@ public class IgniteClientCacheStartFailoverTest extends GridCommonAbstractTest {
Map<Object, Object> map0 = cache.getAll(keys);
- assertEquals(KEYS, map0.size());
+ assertEquals("[cache=" + cacheName +
+ ", expected=" + KEYS +
+ ", actual=" + map0.size() + ']', KEYS, map0.size());
- cache.put(rnd.nextInt(KEYS), i);
+ int key = rnd.nextInt(KEYS);
+
+ try {
+ cache.put(key, i);
+ }
+ catch (CacheException e) {
+ log.error("It couldn't put a value [cache=" + cacheName +
+ ", key=" + key +
+ ", val=" + i + ']', e);
+
+ CacheConfiguration ccfg = cache.getConfiguration(CacheConfiguration.class);
+
+ TransactionSerializationException txEx = X.cause(e, TransactionSerializationException.class);
+
+ if (txEx == null ||
+ ccfg.getAtomicityMode() != TRANSACTIONAL_SNAPSHOT ||
+ !txEx.getMessage().contains("Cannot serialize transaction due to write conflict (transaction is marked for rollback)"))
+ fail("Assert violated because exception was thrown [e=" + e.getMessage() + ']');
+ }
}
}
