-
Notifications
You must be signed in to change notification settings - Fork 414
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-2036 Avoid trigger snapshot when removing raftGroup #1055
Conversation
e8e5e88
to
6e33b0b
Compare
@szetszwo PTAL |
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.
@OneSizeFitsQuorum , thanks for working on this! Then change looks good. Just two minor comments inlined.
return (triggerSnapshotWhenStopEnabled || isRemoving) | ||
&& (triggerSnapshotWhenRemoveEnabled || !isRemoving); |
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 shouldTakeSnapshotAtStop
. We may simply the logic as below:
private boolean shouldTakeSnapshotAtStop() {
if (isRemoving) {
return triggerSnapshotWhenRemoveEnabled;
} else {
return triggerSnapshotWhenStopEnabled;
}
}
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 codes looks much clearer!
void setRemoving() { | ||
this.isRemoving = true; | ||
} | ||
|
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 move it to right below shouldTakeSnapshotAtStop()
.
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.
OK
Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
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.
see jira