cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [6/8] git commit: Add 'nodetool statusgossip'
Date Mon, 03 Nov 2014 21:00:53 GMT
Add 'nodetool statusgossip'

Patch by Jan Karlsson, reviewed by Brandon Williams for CASSANDRA-8125


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

Branch: refs/heads/trunk
Commit: fe8e92f8f1ff3adec119c8eb219e024886561196
Parents: 02fa2fd
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Mon Nov 3 14:59:56 2014 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Mon Nov 3 14:59:56 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                           |  1 +
 .../org/apache/cassandra/service/StorageService.java  |  6 ++++++
 .../apache/cassandra/service/StorageServiceMBean.java |  3 +++
 src/java/org/apache/cassandra/tools/NodeProbe.java    |  5 +++++
 src/java/org/apache/cassandra/tools/NodeTool.java     | 14 ++++++++++++++
 5 files changed, 29 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe8e92f8/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 50a540f..b1a8439 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,7 @@
  * Fix CREATE TABLE for CQL2 (CASSANDRA-8144)
  * Avoid boxing in ColumnStats min/max trackers (CASSANDRA-8109)
 Merged from 2.0:
+ * Add 'nodetool statusgossip' (CASSANDRA-8125)
  * Improve client notification that nodes are ready for requests (CASSANDRA-7510)
  * Handle negative timestamp in writetime method (CASSANDRA-8139)
  * Pig: Remove errant LIMIT clause in CqlNativeStorage (CASSANDRA-8166)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe8e92f8/src/java/org/apache/cassandra/service/StorageService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageService.java b/src/java/org/apache/cassandra/service/StorageService.java
index 84a6c14..a49dfc3 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -306,6 +306,12 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
     }
 
     // should only be called via JMX
+    public boolean isGossipRunning()
+    {
+        return Gossiper.instance.isEnabled();
+    }
+
+    // should only be called via JMX
     public void startRPCServer()
     {
         if (daemon == null)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe8e92f8/src/java/org/apache/cassandra/service/StorageServiceMBean.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/service/StorageServiceMBean.java b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
index 8bb13ae..8ae44ff 100644
--- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
@@ -398,6 +398,9 @@ public interface StorageServiceMBean extends NotificationEmitter
     // allows a user to recover a forcibly 'killed' node
     public void startGossiping();
 
+    // allows a user to see whether gossip is running or not
+    public boolean isGossipRunning();
+
     // allows a user to forcibly completely stop cassandra
     public void stopDaemon();
 

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe8e92f8/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 7faec72..d495786 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -829,6 +829,11 @@ public class NodeProbe implements AutoCloseable
         ssProxy.startGossiping();
     }
 
+    public boolean isGossipRunning()
+    {
+        return ssProxy.isGossipRunning();
+    }
+
     public void stopThriftServer()
     {
         ssProxy.stopRPCServer();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/fe8e92f8/src/java/org/apache/cassandra/tools/NodeTool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeTool.java b/src/java/org/apache/cassandra/tools/NodeTool.java
index d5180f0..39bc4fd 100644
--- a/src/java/org/apache/cassandra/tools/NodeTool.java
+++ b/src/java/org/apache/cassandra/tools/NodeTool.java
@@ -127,6 +127,7 @@ public class NodeTool
                 ListSnapshots.class,
                 Status.class,
                 StatusBinary.class,
+                StatusGossip.class,
                 StatusThrift.class,
                 Stop.class,
                 StopDaemon.class,
@@ -2136,6 +2137,19 @@ public class NodeTool
         }
     }
 
+    @Command(name = "statusgossip", description = "Status of gossip")
+    public static class StatusGossip extends NodeToolCmd
+    {
+        @Override
+        public void execute(NodeProbe probe)
+        {
+            System.out.println(
+                    probe.isGossipRunning()
+                    ? "running"
+                    : "not running");
+        }
+    }
+
     @Command(name = "statusthrift", description = "Status of thrift server")
     public static class StatusThrift extends NodeToolCmd
     {


Mime
View raw message