Do not allow 'nodetool decommission' to take parameters.
Patch by brandonwilliams, reviewed by vijay for CASSANDRA-4160


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

Branch: refs/heads/cassandra-1.1
Commit: 452619cd07ca7985bff6f6fa8fe6f9764ea7fa4a
Parents: b2ca7f8
Author: Brandon Williams <brandonwilli...@apache.org>
Authored: Wed May 9 11:32:50 2012 -0500
Committer: Brandon Williams <brandonwilli...@apache.org>
Committed: Wed May 9 11:33:42 2012 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/tools/NodeCmd.java |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/452619cd/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 4452ca7..c369771 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -134,7 +134,7 @@ public class NodeCmd
         addCmdHelp(header, "version", "Print cassandra version");
         addCmdHelp(header, "tpstats", "Print usage statistics of thread 
pools");
         addCmdHelp(header, "drain", "Drain the node (stop accepting writes and 
flush all column families)");
-        addCmdHelp(header, "decommission", "Decommission the node");
+        addCmdHelp(header, "decommission", "Decommission the *node I am 
connecting to*");
         addCmdHelp(header, "compactionstats", "Print statistics on 
compactions");
         addCmdHelp(header, "disablegossip", "Disable gossip (effectively 
marking the node dead)");
         addCmdHelp(header, "enablegossip", "Reenable gossip");
@@ -650,7 +650,6 @@ public class NodeCmd
                 case RING            : nodeCmd.printRing(System.out); break;
                 case INFO            : nodeCmd.printInfo(System.out); break;
                 case CFSTATS         : 
nodeCmd.printColumnFamilyStats(System.out); break;
-                case DECOMMISSION    : probe.decommission(); break;
                 case TPSTATS         : 
nodeCmd.printThreadPoolStats(System.out); break;
                 case VERSION         : 
nodeCmd.printReleaseVersion(System.out); break;
                 case COMPACTIONSTATS : 
nodeCmd.printCompactionStats(System.out); break;
@@ -659,7 +658,16 @@ public class NodeCmd
                 case DISABLETHRIFT   : probe.stopThriftServer(); break;
                 case ENABLETHRIFT    : probe.startThriftServer(); break;
                 case STATUSTHRIFT    : 
nodeCmd.printIsThriftServerRunning(System.out); break;
-    
+
+                case DECOMMISSION :
+                    if (arguments.length > 0)
+                    {
+                        System.err.println("Decommission will decommission the 
node you are connected to and does not take arguments!");
+                        System.exit(1);
+                    }
+                    probe.decommission();
+                    break;
+
                 case DRAIN :
                     try { probe.drain(); }
                     catch (ExecutionException ee) { err(ee, "Error occured 
during flushing"); }

Reply via email to