-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
Expose only_expunge_deletes parameter to ForceMergeAction of ILM #80174
base: main
Are you sure you want to change the base?
Conversation
Pinging @elastic/es-data-management (Team:Data Management) |
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 @gaobinlong
This generally looks great, I've left a few rather minor comments. There might be some test failures too, and the conflict with master.
Number of segments to merge to. To fully merge the index, set to `1`. | ||
(Optional, integer) | ||
Number of segments to merge to. To fully merge the index, set to `1`. This parameter conflicts with | ||
`only_expunge_deletes`, cannot be set if `only_expunge_deletes` is set to `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.
`only_expunge_deletes`, cannot be set if `only_expunge_deletes` is set to `true`. | |
`only_expunge_deletes` and it cannot be set if `only_expunge_deletes` is set to `true`. |
If `true`, | ||
expunge all segments containing more than `index.merge.policy.expunge_deletes_allowed` | ||
(default to 10) percents of deleted documents. Defaults to `false`. This parameter conflicts with | ||
`max_num_segments`, cannot be set to `true` if `max_num_segments` has been set. |
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.
`max_num_segments`, cannot be set to `true` if `max_num_segments` has been set. | |
`max_num_segments` and it cannot be set to `true` if `max_num_segments` has been set. |
} | ||
|
||
public ForceMergeAction(StreamInput in) throws IOException { | ||
this.maxNumSegments = in.readVInt(); | ||
if (in.getVersion().onOrAfter(Version.V_7_16_0)) { |
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 believe the version checks need to be against Version.V_8_1_0
this.codec = in.readOptionalString(); | ||
if (in.getVersion().onOrAfter(Version.V_7_16_0)) { |
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 believe the version checks need to be against Version.V_8_1_0
@Override | ||
public void writeTo(StreamOutput out) throws IOException { | ||
out.writeVInt(maxNumSegments); | ||
if (out.getVersion().onOrAfter(Version.V_7_16_0)) { |
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 believe the version checks need to be against Version.V_8_1_0
out.writeOptionalString(codec); | ||
if (out.getVersion().onOrAfter(Version.V_7_16_0)) { |
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 believe the version checks need to be against Version.V_8_1_0
if (onlyExpungeDeletes) { | ||
maxNumSegments = null; | ||
} else { | ||
maxNumSegments = randomIntBetween(1, 10); |
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.
Shall we keep maxNumSegments += 1;
here to avoid a clash? Or otherwise use randomValueOtherThan
@elasticmachine ok to test |
Relates to #77979.
The main changes are:
only_expunge_deletes
parameter to ILM's ForceMergeAction and high level rest client.