-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RATIS-1431. Add ratis-shell add&remove peer command #534
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution, left some minor comments.
ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/command/QuorumRemoveCommand.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public String getCommandName() { | ||
return "quorumRemove"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"quorumRemove" -> "remove"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szetszwo What sub command name do you think is better?
- quorumRemove
- remove
- removePeers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"removePeers" sounds good.
ratis-shell/src/main/java/org/apache/ratis/shell/cli/sh/command/QuorumRemoveCommand.java
Outdated
Show resolved
Hide resolved
@maobaolong I modified the code according to your suggestion. PTAL, thx! |
21ddd95
to
d913886
Compare
@codings-dan , @maobaolong , I think we should combine addPeers and removePeers to a single setConfiguration command so that users can add and remove peers at the same time. What do you think? |
@szetszwo You mean that the original cluster members were A, B, and C, but now they become A, B, and D, right? |
Yes. |
The command could look like:
|
I think this is a good idea, but I tend to modify it to |
How about "group"?
|
Ok, I will modify the code according to this comment |
@szetszwo I modified the code according to your comment. PTAL, thx! And I have tested it locally and there is no problem with the function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@codings-dan , thanks for the update. Some comments inlined and some suggestions can be found in https://issues.apache.org/jira/secure/attachment/13036297/534_review.patch . (It did not rename QuorumCommand to GroupCommand so that it is easily to see the changes. Please do the rename.)
/** | ||
* Command for remove ratis server. | ||
*/ | ||
public class QuorumCommand extends AbstractRatisCommand { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call it GroupCommand.
public static final String REMOVE_PEER_ADDRESS_OPTION_NAME = "removePeer"; | ||
public static final String ADD_PEER_ADDRESS_OPTION_NAME = "addPeer"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use "remove" and "add".
private String[] isFormat(String address) { | ||
String[] str = address.split(":"); | ||
if(str.length < 2) { | ||
println("The format of the parameter is wrong"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's throw an exception.
@codings-dan Please address the comments from @szetszwo and update the description of this PR, combine the add and remove into one command sounds a good idea. |
@szetszwo Thank you for reviewing the code, I modified it according to the patch you left, PTAL, thx! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 the change looks good.
@codings-dan thanks for updating the change and this pull request. Could you also update the JIRAs? |
Jira has been updated. |
What changes were proposed in this pull request?
Add a sub command to remove and add peer.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/RATIS-1431
How was this patch tested?