Maxwell-Guo commented on code in PR #2374:
URL: https://github.com/apache/cassandra/pull/2374#discussion_r1219188518
##########
src/java/org/apache/cassandra/service/StorageService.java:
##########
@@ -5127,100 +5128,113 @@ private void startLeaving()
public void decommission(boolean force) throws InterruptedException
{
- TokenMetadata metadata = tokenMetadata.cloneAfterAllLeft();
- if (operationMode != Mode.LEAVING)
+ try
{
- if
(!tokenMetadata.isMember(FBUtilities.getBroadcastAddressAndPort()))
- throw new UnsupportedOperationException("local node is not a
member of the token ring yet");
- if (metadata.getAllEndpoints().size() < 2)
+ TokenMetadata metadata = tokenMetadata.cloneAfterAllLeft();
+ if (operationMode != Mode.LEAVING)
+ {
+ if
(!tokenMetadata.isMember(FBUtilities.getBroadcastAddressAndPort()))
+ throw new UnsupportedOperationException("local node is not
a member of the token ring yet");
+ if (metadata.getAllEndpoints().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");
- }
- if (!isDecommissioning.compareAndSet(false, true))
- throw new IllegalStateException("Node is still decommissioning.
Check nodetool netstats.");
+ if (operationMode != Mode.NORMAL)
+ throw new UnsupportedOperationException("Node in " +
operationMode + " state; wait for status to become normal or restart");
+ }
+ if (!isDecommissioning.compareAndSet(false, true))
Review Comment:
I think we can not include some code into the try catch , like line 5143
` if (!isDecommissioning.compareAndSet(false, true))`
first time you have execute a decommission, and the node is being doing
decommission which may take a long time ,
and after a while you may execute another decommission , you will got a
false. But actually the node's decommission is be doing now and have not
failed.
you will get a wrong status.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]