You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ni...@apache.org on 2025/12/18 08:01:41 UTC
(ignite) branch master updated: IGNITE-27384 Throw when CacheConfiguration#extraStoragePaths contains duplicates (#12588)
This is an automated email from the ASF dual-hosted git repository.
nizhikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new f7c141abb78 IGNITE-27384 Throw when CacheConfiguration#extraStoragePaths contains duplicates (#12588)
f7c141abb78 is described below
commit f7c141abb78b56d98f00d4e2c7bb9b93fa005351
Author: Nikolay <ni...@apache.org>
AuthorDate: Thu Dec 18 11:01:35 2025 +0300
IGNITE-27384 Throw when CacheConfiguration#extraStoragePaths contains duplicates (#12588)
---
.../processors/cache/ValidationOnNodeJoinUtils.java | 6 ++++++
.../filename/CustomCacheStorageConfigurationSelfTest.java | 14 ++++++++++++++
2 files changed, 20 insertions(+)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
index eb3fd275afc..96c6d8e8aff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ValidationOnNodeJoinUtils.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -397,6 +398,11 @@ public class ValidationOnNodeJoinUtils {
if (!F.isEmpty(cc.getStoragePaths())) {
List<String> csp = Arrays.asList(cc.getStoragePaths());
+ if (csp.size() != new HashSet<>(csp).size()) {
+ throw new IgniteCheckedException("CacheConfiguration contains duplicates " +
+ "[storagePaths=" + Arrays.toString(cc.getStoragePaths()) + ']');
+ }
+
Set<String> nodeStorages = nodeStorages(c.getDataStorageConfiguration());
if (!nodeStorages.containsAll(csp)) {
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
index 803d1c22ee0..7a0527f7931 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/filename/CustomCacheStorageConfigurationSelfTest.java
@@ -22,6 +22,7 @@ import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.IntStream;
+import javax.cache.CacheException;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.Ignition;
@@ -226,6 +227,19 @@ public class CustomCacheStorageConfigurationSelfTest extends GridCommonAbstractT
.setIndexPath(myPath.getAbsolutePath())),
IgniteCheckedException.class
);
+
+ assertThrowsWithCause(
+ () -> srv.createCache(new CacheConfiguration<>("my-cache4")
+ .setStoragePaths(myPath2.getAbsolutePath(), myPath3.getAbsolutePath(), myPath2.getAbsolutePath())),
+ CacheException.class
+ );
+
+ assertThrowsWithCause(
+ () -> srv.createCache(new CacheConfiguration<>("my-cache4")
+ .setGroupName("grp-4")
+ .setStoragePaths(myPath2.getAbsolutePath(), myPath3.getAbsolutePath(), myPath2.getAbsolutePath())),
+ IgniteCheckedException.class
+ );
};
try (IgniteEx srv = startGrid(new IgniteConfiguration().setDataStorageConfiguration(new DataStorageConfiguration()