/** {@inheritDoc} */ @Override protected void afterTest() throws Exception { super.afterTest(); cleanPersistenceDir(); } }
/** * @return Started client. * @throws Exception If f nodeailed. */ private Ignite startClient() throws Exception { Ignite client = startGrid("client"); assertTrue(client.configuration().isClientMode()); if (nearCacheEnabled()) client.createNearCache(CACHE_NAME, new NearCacheConfiguration<>()); else assertNotNull(client.cache(CACHE_NAME)); return client; }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { super.beforeTest(); final IgniteEx crd = startGrid(0); startGridsMultiThreaded(1, GRID_CNT - 1); crd.cluster().active(true); awaitPartitionMapExchange(); }
final Ignite client = startClient(); grid(0).cache(CACHE_NAME).put(k, 0L); IgniteInternalFuture<?> txFut = multithreadedAsync(() -> { while (!stop.get()) { int nodeId = r.nextInt(GRID_CNT + 1); Ignite node = nodeId == GRID_CNT || nearCacheEnabled() ? client : grid(nodeId); fail("Unexpected opcode"); IgniteInternalFuture<?> rollbackFut = multithreadedAsync(() -> { while (!interrupted()) { Ignite node = nodeId == GRID_CNT || nearCacheEnabled() ? client : grid(nodeId); rolledBack.increment(); doSleep(r.nextInt(50)); // Add random sleep to increase completed txs count. info("Rolled back so far: " + rolledBack.sum()); doSleep(DURATION); assertEquals("total != completed + failed", total.sum(), completed.sum() + failed.sum()); checkFutures();
final Ignite client = startClient(); final Ignite prim = primaryNode(0, CACHE_NAME); assertTrue(X.hasCause(e, TransactionRollbackException.class)); doSleep(500); checkFutures();
/** * */ private void testEnlistMany(boolean write, TransactionIsolation isolation, TransactionConcurrency conc) throws Exception { final Ignite client = startClient(); Map<Integer, Integer> entries = new HashMap<>(); for (int i = 0; i < 1000000; i++) entries.put(i, i); IgniteInternalFuture<?> fut = null; try (Transaction tx = client.transactions().txStart(conc, isolation, 0, 0)) { fut = rollbackAsync(tx, 200); if (write) client.cache(CACHE_NAME).putAll(entries); else client.cache(CACHE_NAME).getAll(entries.keySet()); tx.commit(); fail("Commit must fail"); } catch (Throwable t) { assertTrue(X.hasCause(t, TransactionRollbackException.class)); } fut.get(); assertEquals(0, client.cache(CACHE_NAME).size()); checkFutures(); }
assertNull(near.cache(CACHE_NAME).get(0)); assertEquals(1, near.cache(CACHE_NAME).get(0)); rollbackAsync(tx).get(); assertNull(near.cache(CACHE_NAME).get(0)); fail(); near.cache(CACHE_NAME).put(1, 1); fail(); fail(); rollbackAsync(tx).get(); assertNull(near.cache(CACHE_NAME).get(0)); fail(); fail(); fail(); checkFutures();
IgniteInternalFuture<?> lockFut = lockInTx(holdLockNode, keyLocked, waitCommit, 0); ", seed=" + seed); IgniteInternalFuture<?> txFut = multithreadedAsync(new Runnable() { @Override public void run() { for (int i = 0; i < txCnt; i++) { IgniteInternalFuture<?> rollbackFut = multithreadedAsync(new Runnable() { @Override public void run() { Set<IgniteUuid> rolledBackVers = new HashSet<>(); assertEquals(0, holdLockNode.cache(CACHE_NAME).get(0)); checkFutures();
/** {@inheritDoc} */ @Override protected void beforeTestsStarted() throws Exception { System.setProperty(IGNITE_WAL_LOG_TX_RECORDS, "true"); super.beforeTestsStarted(); }
/** {@inheritDoc} */ @Override protected void beforeTest() throws Exception { cleanPersistenceDir(); super.beforeTest(); }
Assume.assumeFalse("https://issues.apache.org/jira/browse/IGNITE-9470", MvccFeatureChecker.forcedMvcc()); final Ignite client = startClient(); final Ignite prim = primaryNode(0, CACHE_NAME); client.cache(CACHE_NAME).put(0, 0); fail(); assertTrue(X.getFullStackTrace(e),X.hasCause(e, TransactionRollbackException.class)); doSleep(500); checkFutures();