This is an automated email from the ASF dual-hosted git repository.

mpochatkin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 3102f85f991 IGNITE-21101 Fix renaming a node in named list (#7393)
3102f85f991 is described below

commit 3102f85f991fd5d9fc25113f740724ab98f3b022
Author: Mikhail <[email protected]>
AuthorDate: Mon Jan 26 13:22:43 2026 +0300

    IGNITE-21101 Fix renaming a node in named list (#7393)
---
 .../ConfigurationNotificationUtils.java            | 26 ++++++++++++++--------
 .../notifications/ConfigurationNotifier.java       |  5 +----
 .../notifications/ConfigurationListenerTest.java   |  4 +---
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git 
a/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotificationUtils.java
 
b/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotificationUtils.java
index 9faf5bfa60b..956d71614f8 100644
--- 
a/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotificationUtils.java
+++ 
b/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotificationUtils.java
@@ -47,10 +47,13 @@ class ConfigurationNotificationUtils {
      *
      * @param dynamicConfig Dynamic configuration.
      * @param nodeName Name of the child node.
-     * @return Dynamic property of a leaf or {@code null} if the leaf does not 
exist.
+     * @return Dynamic property of a leaf or {@code null} if the leaf does not 
exist or {@code dynamicConfig} is {@code null}.
      */
-    static @Nullable DynamicProperty<Serializable> 
dynamicProperty(DynamicConfiguration<InnerNode, ?> dynamicConfig, String 
nodeName) {
-        return (DynamicProperty<Serializable>) 
dynamicConfig.members().get(nodeName);
+    static @Nullable DynamicProperty<Serializable> dynamicProperty(
+            @Nullable DynamicConfiguration<InnerNode, ?> dynamicConfig,
+            String nodeName
+    ) {
+        return dynamicConfig == null ? null : (DynamicProperty<Serializable>) 
dynamicConfig.members().get(nodeName);
     }
 
     /**
@@ -58,10 +61,14 @@ class ConfigurationNotificationUtils {
      *
      * @param dynamicConfig Dynamic configuration.
      * @param nodeName Name of the child node.
-     * @return Dynamic configuration of the child node or {@code null} if the 
child node does not exist.
+     * @return Dynamic configuration of the child node or {@code null} if the 
child node does not exist or {@code dynamicConfig} is
+     *         {@code null}.
      */
-    static @Nullable DynamicConfiguration<InnerNode, ?> 
dynamicConfig(DynamicConfiguration<InnerNode, ?> dynamicConfig, String 
nodeName) {
-        return (DynamicConfiguration<InnerNode, ?>) 
dynamicConfig.members().get(nodeName);
+    static @Nullable DynamicConfiguration<InnerNode, ?> dynamicConfig(
+            @Nullable DynamicConfiguration<InnerNode, ?> dynamicConfig,
+            String nodeName
+    ) {
+        return dynamicConfig == null ? null : (DynamicConfiguration<InnerNode, 
?>) dynamicConfig.members().get(nodeName);
     }
 
     /**
@@ -69,13 +76,14 @@ class ConfigurationNotificationUtils {
      *
      * @param dynamicConfig Dynamic configuration.
      * @param nodeName Name of the child node.
-     * @return Named dynamic configuration of the child node or {@code null} 
if the child node does not exist.
+     * @return Named dynamic configuration of the child node or {@code null} 
if the child node does not exist or {@code dynamicConfig} is
+     *         {@code null}.
      */
     static @Nullable NamedListConfiguration<?, InnerNode, ?> 
namedDynamicConfig(
-            DynamicConfiguration<InnerNode, ?> dynamicConfig,
+            @Nullable DynamicConfiguration<InnerNode, ?> dynamicConfig,
             String nodeName
     ) {
-        return (NamedListConfiguration<?, InnerNode, ?>) 
dynamicConfig.members().get(nodeName);
+        return dynamicConfig == null ? null : (NamedListConfiguration<?, 
InnerNode, ?>) dynamicConfig.members().get(nodeName);
     }
 
     /**
diff --git 
a/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotifier.java
 
b/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotifier.java
index aaea854fe07..4d581204696 100644
--- 
a/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotifier.java
+++ 
b/modules/configuration/src/main/java/org/apache/ignite/internal/configuration/notifications/ConfigurationNotifier.java
@@ -44,7 +44,6 @@ import 
org.apache.ignite.configuration.notifications.ConfigurationListener;
 import 
org.apache.ignite.configuration.notifications.ConfigurationNamedListListener;
 import 
org.apache.ignite.configuration.notifications.ConfigurationNotificationEvent;
 import org.apache.ignite.internal.configuration.DynamicConfiguration;
-import org.apache.ignite.internal.configuration.DynamicProperty;
 import org.apache.ignite.internal.configuration.NamedListConfiguration;
 import org.apache.ignite.internal.configuration.tree.ConfigurationVisitor;
 import org.apache.ignite.internal.configuration.tree.InnerNode;
@@ -134,10 +133,8 @@ public class ConfigurationNotifier {
                 Serializable newLeaf = newInnerNode.traverseChild(key, 
leafNodeVisitor(), true);
 
                 if (newLeaf != oldLeaf) {
-                    // TODO: Remove null check after 
https://issues.apache.org/jira/browse/IGNITE-21101
-                    DynamicProperty<Serializable> node = config != null ? 
dynamicProperty(config, key) : null;
                     notifyPublicListeners(
-                            listeners(node, ctx.notificationNum),
+                            listeners(dynamicProperty(config, key), 
ctx.notificationNum),
                             concat(mapIterable(anyConfigs, anyCfg -> 
listeners(dynamicProperty(anyCfg, key), ctx.notificationNum))),
                             oldLeaf,
                             newLeaf,
diff --git 
a/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
 
b/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
index 41a0455a1d0..ac4d49704ff 100644
--- 
a/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
+++ 
b/modules/configuration/src/test/java/org/apache/ignite/internal/configuration/notifications/ConfigurationListenerTest.java
@@ -77,7 +77,6 @@ import 
org.apache.ignite.internal.configuration.validation.TestConfigurationVali
 import org.apache.ignite.internal.manager.ComponentContext;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -628,7 +627,6 @@ public class ConfigurationListenerTest {
      * Tests notifications validity when a named list element is renamed and 
then updated a sub-element of the renamed element.
      */
     @Test
-    @Disabled("https://issues.apache.org/jira/browse/IGNITE-21101";)
     public void namedListNodeOnRenameAndThenUpdateSubElement() throws 
Exception {
         config.change(parent ->
                 parent.changeChildren(elements -> elements.create("name", 
element -> {
@@ -712,7 +710,7 @@ public class ConfigurationListenerTest {
                 .update("foo")
                 .get(1, SECONDS);
 
-        assertEquals(List.of("parent", "elements", "rename"), log);
+        assertEquals(List.of("parent", "children", "rename", "parent", 
"children", "update"), log);
     }
 
 

Reply via email to