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

Expose only_expunge_deletes parameter to ForceMergeAction of ILM #80174

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

gaobinlong
Copy link
Contributor

Relates to #77979.
The main changes are:

  1. Expose only_expunge_deletes parameter to ILM's ForceMergeAction and high level rest client.
  2. Add some tests.
  3. Add the parameter in the ForceMergeAction's document.

@elasticsearchmachine elasticsearchmachine added v8.1.0 external-contributor Pull request authored by a developer outside the Elasticsearch team labels Nov 2, 2021
@lockewritesdocs lockewritesdocs added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Nov 2, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Nov 2, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@andreidan andreidan self-requested a review November 11, 2021 16:45
Copy link
Contributor

@andreidan andreidan left a 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`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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)) {
Copy link
Contributor

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

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

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

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

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

@andreidan
Copy link
Contributor

@elasticmachine ok to test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/ILM+SLM Index and Snapshot lifecycle management >enhancement external-contributor Pull request authored by a developer outside the Elasticsearch team Team:Data Management Meta label for data/management team v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.