From 7774a0a3137d13f73574a241810c3220a113f6ec Mon Sep 17 00:00:00 2001 From: Vladimir Steshin Date: Tue, 9 Sep 2025 20:41:27 +0300 Subject: [PATCH] + thrd pool sz --- .../snapshot/AbstractSnapshotSelfTest.java | 20 ++++++++++++++----- .../IgniteSnapshotManagerSelfTest.java | 11 +--------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java index 4239c53ed78d6..4bb58f23d335b 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/AbstractSnapshotSelfTest.java @@ -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; @@ -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; @@ -179,8 +181,12 @@ protected Function 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 params() { boolean[] encVals = DISK_PAGE_COMPRESSION != DiskPageCompression.DISABLED ? new boolean[] {false} @@ -188,9 +194,12 @@ public static Collection params() { List 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; } @@ -221,7 +230,8 @@ public static Collection params() { .setPageSize(PAGE_SIZE) .setWalCompactionEnabled(true)) .setClusterStateOnStart(INACTIVE) - .setIncludeEventTypes(EVTS_CLUSTER_SNAPSHOT); + .setIncludeEventTypes(EVTS_CLUSTER_SNAPSHOT) + .setSnapshotThreadPoolSize(snpThrdPoolSz); } /** {@inheritDoc} */ diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java index a5e9b80588527..57f95e680d561 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/snapshot/IgniteSnapshotManagerSelfTest.java @@ -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; @@ -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); @@ -105,9 +101,6 @@ public class IgniteSnapshotManagerSelfTest extends AbstractSnapshotSelfTest { if (listenLog != null) cfg.setGridLogger(listenLog); - if (nonNull(snapshotThreadPoolSize)) - cfg.setSnapshotThreadPoolSize(snapshotThreadPoolSize); - return cfg; } @@ -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); @@ -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); } /**