cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slebre...@apache.org
Subject [3/6] cassandra git commit: Allow nodetool info to run with readonly JMX access
Date Thu, 23 Jun 2016 09:13:20 GMT
Allow nodetool info to run with readonly JMX access

Patch by Jérôme Mainaud; Reviewed by Paulo Motta for CASSANDRA-11755


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

Branch: refs/heads/trunk
Commit: 774e59dc3d1e51b700413642416c202376bcb061
Parents: 0171259
Author: Jérôme Mainaud <jerome@mainaud.com>
Authored: Tue Jun 21 10:25:53 2016 -0300
Committer: Sylvain Lebresne <sylvain@datastax.com>
Committed: Thu Jun 23 11:12:21 2016 +0200

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 .../cassandra/locator/EndpointSnitchInfo.java     | 11 +++++++++++
 .../locator/EndpointSnitchInfoMBean.java          |  9 +++++++++
 .../org/apache/cassandra/tools/NodeProbe.java     | 18 ++----------------
 4 files changed, 23 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/774e59dc/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 59a9794..0be1043 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.7
+ * Allow nodetool info to run with readonly JMX access (CASSANDRA-11755)
  * Validate bloom_filter_fp_chance against lowest supported
    value when the table is created (CASSANDRA-11920)
  * RandomAccessReader: call isEOF() only when rebuffering, not for every read operation (CASSANDRA-12013)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/774e59dc/src/java/org/apache/cassandra/locator/EndpointSnitchInfo.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/locator/EndpointSnitchInfo.java b/src/java/org/apache/cassandra/locator/EndpointSnitchInfo.java
index c2f88bb..bbfabb6 100644
--- a/src/java/org/apache/cassandra/locator/EndpointSnitchInfo.java
+++ b/src/java/org/apache/cassandra/locator/EndpointSnitchInfo.java
@@ -25,6 +25,7 @@ import javax.management.MBeanServer;
 import javax.management.ObjectName;
 
 import org.apache.cassandra.config.DatabaseDescriptor;
+import org.apache.cassandra.utils.FBUtilities;
 
 public class EndpointSnitchInfo implements EndpointSnitchInfoMBean
 {
@@ -51,6 +52,16 @@ public class EndpointSnitchInfo implements EndpointSnitchInfoMBean
         return DatabaseDescriptor.getEndpointSnitch().getRack(InetAddress.getByName(host));
     }
 
+    public String getDatacenter()
+    {
+        return DatabaseDescriptor.getEndpointSnitch().getDatacenter(FBUtilities.getBroadcastAddress());
+    }
+
+    public String getRack()
+    {
+        return DatabaseDescriptor.getEndpointSnitch().getRack(FBUtilities.getBroadcastAddress());
+    }
+
     public String getSnitchName()
     {
         return DatabaseDescriptor.getEndpointSnitch().getClass().getName();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/774e59dc/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 84d2499..6de5022 100644
--- a/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java
+++ b/src/java/org/apache/cassandra/locator/EndpointSnitchInfoMBean.java
@@ -38,6 +38,15 @@ public interface EndpointSnitchInfoMBean
      */
     public String getDatacenter(String host) throws UnknownHostException;
 
+    /**
+     * Provides the Rack name depending on the respective snitch used for this node
+     */
+    public String getRack();
+
+    /**
+     * Provides the Datacenter name depending on the respective snitch used for this node
+     */
+    public String getDatacenter();
 
     /**
      * Provides the snitch name of the cluster

http://git-wip-us.apache.org/repos/asf/cassandra/blob/774e59dc/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 2f27cea..24c5874 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -780,26 +780,12 @@ public class NodeProbe implements AutoCloseable
 
     public String getDataCenter()
     {
-        try
-        {
-            return getEndpointSnitchInfoProxy().getDatacenter(getEndpoint());
-        }
-        catch (UnknownHostException e)
-        {
-            return "Unknown";
-        }
+        return getEndpointSnitchInfoProxy().getDatacenter();
     }
 
     public String getRack()
     {
-        try
-        {
-            return getEndpointSnitchInfoProxy().getRack(getEndpoint());
-        }
-        catch (UnknownHostException e)
-        {
-            return "Unknown";
-        }
+        return getEndpointSnitchInfoProxy().getRack();
     }
 
     public List<String> getKeyspaces()


Mime
View raw message