cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [03/22] cassandra git commit: refuse to decomission if not in state NORMAL patch by Jan Karlsson and Stefania for CASSANDRA-8741
Date Fri, 04 Sep 2015 14:18:29 GMT
refuse to decomission if not in state NORMAL
patch by Jan Karlsson and Stefania for CASSANDRA-8741


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

Branch: refs/heads/cassandra-2.1
Commit: 5bc56c3e407f9deb0c931f63b5d6e4c768a0632d
Parents: 517058f
Author: Stefania Alborghetti <stefania.alborghetti@datastax.com>
Authored: Thu Aug 27 10:01:07 2015 +0800
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri Sep 4 09:13:53 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                               | 1 +
 src/java/org/apache/cassandra/service/StorageService.java | 2 ++
 src/java/org/apache/cassandra/tools/NodeCmd.java          | 9 ++++++++-
 3 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/5bc56c3e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 0e4ade3..d4cc15f 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.0.17
+ * Disallow decommission when node is in drained state (CASSANDRA-8741)
  * Backport CASSANDRA-8013 to 2.0 (CASSANDRA-10144)
  * Make getFullyExpiredSSTables less expensive (CASSANDRA-9882)
  * Add tool to find why expired sstables are not getting dropped (CASSANDRA-10015)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5bc56c3e/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 745fe4c..5ac4980 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -2963,6 +2963,8 @@ public class StorageService extends NotificationBroadcasterSupport implements
IE
             throw new UnsupportedOperationException("local node is not a member of the token
ring yet");
         if (tokenMetadata.cloneAfterAllLeft().sortedTokens().size() < 2)
             throw new UnsupportedOperationException("no other normal nodes in the ring; decommission
would be pointless");
+        if (operationMode != Mode.NORMAL)
+            throw new UnsupportedOperationException("Node in " + operationMode + " state;
wait for status to become normal or restart");
 
         PendingRangeCalculatorService.instance.blockUntilFinished();
         for (String keyspaceName : Schema.instance.getNonSystemKeyspaces())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/5bc56c3e/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 b006d69..8071013 100644
--- a/src/java/org/apache/cassandra/tools/NodeCmd.java
+++ b/src/java/org/apache/cassandra/tools/NodeCmd.java
@@ -1366,7 +1366,8 @@ public class NodeCmd
                         System.err.println("Decommission will decommission the node you are
connected to and does not take arguments!");
                         System.exit(1);
                     }
-                    probe.decommission();
+                    try { probe.decommission(); }
+                    catch (UnsupportedOperationException e) { err("Unsupported operation:
" + e.getMessage()); }
                     break;
 
                 case DRAIN :
@@ -1678,6 +1679,12 @@ public class NodeCmd
         System.exit(1);
     }
 
+    private static void err(String useStr)
+    {
+        System.err.println(useStr);
+        System.exit(1);
+    }
+
     private static void err(Exception e, String errStr)
     {
         System.err.println(errStr);


Mime
View raw message