Skip to content
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

Merged
merged 2 commits into from
Mar 23, 2024

Conversation

OneSizeFitsQuorum
Copy link
Contributor

see jira

Signed-off-by: OneSizeFitQuorum <tanxinyu@apache.org>
@OneSizeFitsQuorum
Copy link
Contributor Author

@szetszwo PTAL

Copy link
Contributor

@szetszwo szetszwo left a 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.

Comment on lines 355 to 356
return (triggerSnapshotWhenStopEnabled || isRemoving)
&& (triggerSnapshotWhenRemoveEnabled || !isRemoving);
Copy link
Contributor

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

Copy link
Contributor Author

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!

Comment on lines 367 to 370
void setRemoving() {
this.isRemoving = true;
}

Copy link
Contributor

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

Copy link
Contributor Author

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>
Copy link
Contributor

@szetszwo szetszwo left a 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.

@szetszwo szetszwo merged commit 0f631fe into apache:master Mar 23, 2024
10 checks passed
@OneSizeFitsQuorum OneSizeFitsQuorum deleted the jira2036 branch March 24, 2024 07:44
symious pushed a commit to symious/ratis that referenced this pull request Apr 11, 2024
SzyWilliam pushed a commit to SzyWilliam/ratis that referenced this pull request Jun 12, 2024
szetszwo pushed a commit to szetszwo/ratis that referenced this pull request Jun 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants