org.apache.ignite.internal.IgniteEx Java Examples

The following examples show how to use org.apache.ignite.internal.IgniteEx. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IgniteLogicalRecoveryTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Checks that cache contexts have consistent parameters after recovery finished and nodes have joined to topology.
 */
private void checkCacheContextsConsistencyAfterRecovery() throws Exception {
    IgniteEx crd = grid(0);

    Collection<String> cacheNames = crd.cacheNames();

    for (String cacheName : cacheNames) {
        for (int nodeIdx = 1; nodeIdx < 3; nodeIdx++) {
            IgniteEx node = grid(nodeIdx);

            GridCacheContext one = cacheContext(crd, cacheName);
            GridCacheContext other = cacheContext(node, cacheName);

            checkCacheContextsConsistency(one, other);
        }
    }
}
 
Example #2
Source File: SqlIndexConsistencyAfterInterruptAtomicCacheOperationTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @throws Exception On error.
 */
@Test
public void testPut() throws Exception {
    IgniteEx ign = startGrid(0);

    IgniteCache<Object, Object> cache = ign.createCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
        .setAtomicityMode(atomicity())
        .setIndexedTypes(Integer.class, Integer.class));

    Thread t = new Thread(() -> {
        cache.put(1, 1);
    });

    t.start();

    t.interrupt();

    t.join();

    assertEquals(cache.size(), cache.query(new SqlFieldsQuery("select * from Integer")).getAll().size());
}
 
Example #3
Source File: IgniteCacheGroupsWithRestartsTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param ignite Ignite to execute task on.
 * @param delFoundGarbage If clearing mode should be used.
 * @return Result of task run.
 */
private VisorFindAndDeleteGarbageInPersistenceTaskResult executeTaskViaControlConsoleUtil(
    IgniteEx ignite,
    boolean delFoundGarbage
) {
    CommandHandler hnd = new CommandHandler();

    List<String> args = new ArrayList<>(Arrays.asList("--yes", "--port", "11212", "--cache", "find_garbage",
        ignite.localNode().id().toString()));

    if (delFoundGarbage)
        args.add(FindAndDeleteGarbageArg.DELETE.argName());

    hnd.execute(args);

    return hnd.getLastOperationResult();
}
 
Example #4
Source File: CacheNearDisabledTransactionalInvokeRestartSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override protected void updateCache(IgniteEx ignite, IgniteCache cache) {
    final int k = ThreadLocalRandom.current().nextInt(RANGE);

    final String[] keys = new String[KEYS_CNT];

    for (int i = 0; i < keys.length; i++)
        keys[i] = "key-" + k + "-" + i;

    for (String key : keys) {
        cache.invoke(key, new IncrementCacheEntryProcessor());

        AtomicLong prevVal = map.putIfAbsent(key, new AtomicLong(0));

        if (prevVal != null)
            prevVal.incrementAndGet();
    }
}
 
Example #5
Source File: GridServiceProcessorMultiNodeConfigSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * @param name Name.
 * @throws Exception If failed.
 */
private void checkSingletonUpdateTopology(String name) throws Exception {
    IgniteEx g = randomGrid();

    startExtraNodes(2, 2);

    try {
        assertEquals(name, 0, DummyService.started(name));
        assertEquals(name, 0, DummyService.cancelled(name));

        info(">>> Passed checks.");

        checkCount(name, g, 1);
    }
    finally {
        stopExtraNodes(4);
    }
}
 
Example #6
Source File: MasterKeyChangeConsistencyCheckTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** @throws Exception If failed. */
@Test
public void testFailureHandledOnFailPerformMasterKeyChange() throws Exception {
    T2<IgniteEx, IgniteEx> grids = startTestGrids(true);

    assertTrue(checkMasterKeyName(DEFAULT_MASTER_KEY_NAME));

    grids.get2().context().discovery().setCustomEventListener(FullMessage.class,
        (topVer, snd, msg) -> simulateSetMasterKeyError.set(true));

    // Expected successful completing the future in case of successful completition of prepare phase and fail
    // of the perform phase.
    grids.get1().encryption().changeMasterKey(MASTER_KEY_NAME_2).get();

    assertNotNull(failure.get());

    assertTrue(X.hasCause(failure.get(), "Test error.", IgniteSpiException.class));
}
 
Example #7
Source File: CacheParallelStartTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
private void assertCaches(IgniteEx igniteEx) {
    for (int i = 0; i < GROUPS_COUNT; i++) {
        Collection<GridCacheContext> caches = igniteEx
                .context()
                .cache()
                .cacheGroup(CU.cacheId(STATIC_CACHE_CACHE_GROUP_NAME + i))
                .caches();

        assertEquals(CACHES_COUNT / GROUPS_COUNT, caches.size());

        @Nullable CacheGroupContext cacheGrp = igniteEx
                .context()
                .cache()
                .cacheGroup(CU.cacheId(STATIC_CACHE_CACHE_GROUP_NAME + i));

        for (GridCacheContext cacheContext : caches)
            assertEquals(cacheContext.group(), cacheGrp);
    }
}
 
Example #8
Source File: PartitionsExchangeCoordinatorFailoverTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Blocks sending full message from coordinator to non-coordinator node.
 *
 * @param from Coordinator node.
 * @param pred Non-coordinator node predicate.
 *                  If predicate returns {@code true} a full message will not be send to that node.
 */
private void blockSendingFullMessage(IgniteEx from, Predicate<ClusterNode> pred) {
    // Block FullMessage for newly joined nodes.
    TestRecordingCommunicationSpi spi = TestRecordingCommunicationSpi.spi(from);

    // Delay sending full messages (without exchange id).
    spi.blockMessages((node, msg) -> {
        if (msg instanceof GridDhtPartitionsFullMessage) {
            GridDhtPartitionsFullMessage fullMsg = (GridDhtPartitionsFullMessage) msg;

            if (fullMsg.exchangeId() != null && pred.test(node)) {
                log.warning("Blocked sending " + msg + " to " + node);

                return true;
            }
        }

        return false;
    });
}
 
Example #9
Source File: JdbcThinBulkLoadSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Test imports CSV file into a table on not affinity node and checks the created entries using SELECT statement.
 *
 * @throws SQLException If failed.
 */
@Test
public void testBulkLoadToNonAffinityNode() throws Exception {
    IgniteEx client = startClientGrid(getConfiguration("client"));

    try (Connection con = connect(client, null)) {
        con.setSchema('"' + DEFAULT_CACHE_NAME + '"');

        try (Statement stmt = con.createStatement()) {
            int updatesCnt = stmt.executeUpdate(
                "copy from '" + BULKLOAD_UTF8_CSV_FILE + "' into " + TBL_NAME +
                    " (_key, age, firstName, lastName)" +
                    " format csv");

            assertEquals(2, updatesCnt);

            checkNationalCacheContents(TBL_NAME);
        }
    }

    stopGrid(client.name());
}
 
Example #10
Source File: AbstractRemoteSecurityContextCheckTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Registers a security subject referred for {@code localIgnite} with the passed operation name and increments
 * invoke counter.
 *
 * @param opName Operation name.
 */
public void register(String opName) {
    if (expSecSubjId == null) {
        error("SubjectId cannot be null.");

        return;
    }

    IgniteEx ignite = localIgnite();

    UUID actualSubjId = secSubjectId(ignite);

    if (!expSecSubjId.equals(actualSubjId)) {
        error("Actual subjectId does not equal expected subjectId " + "[expected=" + expSecSubjId +
            ", actual=" + actualSubjId + "].");

        return;
    }

    T2<Integer, AtomicInteger> v = expInvokes.get(new T2<>(ignite.name(), opName));

    if (v != null)
        v.get2().incrementAndGet();
    else
        error("Unexpected registration parameters [node=" + ignite.name() + ", opName=" + opName + "].");
}
 
Example #11
Source File: IoStatisticsMetricsLocalMXBeanImplSelfTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Resets all io statistics.
 *
 * @param ignite Ignite.
 */
public static void resetAllIoMetrics(IgniteEx ignite) throws MalformedObjectNameException {
    GridMetricManager mmgr = ignite.context().metric();

    StreamSupport.stream(mmgr.spliterator(), false)
        .map(ReadOnlyMetricRegistry::name)
        .filter(name -> {
            for (IoStatisticsType type : IoStatisticsType.values()) {
                if (name.startsWith(type.metricGroupName()))
                    return true;
            }

            return false;
        })
        .forEach(grpName -> resetMetric(ignite, grpName));

}
 
Example #12
Source File: WalRolloverTypesTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** */
private void checkNextSegmentType(WALMode mode, boolean disableArch) throws Exception {
    walMode = mode;
    disableWALArchiving = disableArch;

    IgniteEx ig = startGrid(0);

    ig.cluster().active(true);

    IgniteWriteAheadLogManager walMgr = ig.context().cache().context().wal();

    ig.context().cache().context().database().checkpointReadLock();

    try {
        WALPointer ptr = walMgr.log(new AdHocWALRecord(), NEXT_SEGMENT);

        assertEquals(1, ((FileWALPointer)ptr).index());
    }
    finally {
        ig.context().cache().context().database().checkpointReadUnlock();
    }
}
 
Example #13
Source File: RunningQueriesTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Check cleanup running queries on node stop.
 *
 * @throws Exception Exception in case of failure.
 */
@Test
public void testCloseRunningQueriesOnNodeStop() throws Exception {
    IgniteEx ign = startGrid(super.getConfiguration("TST"));

    IgniteCache<Integer, Integer> cache = ign.getOrCreateCache(new CacheConfiguration<Integer, Integer>()
        .setName("TST")
        .setQueryEntities(Collections.singletonList(new QueryEntity(Integer.class, Integer.class)))
    );

    for (int i = 0; i < 10000; i++)
        cache.put(i, i);

    cache.query(new SqlFieldsQuery("SELECT * FROM Integer order by _key"));

    Assert.assertEquals("Should be one running query",
        1,
        ign.context().query().runningQueries(-1).size());

    ign.close();

    Assert.assertEquals(0, ign.context().query().runningQueries(-1).size());
}
 
Example #14
Source File: OomFailureHandlerTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Test OOME in IgniteCompute.
 */
@Test
public void testComputeOomError() throws Exception {
    IgniteEx ignite0 = startGrid(0);
    IgniteEx ignite1 = startGrid(1);

    try {
        IgniteFuture<Boolean> res = ignite0.compute(ignite0.cluster().forNodeId(ignite1.cluster().localNode().id()))
            .callAsync(new IgniteCallable<Boolean>() {
                @Override public Boolean call() throws Exception {
                    throw new OutOfMemoryError();
                }
            });

        res.get();
    }
    catch (Throwable ignore) {
        // Expected.
    }

    assertFailureState(ignite0, ignite1);
}
 
Example #15
Source File: IgnitePdsExchangeDuringCheckpointTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 *
 */
@Test
public void testExchangeOnNodeJoin() throws Exception {
    for (int i = 0; i < SF.applyLB(5, 2); i++) {
        startGrids(2);
        IgniteEx ignite = grid(1);
        ignite.active(true);

        awaitPartitionMapExchange();

        IgniteEx ex = startGrid(2);

        awaitPartitionMapExchange();

        ex.context().cache().context().database().wakeupForCheckpoint("test").get(10000);

        afterTest();
    }
}
 
Example #16
Source File: CacheWithDifferentDataRegionConfigurationTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/** Start node from builder */
public IgniteEx start() throws Exception {
    IgniteConfiguration cfg = getConfiguration(gridName);

    cfg.setConsistentId(gridName);

    DataStorageConfiguration storageCfg = new DataStorageConfiguration();
    storageCfg.setDataRegionConfigurations(regions.toArray(new DataRegionConfiguration[regions.size()]));
    cfg.setDataStorageConfiguration(storageCfg);

    if (dfltRegionConfiguration != null)
        storageCfg.setDefaultDataRegionConfiguration(dfltRegionConfiguration);

    cfg.setCacheConfiguration(caches.toArray(new CacheConfiguration[caches.size()]));

    return startGrid(cfg);
}
 
