cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasobr...@apache.org
Subject [1/3] cassandra git commit: Print correct snitch info from nodetool describecluster
Date Thu, 18 Jan 2018 12:36:38 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-3.11 02bbdd634 -> fc3357a00
  refs/heads/trunk 7533ff089 -> f428c4262


Print correct snitch info from nodetool describecluster

patch by Lerh Chuan Low; reviewed by jasobrown for CASSANDRA-13528


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/fc3357a0
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/fc3357a0
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/fc3357a0

Branch: refs/heads/cassandra-3.11
Commit: fc3357a00e2b6e56d399f07c5b81a82780c1e143
Parents: 02bbdd6
Author: Lerh Chuan Low <lerh@instaclustr.com>
Authored: Thu Jan 18 09:12:01 2018 +1100
Committer: Jason Brown <jasedbrown@gmail.com>
Committed: Thu Jan 18 04:33:17 2018 -0800

----------------------------------------------------------------------
 CHANGES.txt                                            |  1 +
 .../cassandra/locator/EndpointSnitchInfoMBean.java     |  1 -
 src/java/org/apache/cassandra/tools/NodeProbe.java     | 13 +++++++++++++
 .../cassandra/tools/nodetool/DescribeCluster.java      | 11 ++++++++++-
 4 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc3357a0/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index ebb7a66..c06ad0d 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.11.2
+ * Print correct snitch info from nodetool describecluster (CASSANDRA-13528)
  * Close socket on error during connect on OutboundTcpConnection (CASSANDRA-9630)
  * Enable CDC unittest (CASSANDRA-14141)
  * Acquire read lock before accessing CompactionStrategyManager fields (CASSANDRA-14139)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc3357a0/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java b/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java
index 6de5022..d6a18ff 100644
--- a/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java
+++ b/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java
@@ -53,5 +53,4 @@ public interface EndpointSnitchInfoMBean
      * @return Snitch name
      */
     public String getSnitchName();
-
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc3357a0/src/java/org/apache/cassandra/tools/NodeProbe.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeProbe.java b/src/java/org/apache/cassandra/tools/NodeProbe.java
index 8046c54..f87de35 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -66,6 +66,7 @@ import org.apache.cassandra.gms.FailureDetectorMBean;
 import org.apache.cassandra.gms.Gossiper;
 import org.apache.cassandra.gms.GossiperMBean;
 import org.apache.cassandra.db.HintedHandOffManager;
+import org.apache.cassandra.locator.DynamicEndpointSnitchMBean;
 import org.apache.cassandra.locator.EndpointSnitchInfoMBean;
 import org.apache.cassandra.metrics.CassandraMetricsRegistry;
 import org.apache.cassandra.metrics.TableMetrics.Sampler;
@@ -823,6 +824,18 @@ public class NodeProbe implements AutoCloseable
         }
     }
 
+    public DynamicEndpointSnitchMBean getDynamicEndpointSnitchInfoProxy()
+    {
+        try
+        {
+            return JMX.newMBeanProxy(mbeanServerConn, new ObjectName("org.apache.cassandra.db:type=DynamicEndpointSnitch"),
DynamicEndpointSnitchMBean.class);
+        }
+        catch (MalformedObjectNameException e)
+        {
+            throw new RuntimeException(e);
+        }
+    }
+
     public ColumnFamilyStoreMBean getCfsProxy(String ks, String cf)
     {
         ColumnFamilyStoreMBean cfsProxy = null;

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fc3357a0/src/java/org/apache/cassandra/tools/nodetool/DescribeCluster.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/DescribeCluster.java b/src/java/org/apache/cassandra/tools/nodetool/DescribeCluster.java
index 81dee20..4178998 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/DescribeCluster.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/DescribeCluster.java
@@ -23,6 +23,7 @@ import io.airlift.command.Command;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.cassandra.locator.DynamicEndpointSnitch;
 import org.apache.cassandra.tools.NodeProbe;
 import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
 
@@ -35,7 +36,15 @@ public class DescribeCluster extends NodeToolCmd
         // display cluster name, snitch and partitioner
         System.out.println("Cluster Information:");
         System.out.println("\tName: " + probe.getClusterName());
-        System.out.println("\tSnitch: " + probe.getEndpointSnitchInfoProxy().getSnitchName());
+        String snitch = probe.getEndpointSnitchInfoProxy().getSnitchName();
+        boolean dynamicSnitchEnabled = false;
+        if (snitch.equals(DynamicEndpointSnitch.class.getName()))
+        {
+            snitch = probe.getDynamicEndpointSnitchInfoProxy().getSubsnitchClassName();
+            dynamicSnitchEnabled = true;
+        }
+        System.out.println("\tSnitch: " + snitch);
+        System.out.println("\tDynamicEndPointSnitch: " + (dynamicSnitchEnabled ? "enabled"
: "disabled"));
         System.out.println("\tPartitioner: " + probe.getPartitioner());
 
         // display schema version for each node


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org


Mime
View raw message