Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.util.Collections;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.IntStream;
import javax.cache.CacheException;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
Expand All @@ -29,7 +30,6 @@
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.cluster.ClusterTopologyCheckedException;
import org.apache.ignite.internal.util.lang.GridAbsPredicate;
import org.apache.ignite.internal.util.typedef.CA;
import org.apache.ignite.internal.util.typedef.CIX1;
import org.apache.ignite.internal.util.typedef.G;
Expand All @@ -41,12 +41,15 @@
import org.apache.ignite.transactions.TransactionIsolation;
import org.jetbrains.annotations.Nullable;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import static org.apache.ignite.cache.CacheRebalanceMode.SYNC;

/**
* Failover tests for cache.
*/
@RunWith(Parameterized.class)
public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstractSelfTest {
/** */
private static final long TEST_TIMEOUT = 3 * 60 * 1000;
Expand All @@ -63,6 +66,16 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac
/** */
private static final int TOP_CHANGE_THREAD_CNT = 3;

/** */
@Parameterized.Parameter
public int idx;

/** */
@Parameterized.Parameters(name = "idx={0}")
public static Object[] data() {
return IntStream.range(1, 50).boxed().toArray();
}

/** {@inheritDoc} */
@Override protected long getTestTimeout() {
return TEST_TIMEOUT;
Expand Down Expand Up @@ -156,6 +169,12 @@ protected void testTopologyChange(@Nullable TransactionConcurrency concurrency,

Ignite g = startGrid(NEW_IGNITE_INSTANCE_NAME);

// We need to wait for the local Cache Affinity Version to be updated on each node after the rebalance is complete.
// Otherwise, the IgniteCache#size() call may be made while the Cache Affinity Version change is still in process.
// It can lead to the situation when some nodes calculate the local cache size based on the updated Affinity version,
// while others relies on the old one. As a result, the IgniteCache#size() value will not match the expected value.
awaitPartitionMapExchange();

check(cache(g), ENTRY_CNT);

int half = ENTRY_CNT / 2;
Expand Down Expand Up @@ -374,11 +393,7 @@ private void remove(Ignite ignite, IgniteCache<String, Integer> cache, final int
* @throws Exception If failed.
*/
private void check(final IgniteCache<String, Integer> cache, final int expSize) throws Exception {
GridTestUtils.waitForCondition(new GridAbsPredicate() {
@Override public boolean apply() {
return cache.size() >= expSize;
}
}, 5000);
GridTestUtils.waitForCondition(() -> cache.size() >= expSize, 5000);

int size = cache.size();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,47 +17,34 @@

package org.apache.ignite.testsuites;

import org.apache.ignite.internal.processors.cache.CacheGetFromJobTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsFailoverAtomicTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsFailoverTxTest;
import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailoverAtomicTest;
import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailoverTxTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheCrossCacheTxFailoverTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicReplicatedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteChangingBaselineDownCachePutAllFailoverTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteChangingBaselineUpCachePutAllFailoverTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteStableBaselineCachePutAllFailoverTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteStableBaselineCacheRemoveFailoverTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/** */
@RunWith(Suite.class)
@Suite.SuiteClasses({
CacheGetFromJobTest.class,
// CacheGetFromJobTest.class,

GridCacheAtomicFailoverSelfTest.class,
GridCacheAtomicReplicatedFailoverSelfTest.class,

GridCachePartitionedFailoverSelfTest.class,
// GridCacheAtomicFailoverSelfTest.class,
// GridCacheAtomicReplicatedFailoverSelfTest.class,
//
// GridCachePartitionedFailoverSelfTest.class,
GridCacheColocatedFailoverSelfTest.class,
GridCacheReplicatedFailoverSelfTest.class,

IgniteCacheCrossCacheTxFailoverTest.class,

CacheAsyncOperationsFailoverAtomicTest.class,
CacheAsyncOperationsFailoverTxTest.class,

CachePutAllFailoverAtomicTest.class,
CachePutAllFailoverTxTest.class,
IgniteStableBaselineCachePutAllFailoverTest.class,
IgniteStableBaselineCacheRemoveFailoverTest.class,
IgniteChangingBaselineDownCachePutAllFailoverTest.class,
IgniteChangingBaselineUpCachePutAllFailoverTest.class
// IgniteCacheCrossCacheTxFailoverTest.class,
//
// CacheAsyncOperationsFailoverAtomicTest.class,
// CacheAsyncOperationsFailoverTxTest.class,
//
// CachePutAllFailoverAtomicTest.class,
// CachePutAllFailoverTxTest.class,
// IgniteStableBaselineCachePutAllFailoverTest.class,
// IgniteStableBaselineCacheRemoveFailoverTest.class,
// IgniteChangingBaselineDownCachePutAllFailoverTest.class,
// IgniteChangingBaselineUpCachePutAllFailoverTest.class
})
public class IgniteCacheFailoverTestSuite2 {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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.testsuites;

import org.apache.ignite.internal.processors.cache.CacheGetFromJobTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsFailoverAtomicTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheAsyncOperationsFailoverTxTest;
import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailoverAtomicTest;
import org.apache.ignite.internal.processors.cache.distributed.CachePutAllFailoverTxTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.GridCacheColocatedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.IgniteCacheCrossCacheTxFailoverTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.dht.atomic.GridCacheAtomicReplicatedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.near.GridCachePartitionedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.replicated.GridCacheReplicatedFailoverSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteChangingBaselineDownCachePutAllFailoverTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteChangingBaselineUpCachePutAllFailoverTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteStableBaselineCachePutAllFailoverTest;
import org.apache.ignite.internal.processors.cache.persistence.baseline.IgniteStableBaselineCacheRemoveFailoverTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;

/** */
@RunWith(Suite.class)
@Suite.SuiteClasses({
CacheGetFromJobTest.class,

GridCacheAtomicFailoverSelfTest.class,
GridCacheAtomicReplicatedFailoverSelfTest.class,

GridCachePartitionedFailoverSelfTest.class,
GridCacheColocatedFailoverSelfTest.class,
GridCacheReplicatedFailoverSelfTest.class,

IgniteCacheCrossCacheTxFailoverTest.class,

CacheAsyncOperationsFailoverAtomicTest.class,
CacheAsyncOperationsFailoverTxTest.class,

CachePutAllFailoverAtomicTest.class,
CachePutAllFailoverTxTest.class,
IgniteStableBaselineCachePutAllFailoverTest.class,
IgniteStableBaselineCacheRemoveFailoverTest.class,
IgniteChangingBaselineDownCachePutAllFailoverTest.class,
IgniteChangingBaselineUpCachePutAllFailoverTest.class
})
public class IgniteCacheFailoverTestSuite4 {
}
Loading