Example #17
Source File: FailureProcessorThreadDumpThrottlingTest.java    From ignite with Apache License 2.0 6 votes vote down vote up
/**
 * Tests that thread dumps will get for every failure for disabled throttling.
 */
@Test
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE, value = "true")
@WithSystemProperty(key = IgniteSystemProperties.IGNITE_DUMP_THREADS_ON_FAILURE_THROTTLING_TIMEOUT, value = "0")
public void testNoThrottling() throws Exception {
    LogListener lsnr = LogListener.matches(THREAD_DUMP_MSG).times(2).build();

    testLog.registerListener(lsnr);

    IgniteEx ignite = ignite(0);

    FailureContext failureCtx =
            new FailureContext(SYSTEM_WORKER_BLOCKED, new Throwable("Failure context error"));

    for (int i = 0; i < 2; i++)
        ignite.context().failure().process(failureCtx);

    assertTrue(lsnr.check());
}
 
Example #18
Source File: IgfsAbstractBaseSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Gets meta cache.
 *
 * @param igfs The IGFS instance.
 * @return The data cache.
 */
protected static GridCacheAdapter<IgniteUuid, IgfsEntryInfo> getMetaCache(IgniteFileSystem igfs) {
    String dataCacheName = igfs.configuration().getMetaCacheConfiguration().getName();

    IgniteEx igniteEx = ((IgfsEx)igfs).context().kernalContext().grid();

    return ((IgniteKernal)igniteEx).internalCache(dataCacheName);
}
 
Example #19
Source File: KillQueryTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Wait until all map parts are finished on the specified node. Not needed when IGN-13862 is done.
 *
 * @param node node for which map request completion to wait.
 */
private void ensureMapQueriesHasFinished(IgniteEx node) throws Exception {
    boolean noTasksInQryPool = GridTestUtils.waitForCondition(() -> queryPoolIsEmpty(node), TIMEOUT);

    Assert.assertTrue("Node " + node.localNode().id() + " has not finished its tasks in the query pool",
        noTasksInQryPool);
}
 
Example #20
Source File: IgniteCacheLockPartitionOnAffinityRunTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param ignite Ignite instance.
 * @param orgId Organization ID.
 * @return {@code true} if partition for the given organization ID is primary on the given node.
 */
private static boolean primaryPartition(IgniteEx ignite, int orgId) {
    int part = ignite.affinity(Organization.class.getSimpleName()).partition(orgId);

    GridCacheAdapter<?, ?> cacheAdapterPers = ignite.context().cache()
        .internalCache(Person.class.getSimpleName());

    GridDhtLocalPartition pPers = cacheAdapterPers.context().topology()
        .localPartition(part, AffinityTopologyVersion.NONE, false);

    return pPers.primary(AffinityTopologyVersion.NONE);
}
 
Example #21
Source File: GridAbstractTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Starts new client grid with given name.
 *
 * @param igniteInstanceName Ignite instance name.
 * @return Started grid.
 * @throws Exception If anything failed.
 */
protected IgniteEx startClientGrid(String igniteInstanceName) throws Exception {
    IgnitionEx.setClientMode(true);

    try {
        return (IgniteEx)startGrid(igniteInstanceName, (GridSpringResourceContext)null);
    }
    finally {
        IgnitionEx.setClientMode(false);
    }
}
 
Example #22
Source File: ServiceDeploymentDiscoveryListenerNotificationOrderTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * <b>Strongly depends on internal implementation of {@link GridEventStorageManager}.</b>
 * <p/>
 * Tests that discovery listener registered by {@link ServiceDeploymentManager} is in collection of hight priority
 * listeners, at the same time discovery listener registered by {@link GridCachePartitionExchangeManager} is in
 * collection of usual listeners.
 * <p/>
 * This guarantees that service deployment discovery listener will be notified earlier that PME's discovery listener
 * and will be able to capture custom messages which may be nullified in PME process.
 *
 * @throws Exception In case of an error.
 */
