-
Notifications
You must be signed in to change notification settings - Fork 52
CASSSIDECAR-344: Sidecar endpoint for moving a node to a new token #265
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
Conversation
frankgh
left a comment
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.
Looks good in general. I added a few comments
| */ | ||
| public NodeMoveRequest(String newToken) | ||
| { | ||
| super(ApiEndpointsV1.NODE_MOVE_ROUTE + "?newToken=" + newToken); |
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.
should we make the newToken be part of the body payload instead of having it as a query string?
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, should be in the body since it is part of the actual resource being updated rather than an optional parameter/filter.
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.
I accidentally deleted the commits in the PR from my fork, which automatically closed the PR. I’m unable to reopen it. I’ve created a new PR that addresses this comment: #275
| * | ||
| * @param newToken the new token for the node to move to | ||
| */ | ||
| void move(String newToken); |
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.
I think we need to handle the case where the token does not belong to the node. In Cassandra, it looks like we throw an IOException when token is not valid. Also we should have a test around this.
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.
I accidentally deleted the commits in the PR from my fork, which automatically closed the PR. I’m unable to reopen it. I’ve created a new PR that addresses this comment: #275
| */ | ||
| public NodeMoveRequest(String newToken) | ||
| { | ||
| super(ApiEndpointsV1.NODE_MOVE_ROUTE + "?newToken=" + newToken); |
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, should be in the body since it is part of the actual resource being updated rather than an optional parameter/filter.
| JsonObject streamStats = streamStatsResponse.bodyAsJsonObject(); | ||
| assertThat(streamStats).isNotNull(); | ||
| // The operationMode should be either NORMAL (completed) or MOVING (in progress) | ||
| assertThat(streamStats.getString("operationMode")).isIn("NORMAL", "MOVING"); |
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.
The concern with this is that we get a false negative when no move happened i.e. node remains in NORMAL state. We would need a more concrete way to validate that a move happened - eg. add data to ensure the move takes longer and evaluate validating the end state via ring or token-ranges endpoint.
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.
Done here: #265
| public boolean isRunningOnCassandra() | ||
| { | ||
| String operationMode = storageOperations.operationMode(); | ||
| return OPERATION_MODE_MOVING.equals(operationMode); |
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.
Question is, do we want to fail-fast when we discover the node is not in a NORMAL state here. It would seem reasonable to do so, but worth checking Cassandra's behavior across versions.
366ed95 to
ef6273c
Compare
Sidecar endpoint for moving a node to a new token
These changes are part of the effort to introduce bespoke Sidecar APIs to support key operational functionality currently managed through nodetool commands. Changes in the commit: