-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Force Merge should reject requests with only_expunge_deletes
and max_num_segments
set
#44761
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3fa0605
Force Merge should barf when only_expunge_deletes and max_num_segment…
tlrx 9b8f696
Add breaking notes
tlrx ccdad77
fix license header
tlrx 6fd2191
add missing include docs
tlrx 85980d0
Fix IndicesClientDocumentationIT.java
tlrx 832cead
Merge branch 'master' into force-merge-and-deletes
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[float] | ||
[[breaking_80_indices_changes]] | ||
=== Force Merge API changes | ||
|
||
Previously, the Force Merge API allowed the parameters `only_expunge_deletes` | ||
and `max_num_segments` to be set to a non default value at the same time. But | ||
the `max_num_segments` was silently ignored when `only_expunge_deletes` is set | ||
to `true`, leaving the false impression that it has been applied. | ||
|
||
The Force Merge API now rejects requests that have a `max_num_segments` greater | ||
than or equal to 0 when the `only_expunge_deletes` is set to true. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
...c/test/java/org/elasticsearch/action/admin/indices/forcemerge/ForceMergeRequestTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.elasticsearch.action.admin.indices.forcemerge; | ||
|
||
import org.elasticsearch.action.ActionRequestValidationException; | ||
import org.elasticsearch.test.ESTestCase; | ||
|
||
import static org.hamcrest.Matchers.contains; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.notNullValue; | ||
import static org.hamcrest.Matchers.nullValue; | ||
|
||
public class ForceMergeRequestTests extends ESTestCase { | ||
|
||
public void testValidate() { | ||
final boolean flush = randomBoolean(); | ||
final boolean onlyExpungeDeletes = randomBoolean(); | ||
final int maxNumSegments = randomIntBetween(ForceMergeRequest.Defaults.MAX_NUM_SEGMENTS, 100); | ||
|
||
final ForceMergeRequest request = new ForceMergeRequest(); | ||
request.flush(flush); | ||
request.onlyExpungeDeletes(onlyExpungeDeletes); | ||
request.maxNumSegments(maxNumSegments); | ||
|
||
assertThat(request.flush(), equalTo(flush)); | ||
assertThat(request.onlyExpungeDeletes(), equalTo(onlyExpungeDeletes)); | ||
assertThat(request.maxNumSegments(), equalTo(maxNumSegments)); | ||
|
||
ActionRequestValidationException validation = request.validate(); | ||
if (onlyExpungeDeletes && maxNumSegments != ForceMergeRequest.Defaults.MAX_NUM_SEGMENTS) { | ||
assertThat(validation, notNullValue()); | ||
assertThat(validation.validationErrors(), contains("cannot set only_expunge_deletes and max_num_segments at the " | ||
+ "same time, those two parameters are mutually exclusive")); | ||
} else { | ||
assertThat(validation, nullValue()); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
++