@Test
public void testServiceDiscoveryListenerNotifiedEarlierThanPME() throws Exception {
    try {
        IgniteEx ignite = startGrid(0);

        ConcurrentMap<Integer, Object> lsnrs = GridTestUtils
            .getFieldValue(ignite.context().event(), "lsnrs");

        Object customLsnrs = lsnrs.get(DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT);

        List<EventListener> highPriorityLsnrs = GridTestUtils.getFieldValue(customLsnrs, "highPriorityLsnrs");

        GridConcurrentLinkedHashSet<EventListener> usualLsnrs = GridTestUtils
            .getFieldValue(customLsnrs, "lsnrs");

        assertTrue("Failed to find service deployment manager's listener in high priority listeners.",
            containsListener(highPriorityLsnrs, ServiceDeploymentManager.class));

        assertFalse("Service deployment manager's listener shoud not be registered in usual listeners.",
            containsListener(usualLsnrs, ServiceDeploymentManager.class));

        assertTrue("Failed to find PME manager's discovery listener in usual listeners.",
            containsListener(usualLsnrs, GridCachePartitionExchangeManager.class));

        assertFalse("PME manager's discovery listener shoud not be registered in high priority listeners.",
            containsListener(highPriorityLsnrs, GridCachePartitionExchangeManager.class));
    }
    finally {
        stopAllGrids();
    }
}
 
Example #23
Source File: AtomicCacheAffinityConfigurationTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testTestAffinity() throws Exception {
    try {
        affinityFunction = new TestAffinityFunction("Some value");

        startGrids(3);

        for (int i = 0; i < 3; i++) {
            IgniteEx igniteEx = grid(i);

            IgniteAtomicLong atomic = igniteEx.atomicLong("test", 0, true);

            GridCacheContext cctx = GridTestUtils.getFieldValue(atomic, AtomicDataStructureProxy.class, "ctx");

            TestAffinityFunction aff = (TestAffinityFunction) cctx.config().getAffinity();

            assertNotNull(aff);

            assertEquals(aff.partitions(), affinityFunction.partitions());

            assertEquals(aff.getCustomAttribute(), ((TestAffinityFunction)affinityFunction).getCustomAttribute());
        }

        checkAtomics();
    }
    finally {
        stopAllGrids();
    }
}
 
Example #24
Source File: GridActivateExtensionTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override protected IgniteEx grid(String name) {
    String n = name;

    if (backUpCluster.containsKey(name))
        n = backUpCluster.get(name);

    return super.grid(n);
}
 
Example #25
Source File: IgniteCacheLockPartitionOnAffinityRunTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param ignite Ignite.
 * @param log Logger.
 * @param orgId Organization id.
 * @return Count of found Person object with specified orgId
 * @throws Exception If failed.
 */
private static int getPersonsCountMultipleCache(final IgniteEx ignite, IgniteLogger log, final int orgId)
    throws Exception {
    int sqlFieldCnt = getPersonsCountBySqlFieledLocalQueryJoinOrgs(ignite, orgId);
    int partCnt = getPersonsCountFromPartitionMapCheckBothCaches(ignite, log, orgId);

    assertEquals(partCnt, sqlFieldCnt);

    return partCnt;
}
 
Example #26
Source File: IgniteLostPartitionsOnLeaveBaselineSelfTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception if failed.
 */
