cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [19/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:45 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/25373e99
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/25373e99
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/25373e99

Branch: refs/heads/trunk
Commit: 25373e9945a3de7a7caf76281098e44bf8c6a8a0
Parents: 3f50519
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:17:50 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt                                                    | 2 ++
 src/java/org/apache/cassandra/service/StorageService.java      | 2 ++
 src/java/org/apache/cassandra/tools/nodetool/Decommission.java | 3 +++
 3 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/25373e99/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 20e1297..7ac7b23 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,8 @@ Merged from 2.1:
  * Change streaming_socket_timeout_in_ms default to 1 hour (CASSANDRA-8611)
  * (cqlsh) update list of CQL keywords (CASSANDRA-9232)
  * Add nodetool gettraceprobability command (CASSANDRA-10234)
+Merged from 2.0:
+ * Disallow decommission when node is in drained state (CASSANDRA-8741)
 
 
 2.2.1

http://git-wip-us.apache.org/repos/asf/cassandra/blob/25373e99/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 883c96b..ef795f9 100644
--- a/src/java/org/apache/cassandra/service/StorageService.java
+++ b/src/java/org/apache/cassandra/service/StorageService.java
@@ -3294,6 +3294,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/25373e99/src/java/org/apache/cassandra/tools/nodetool/Decommission.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/tools/nodetool/Decommission.java b/src/java/org/apache/cassandra/tools/nodetool/Decommission.java
index a3feb67..34890e0 100644
--- a/src/java/org/apache/cassandra/tools/nodetool/Decommission.java
+++ b/src/java/org/apache/cassandra/tools/nodetool/Decommission.java
@@ -34,6 +34,9 @@ public class Decommission extends NodeToolCmd
         } catch (InterruptedException e)
         {
             throw new RuntimeException("Error decommissioning node", e);
+        } catch (UnsupportedOperationException e)
+        {
+            throw new IllegalStateException("Unsupported operation: " + e.getMessage(), e);
         }
     }
 }
\ No newline at end of file


Mime
View raw message