refuse to decomission if not in state NORMAL

patch by Jan Karlsson and Stefania for CASSANDRA-8741
This commit is contained in:
Stefania Alborghetti 2015-08-27 10:01:07 +08:00 committed by Jonathan Ellis
parent 3f50519141
commit 25373e9945
3 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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())

View File

@ -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);
}
}
}