-
Notifications
You must be signed in to change notification settings - Fork 25.2k
move replicas action functionality into AllocateAction #32523
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
Pinging @elastic/es-core-infra |
224243c
to
1eeac50
Compare
1eeac50
to
fea1f5e
Compare
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 left a comment asking for an extra test but otherwise I think this is good
assertThat(getStepKey(settings), equalTo(TerminalPolicyStep.KEY)); | ||
assertThat(settings.get(IndexMetaData.INDEX_NUMBER_OF_REPLICAS_SETTING.getKey()), equalTo(String.valueOf(finalNumReplicas))); | ||
}); | ||
} |
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.
Could we also add a test that tests the bug I found (so where we change both replicas and allocate at the same times on a configuration where the resulting nodes would not be enough to allocate the original number of replicas)?
@colings86 thanks for taking a look. I've added a unit test to check the allocation of an unallocated replica |
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.
LGTM
@@ -152,7 +170,8 @@ public boolean equals(Object obj) { | |||
return false; | |||
} | |||
AllocateAction other = (AllocateAction) obj; | |||
return Objects.equals(include, other.include) && Objects.equals(exclude, other.exclude) && Objects.equals(require, other.require); | |||
return Objects.equals(numberOfReplicas, other.numberOfReplicas) && Objects.equals(include, other.include) | |||
&& Objects.equals(exclude, other.exclude) && Objects.equals(require, other.require); |
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.
nit: can we put each of these on its own line as it makes debugging much easier?
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.
yup
thanks! |
Since replica counts and allocation rules are set separately, it is not always clear how many replicas are to be allocated in the allocate action. Moving the replicas action to occur at the same time as the allocate action, resolves this confusion that could end an undesired state. This means that the ReplicasAction is removed, and a new optional replicas parameter is added to AllocateAction.
Since replica counts and allocation rules are set separately, it is not always clear how many replicas are to be allocated in the allocate action. Moving the replicas action to occur at the same time as the allocate action, resolves this confusion that could end an undesired state. This means that the ReplicasAction is removed, and a new optional replicas parameter is added to AllocateAction.