You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by na...@apache.org on 2026/10/16 05:37:55 UTC
(ignite) branch master updated: IGNITE-22298 Fixed node crash on empty cache group name (#13683)
This is an automated email from the ASF dual-hosted git repository.
NSAmelchev 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 dfa5511cd9f IGNITE-22298 Fixed node crash on empty cache group name (#13683)
dfa5511cd9f is described below
commit dfa5511cd9f2f76d2735bb91def78205af0aea3a
Author: Reza Taroosheh <44...@users.noreply.github.com>
AuthorDate: Fri Oct 16 07:37:46 2026 +0200
IGNITE-22298 Fixed node crash on empty cache group name (#13683)
---
.../processors/cache/GridCacheProcessor.java | 2 +
.../internal/processors/cache/GridCacheUtils.java | 8 +++
.../processors/cache/GridLocalConfigManager.java | 1 +
.../cache/CacheGroupNameValidationTest.java | 79 ++++++++++++++++++++++
.../ignite/testsuites/IgniteCacheTestSuite2.java | 2 +
5 files changed, 92 insertions(+)
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 1c1c4caa509..9940f397521 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -4978,6 +4978,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
req.restartId(restartId);
if (ccfg != null) {
+ CU.validateCacheGroupName(ccfg.getGroupName());
+
cloneCheckSerializable(ccfg);
if (desc != null) {
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 76bf86defa0..80e2f3e03fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1389,6 +1389,14 @@ public class GridCacheUtils {
A.ensure(name != null && !name.isEmpty(), "Cache name must not be null or empty.");
}
+ /**
+ * @param grpName Cache group name, {@code null} if the cache does not belong to a group.
+ * @throws IllegalArgumentException In case the name is not valid.
+ */
+ public static void validateCacheGroupName(@Nullable String grpName) throws IllegalArgumentException {
+ A.ensure(grpName == null || !grpName.isEmpty(), "Cache group name must not be empty.");
+ }
+
/**
* @param name Cache name.
* @throws IllegalArgumentException In case the name is not valid.
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
index abbfdff979e..0a48d01eeff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridLocalConfigManager.java
@@ -601,6 +601,7 @@ public class GridLocalConfigManager {
String cacheName = cfg.getName();
CU.validateCacheName(cacheName);
+ CU.validateCacheGroupName(cfg.getGroupName());
Collection<CacheConfiguration<?, ?>> ccfgs = new ArrayList<>(caches.size());
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupNameValidationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupNameValidationTest.java
new file mode 100644
index 00000000000..72baaecb9fa
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGroupNameValidationTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.internal.processors.cache;
+
+import org.apache.ignite.Ignition;
+import org.apache.ignite.client.ClientCacheConfiguration;
+import org.apache.ignite.client.ClientException;
+import org.apache.ignite.client.IgniteClient;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.ClientConfiguration;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.junit.Test;
+
+import static org.apache.ignite.testframework.GridTestUtils.assertThrowsAnyCause;
+import static org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause;
+
+/**
+ * Checks that a cache with an empty cache group name is rejected.
+ */
+public class CacheGroupNameValidationTest extends GridCommonAbstractTest {
+ /** Expected error message. */
+ private static final String ERR_MSG = "Cache group name must not be empty.";
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ super.afterTest();
+ }
+
+ /** @throws Exception If failed. */
+ @Test
+ public void testCreateCache() throws Exception {
+ IgniteEx srv = startGrid(0);
+
+ assertThrowsAnyCause(log, () -> srv.createCache(new CacheConfiguration<>("cache1").setGroupName("")),
+ IllegalArgumentException.class, ERR_MSG);
+ }
+
+ /** @throws Exception If failed. */
+ @Test
+ public void testThinClientCreateCache() throws Exception {
+ startGrid(0);
+
+ try (IgniteClient cli = Ignition.startClient(new ClientConfiguration().setAddresses("127.0.0.1:10800"))) {
+ Throwable e = assertThrowsWithCause(
+ () -> cli.createCache(new ClientCacheConfiguration().setName("cache1").setGroupName("")),
+ ClientException.class);
+
+ assertTrue(e.getMessage(), e.getMessage().contains(ERR_MSG));
+ }
+ }
+
+ /** @throws Exception If failed. */
+ @Test
+ public void testStaticConfiguration() throws Exception {
+ startGrid(0);
+
+ assertThrowsAnyCause(log, () -> startGrid(getConfiguration(getTestIgniteInstanceName(1))
+ .setCacheConfiguration(new CacheConfiguration<>("cache1").setGroupName(""))),
+ IllegalArgumentException.class, ERR_MSG);
+ }
+}
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index b3c64df22f1..3a38de17e0d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -31,6 +31,7 @@ import org.apache.ignite.internal.processors.cache.CacheDhtLocalPartitionAfterRe
import org.apache.ignite.internal.processors.cache.CacheEnumOperationsSingleNodeTest;
import org.apache.ignite.internal.processors.cache.CacheEnumOperationsTest;
import org.apache.ignite.internal.processors.cache.CacheGroupLocalConfigurationSelfTest;
+import org.apache.ignite.internal.processors.cache.CacheGroupNameValidationTest;
import org.apache.ignite.internal.processors.cache.CacheOptimisticTransactionsWithFilterTest;
import org.apache.ignite.internal.processors.cache.GridCacheOffheapUpdateSelfTest;
import org.apache.ignite.internal.processors.cache.GridCachePartitionedGetSelfTest;
@@ -198,6 +199,7 @@ public class IgniteCacheTestSuite2 {
// Configuration validation
GridTestUtils.addTestIfNeeded(suite, CacheGroupLocalConfigurationSelfTest.class, ignoredTests);
+ GridTestUtils.addTestIfNeeded(suite, CacheGroupNameValidationTest.class, ignoredTests);
// Affinity and collocation
GridTestUtils.addTestIfNeeded(suite, GridCachePartitionedAffinitySelfTest.class, ignoredTests);