ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yzhda...@apache.org
Subject [06/13] incubator-ignite git commit: Fixed metrics "totalNodes" for single node.
Date Fri, 20 Mar 2015 09:46:19 GMT
Fixed metrics "totalNodes" for single node.


Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/48b41f2d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/48b41f2d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/48b41f2d

Branch: refs/heads/ignite-45
Commit: 48b41f2d82b0d792b880342e14c82e699e18ee7d
Parents: 2e6e93d
Author: nikolay_tikhonov <ntikhonov@gridgain.com>
Authored: Thu Mar 19 17:14:56 2015 +0300
Committer: nikolay_tikhonov <ntikhonov@gridgain.com>
Committed: Thu Mar 19 17:14:56 2015 +0300

----------------------------------------------------------------------
 .../discovery/GridDiscoveryManager.java         |  1 +
 .../internal/ClusterNodeMetricsSelfTest.java    | 31 ++++++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48b41f2d/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index f5354b3..c37ac3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -519,6 +519,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi>
{
                 nm.setMaximumThreadCount(metrics.getPeakThreadCount());
                 nm.setTotalStartedThreadCount(metrics.getTotalStartedThreadCount());
                 nm.setCurrentDaemonThreadCount(metrics.getDaemonThreadCount());
+                nm.setTotalNodes(1);
 
                 // Data metrics.
                 nm.setLastDataVersion(ctx.cache().lastDataVersion());

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/48b41f2d/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
index 87bb788..3d0df7c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
@@ -22,8 +22,13 @@ import org.apache.ignite.cluster.*;
 import org.apache.ignite.configuration.*;
 import org.apache.ignite.events.*;
 import org.apache.ignite.internal.processors.task.*;
+import org.apache.ignite.internal.util.lang.*;
 import org.apache.ignite.lang.*;
 import org.apache.ignite.messaging.*;
+import org.apache.ignite.spi.discovery.tcp.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.*;
 import org.apache.ignite.testframework.junits.common.*;
 
 import java.io.*;
@@ -37,6 +42,9 @@ import static org.apache.ignite.events.EventType.*;
  */
 @GridCommonTest(group = "Kernal Self")
 public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
+    /** */
+    private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
     /** Test message size. */
     private static final int MSG_SIZE = 1024;
 
@@ -57,6 +65,12 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest
{
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        TcpDiscoverySpi spi = new TcpDiscoverySpi();
+
+        spi.setIpFinder(IP_FINDER);
+
+        cfg.setDiscoverySpi(spi);
+
         cfg.setCacheConfiguration();
         cfg.setMetricsUpdateFrequency(0);
 
@@ -231,8 +245,15 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest
{
      * @throws Exception If failed.
      */
     public void testClusterNodeMetrics() throws Exception {
-        Ignite ignite0 = grid();
-        Ignite ignite1 = startGrid(1);
+        final Ignite ignite0 = grid();
+        final Ignite ignite1 = startGrid(1);
+
+        GridTestUtils.waitForCondition(new GridAbsPredicate() {
+            @Override
+            public boolean apply() {
+                return ignite0.cluster().nodes().size() == 2 && ignite1.cluster().nodes().size()
== 2;
+            }
+        }, 3000L);
 
         ClusterMetrics metrics0 = ignite0.cluster().localNode().metrics();
 
@@ -240,6 +261,12 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest
{
             ignite0.cluster().forNode(ignite0.cluster().localNode(), ignite1.cluster().localNode()).metrics();
 
         assertEquals(metrics0.getTotalCpus(), nodesMetrics.getTotalCpus());
+        assertEquals(1, metrics0.getTotalNodes());
+        assertEquals(2, nodesMetrics.getTotalNodes());
+
+        assert metrics0.getHeapMemoryUsed() > 0;
+        assert metrics0.getHeapMemoryTotal() > 0;
+        assert metrics0.getNonHeapMemoryMaximum() > 0;
     }
 
     /**


Mime
View raw message