cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject [3/8] git commit: Add 'nodetool statusgossip'
Date Mon, 03 Nov 2014 21:00:50 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/83d4762a
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/83d4762a
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/83d4762a

Branch: refs/heads/trunk
Commit: 83d4762a6d6c28c792fadc1d7f228600097d924f
Parents: 5548bf4
Author: Brandon Williams <brandonwilliams@apache.org>
Authored: Mon Nov 3 14:58:04 2014 -0600
Committer: Brandon Williams <brandonwilliams@apache.org>
Committed: Mon Nov 3 14:58:04 2014 -0600

----------------------------------------------------------------------
 CHANGES.txt                                                  | 1 +
 src/java/org/apache/cassandra/service/StorageService.java    | 6 ++++++
 .../org/apache/cassandra/service/StorageServiceMBean.java    | 3 +++
 src/java/org/apache/cassandra/tools/NodeCmd.java             | 8 ++++++++
 src/java/org/apache/cassandra/tools/NodeProbe.java           | 5 +++++
 src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml   | 3 +++
 6 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/83d4762a/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0ec3ff1..97fb94a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.12:
+ * 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/83d4762a/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 1f831b9..066544a 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -293,6 +293,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()
     {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/83d4762a/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 6308aa5..0e2f55d 100644
--- a/src/java/org/apache/cassandra/service/StorageServiceMBean.java
+++ b/src/java/org/apache/cassandra/service/StorageServiceMBean.java
@@ -392,6 +392,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/83d4762a/src/java/org/apache/cassandra/tools/NodeCmd.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/NodeCmd.java b/src/java/org/apache/cassandra/tools/NodeCmd.java
index d9f3607..a397244 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -27,6 +27,7 @@ import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.Map.Entry;
 import java.util.concurrent.ExecutionException;
+
 import javax.management.openmbean.TabularData;
 
 import com.google.common.base.Joiner;
@@ -171,6 +172,7 @@ public class NodeCmd
         SNAPSHOT,
         STATUS,
         STATUSBINARY,
+        STATUSGOSSIP,
         STATUSTHRIFT,
         STOP,
         STOPDAEMON,
@@ -1246,6 +1248,7 @@ public class NodeCmd
                 case STATUSBINARY    : nodeCmd.printIsNativeTransportRunning(System.out);
break;
                 case DISABLEGOSSIP   : probe.stopGossiping(); break;
                 case ENABLEGOSSIP    : probe.startGossiping(); break;
+                case STATUSGOSSIP    : nodeCmd.printIsGossipRunning(System.out); break;
                 case DISABLEHANDOFF  : probe.disableHintedHandoff(); break;
                 case ENABLEHANDOFF   :
                     if (arguments.length > 0) { probe.enableHintedHandoff(arguments[0]);
}
@@ -1494,6 +1497,11 @@ public class NodeCmd
         System.exit(probe.isFailed() ? 1 : 0);
     }
 
+    private void printIsGossipRunning(PrintStream outs)
+    {
+        outs.println(probe.isGossipRunning() ? "running" : "not running");
+    }
+
     private void getLoggingLevels(PrintStream out)
     {
         // what if some one set a very long logger name? 50 space may not be enough...

http://git-wip-us.apache.org/repos/asf/cassandra/blob/83d4762a/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 78dce76..849e368 100644
--- a/src/java/org/apache/cassandra/tools/NodeProbe.java
+++ b/src/java/org/apache/cassandra/tools/NodeProbe.java
@@ -782,6 +782,11 @@ public class NodeProbe
         ssProxy.startGossiping();
     }
 
+    public boolean isGossipRunning()
+    {
+        return ssProxy.isGossipRunning();
+    }
+
     public void stopThriftServer()
     {
         ssProxy.stopRPCServer();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/83d4762a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
----------------------------------------------------------------------
diff --git a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
index fa2b39c..523335e 100644
--- a/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
+++ b/src/resources/org/apache/cassandra/tools/NodeToolHelp.yaml
@@ -100,6 +100,9 @@ commands:
   - name: gossipinfo
     help: |
       Shows the gossip information for the cluster
+  - name: statusgossip
+    help: |
+      Status of gossip
   - name: invalidatekeycache
     help: |
       Invalidate the key cache


Mime
View raw message