@Test
public void testLostPartitionsOnLeaveBaseline() throws Exception {
    try {
        final IgniteEx gridFirst = startGrid(0);
        startGrid(1);

        gridFirst.cluster().active(true);

        gridFirst.getOrCreateCaches(Arrays.asList(
            cacheConfiguration("cache-no-persistence", PARTITIONED, ATOMIC, "no-persistence"),
            cacheConfiguration("cache-persistence", PARTITIONED, ATOMIC, null)
        ));

        IgniteInternalCache<Object, Object> cacheNoPersistence = gridFirst.cachex("cache-no-persistence");
        IgniteInternalCache<Object, Object> cachePersistence = gridFirst.cachex("cache-persistence");

        for (int i = 0; i < 10; i++) {
            cacheNoPersistence.put(i, i);
            cachePersistence.put(i, i);
        }

        stopGrid(1);

        resetBaselineTopology();

        assertTrue("List of lost partitions for cache without persistence should not be empty.",
            !cacheNoPersistence.context().topology().lostPartitions().isEmpty());

        assertTrue("List of lost partitions for cache with persistence should not be empty.",
            !cachePersistence.context().topology().lostPartitions().isEmpty());
    } finally {
        stopAllGrids();
    }
}
 
Example #27
Source File: CacheMvccSqlTxQueriesAbstractTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @throws Exception If failed.
 */
@Test
public void testSelectProducesTransaction() throws Exception {
    ccfg = cacheConfiguration(cacheMode(), FULL_SYNC, 2, DFLT_PARTITION_COUNT)
        .setIndexedTypes(Integer.class, MvccTestSqlIndexValue.class);

    startGridsMultiThreaded(4);

    Random rnd = ThreadLocalRandom.current();

    Ignite node = grid(rnd.nextInt(4));

    IgniteCache<Object, Object> cache = node.cache(DEFAULT_CACHE_NAME);

    SqlFieldsQuery qry = new SqlFieldsQuery("INSERT INTO MvccTestSqlIndexValue (_key, idxVal1) values (1,1),(2,2),(3,3)");

    try (FieldsQueryCursor<List<?>> cur = cache.query(qry)) {
        assertEquals(3L, cur.iterator().next().get(0));
    }

    SqlFieldsQueryEx qryEx = new SqlFieldsQueryEx("SELECT * FROM MvccTestSqlIndexValue", true);

    qryEx.setAutoCommit(false);

    try (FieldsQueryCursor<List<?>> cur = cache.query(qryEx)) {
        assertEquals(3, cur.getAll().size());
    }

    try (GridNearTxLocal tx = cache.unwrap(IgniteEx.class).context().cache().context().tm().userTx()) {
        assertNotNull(tx);
    }
}
 
Example #28
Source File: KillQueryErrorOnCancelTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * Wait until all map parts are finished on the specified node. Not needed when IGN-13862 is done.
 *
 * @param node node for which map request completion to wait.
 */
private void ensureMapQueriesHasFinished(IgniteEx node) throws Exception {
    boolean noTasksInQryPool = GridTestUtils.waitForCondition(() -> queryPoolIsEmpty(node), 5_000);

    Assert.assertTrue("Node " + node.localNode().id() + " has not finished its tasks in the query pool",
        noTasksInQryPool);
}
 
Example #29
Source File: TxOnCachesStopTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param block {@code True} To block GridNearTxPrepareRequest message.
 */
private void runTxOnCacheStop(boolean block) throws Exception {
    startGridsMultiThreaded(2);

    IgniteEx ig = startClientGrid("client");

    ig.cluster().active(true);

    for (TransactionConcurrency conc : TransactionConcurrency.values()) {
        for (TransactionIsolation iso : TransactionIsolation.values())
            runTxOnCacheStop(conc, iso, ig, block);
    }
}
 
Example #30
Source File: PartitionsEvictManagerAbstractTest.java    From ignite with Apache License 2.0 5 votes vote down vote up
/**
 * @param node Node.
 * @param latch Latch.
 * @param completeWithError Inner future throws exception.
 */
protected void subscribeEvictionQueueAtLatch(IgniteEx node, CountDownLatch latch, boolean completeWithError) {
    PartitionsEvictManager.BucketQueue evictionQueue = node.context().cache().context().evict().evictionQueue;
    Queue[] buckets = evictionQueue.buckets;

    for (int i = 0; i < buckets.length; i++)
        buckets[i] = new WaitingQueue(latch, completeWithError);
}