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

namelchev 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 cf0a9168870 IGNITE-26904 Added data center ID to the ClusterNodeView 
(#12490)
cf0a9168870 is described below

commit cf0a916887026006560e4e788bb75c3c198bd3ce
Author: Nikita Amelchev <[email protected]>
AuthorDate: Sat Nov 1 14:47:25 2025 +0300

    IGNITE-26904 Added data center ID to the ClusterNodeView (#12490)
---
 .../apache/ignite/spi/systemview/view/ClusterNodeView.java   | 12 +++++++++++-
 .../apache/ignite/internal/metric/SystemViewSelfTest.java    |  6 +++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ClusterNodeView.java
 
b/modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ClusterNodeView.java
index 72afa4d2cea..b668a22fd2b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ClusterNodeView.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/spi/systemview/view/ClusterNodeView.java
@@ -95,16 +95,26 @@ public class ClusterNodeView {
      * @return {@code True} if node local.
      * @see ClusterNode#isLocal()
      */
+    @Order(7)
     public boolean isLocal() {
         return n.isLocal();
     }
 
     /**
      * @return {@code True} if node is client.
-     * @see ClusterNode#isClient() ()
+     * @see ClusterNode#isClient()
      */
     @Order(3)
     public boolean isClient() {
         return n.isClient();
     }
+
+    /**
+     * @return Data center ID.
+     * @see ClusterNode#dataCenterId()
+     */
+    @Order(8)
+    public String dataCenterId() {
+        return n.dataCenterId();
+    }
 }
diff --git 
a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
 
b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
index 80f022dd81f..84b68d8eb7c 100644
--- 
a/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
+++ 
b/modules/core/src/test/java/org/apache/ignite/internal/metric/SystemViewSelfTest.java
@@ -143,12 +143,14 @@ import 
org.apache.ignite.spi.systemview.view.datastructures.ReentrantLockView;
 import org.apache.ignite.spi.systemview.view.datastructures.SemaphoreView;
 import org.apache.ignite.spi.systemview.view.datastructures.SetView;
 import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.WithSystemProperty;
 import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
 import org.apache.ignite.transactions.Transaction;
 import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
+import static org.apache.ignite.IgniteSystemProperties.IGNITE_DATA_CENTER_ID;
 import static 
org.apache.ignite.configuration.AtomicConfiguration.DFLT_ATOMIC_SEQUENCE_RESERVE_SIZE;
 import static org.apache.ignite.events.EventType.EVT_CONSISTENCY_VIOLATION;
 import static org.apache.ignite.internal.IgniteKernal.CFG_VIEW;
@@ -829,6 +831,7 @@ public class SystemViewSelfTest extends 
GridCommonAbstractTest {
 
     /** */
     @Test
+    @WithSystemProperty(key = IGNITE_DATA_CENTER_ID, value = "DC0")
     public void testNodes() throws Exception {
         try (IgniteEx g1 = startGrid(0)) {
             SystemView<ClusterNodeView> views = 
g1.context().systemView().view(NODES_SYS_VIEW);
@@ -840,7 +843,6 @@ public class SystemViewSelfTest extends 
GridCommonAbstractTest {
 
                 checkViewsState(views, g1.localNode(), g2.localNode());
                 
checkViewsState(g2.context().systemView().view(NODES_SYS_VIEW), g2.localNode(), 
g1.localNode());
-
             }
 
             assertEquals(1, views.size());
@@ -962,6 +964,8 @@ public class SystemViewSelfTest extends 
GridCommonAbstractTest {
         assertEquals(node.version().toString(), view.version());
         assertEquals(isLoc, view.isLocal());
         assertEquals(node.isClient(), view.isClient());
+        assertEquals(node.dataCenterId(), view.dataCenterId());
+        assertEquals("DC0", view.dataCenterId());
     }
 
     /** */

Reply via email to