Skip to content
Closed
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 @@ -89,6 +89,7 @@
import org.apache.ignite.internal.processors.resource.GridSpringResourceContext;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.CU;
import org.apache.ignite.internal.util.typedef.internal.S;
Expand Down Expand Up @@ -116,6 +117,7 @@
import static org.apache.ignite.cluster.ClusterState.ACTIVE;
import static org.apache.ignite.cluster.ClusterState.INACTIVE;
import static org.apache.ignite.configuration.DataStorageConfiguration.DFLT_PAGE_SIZE;
import static org.apache.ignite.configuration.IgniteConfiguration.DFLT_SNAPSHOT_THREAD_POOL_SIZE;
import static org.apache.ignite.events.EventType.EVTS_CLUSTER_SNAPSHOT;
import static org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.CP_SNAPSHOT_REASON;
import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
Expand Down Expand Up @@ -179,18 +181,25 @@ protected Function<Integer, Object> valueBuilder() {
@Parameterized.Parameter(1)
public boolean onlyPrimary;

/** */
@Parameterized.Parameter(2)
public int snpThrdPoolSz;

/** Parameters. */
@Parameterized.Parameters(name = "encryption={0}, onlyPrimay={1}")
@Parameterized.Parameters(name = "encryption={0}, onlyPrimay={1}, snpThrdPoolSz={2}")
public static Collection<Object[]> params() {
boolean[] encVals = DISK_PAGE_COMPRESSION != DiskPageCompression.DISABLED
? new boolean[] {false}
: new boolean[] {false, true};

List<Object[]> res = new ArrayList<>();

for (boolean enc: encVals)
for (boolean onlyPrimary: new boolean[] {true, false})
res.add(new Object[] { enc, onlyPrimary});
for (boolean enc : encVals) {
for (boolean onlyPrimary : new boolean[] {true, false}) {
for (int poolSz : F.asList(DFLT_SNAPSHOT_THREAD_POOL_SIZE, 1))
res.add(new Object[] {enc, onlyPrimary, poolSz});
}
}

return res;
}
Expand Down Expand Up @@ -221,7 +230,8 @@ public static Collection<Object[]> params() {
.setPageSize(PAGE_SIZE)
.setWalCompactionEnabled(true))
.setClusterStateOnStart(INACTIVE)
.setIncludeEventTypes(EVTS_CLUSTER_SNAPSHOT);
.setIncludeEventTypes(EVTS_CLUSTER_SNAPSHOT)
.setSnapshotThreadPoolSize(snpThrdPoolSz);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
import org.jetbrains.annotations.Nullable;
import org.junit.Test;

import static java.util.Objects.nonNull;
import static org.apache.ignite.internal.processors.cache.persistence.partstate.GroupPartitionId.getTypeByPartId;
import static org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.CP_SNAPSHOT_REASON;
import static org.apache.ignite.internal.processors.cache.persistence.snapshot.IgniteSnapshotManager.SNAPSHOT_RUNNER_THREAD_PREFIX;
Expand All @@ -91,9 +90,6 @@ public class IgniteSnapshotManagerSelfTest extends AbstractSnapshotSelfTest {
/** Listenning logger. */
private ListeningTestLogger listenLog;

/** Number of threads being used to perform snapshot operation. */
private Integer snapshotThreadPoolSize;

/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
Expand All @@ -105,9 +101,6 @@ public class IgniteSnapshotManagerSelfTest extends AbstractSnapshotSelfTest {
if (listenLog != null)
cfg.setGridLogger(listenLog);

if (nonNull(snapshotThreadPoolSize))
cfg.setSnapshotThreadPoolSize(snapshotThreadPoolSize);

return cfg;
}

Expand Down Expand Up @@ -583,8 +576,6 @@ public void testSnapshotAlwaysStartsNewCheckpoint() throws Exception {
/** @throws Exception If fails. */
@Test
public void testSnapshotThreadPoolSizeUsage() throws Exception {
snapshotThreadPoolSize = 6;

IgniteEx ig = startGridWithCache(dfltCacheCfg, CACHE_KEYS_RANGE);

createAndCheckSnapshot(ig, SNAPSHOT_NAME, null, TIMEOUT);
Expand All @@ -594,7 +585,7 @@ public void testSnapshotThreadPoolSizeUsage() throws Exception {
long snpRunningThreads = LongStream.of(tMb.getAllThreadIds()).mapToObj(tMb::getThreadInfo)
.filter(info -> info.getThreadName().startsWith(SNAPSHOT_RUNNER_THREAD_PREFIX)).count();

assertEquals(snapshotThreadPoolSize.longValue(), snpRunningThreads);
assertEquals(snpThrdPoolSz, snpRunningThreads);
}

/**
Expand Down