-
Notifications
You must be signed in to change notification settings - Fork 25.3k
Remove obsolete deprecation checks #37510
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
gwbrown
merged 6 commits into
elastic:master
from
gwbrown:depcheck/remove-old-checks-from-7
Jan 18, 2019
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b75a926
Remove obsolete deprecation checks
gwbrown 545bd1e
Add toString to DeprecationIssue
gwbrown 9ba54e5
Bring filterChecks across from 6.x
gwbrown ff44b59
License headers
gwbrown f9268db
Merge branch 'master' into depcheck/remove-old-checks-from-7
gwbrown f8a6c8b
Merge branch 'master' into depcheck/remove-old-checks-from-7
gwbrown 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
41 changes: 41 additions & 0 deletions
41
...deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DeprecationChecksTests.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,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
package org.elasticsearch.xpack.deprecation; | ||
|
||
import org.elasticsearch.test.ESTestCase; | ||
import org.elasticsearch.xpack.core.deprecation.DeprecationInfoAction; | ||
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Supplier; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class DeprecationChecksTests extends ESTestCase { | ||
|
||
public void testFilterChecks() { | ||
DeprecationIssue issue = createRandomDeprecationIssue(); | ||
int numChecksPassed = randomIntBetween(0, 5); | ||
int numChecksFailed = 10 - numChecksPassed; | ||
List<Supplier<DeprecationIssue>> checks = new ArrayList<>(); | ||
for (int i = 0; i < numChecksFailed; i++) { | ||
checks.add(() -> issue); | ||
} | ||
for (int i = 0; i < numChecksPassed; i++) { | ||
checks.add(() -> null); | ||
} | ||
List<DeprecationIssue> filteredIssues = DeprecationInfoAction.filterChecks(checks, Supplier::get); | ||
assertThat(filteredIssues.size(), equalTo(numChecksFailed)); | ||
} | ||
|
||
private static DeprecationIssue createRandomDeprecationIssue() { | ||
String details = randomBoolean() ? randomAlphaOfLength(10) : null; | ||
return new DeprecationIssue(randomFrom(DeprecationIssue.Level.values()), randomAlphaOfLength(10), | ||
randomAlphaOfLength(10), details); | ||
} | ||
} |
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.
Can you help me understand why indices created prior to 7.0 is a critical (or even an issue), and why are we linking to the 8.0 breaking changes.
The code looks fine, i think i am just missing something here.
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.
Absolutely: Our policy as listed in the docs is that each Elasticsearch version supports indices created in the previous major version, but any that are older than that can't be used. That is, 6.x can open indices created in 5.x, but not indices created in 2.x - those must be reindexed, either in 5.x before upgrading or using reindex-from-remote.
Due to that, the Deprecations API reports any indices which need to be reindexed before upgrading to the next major version: in 6.x, we'll flag indices which were created in 5.x and need to be reindexed before upgrading the cluster to 7.x.
With this PR, the Deprecations API on 7.x clusters will report any indices that will need to be reindexed before upgrading to the next major version (assumed to be 8.0). This lets us leave at least one check in place as an example, even though there aren't any breaking changes in 8.0 yet (because 8.0 doesn't exist yet).
We may want to switch out the link, as it is kind of making assumptions about the structure of documentation that doesn't exist yet - I could make it point to the page listing the policy about indices created in previous versions for now.
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 the explains, that makes sense! I think guessing the 8.0 URL is a safe bet and plenty of time to fix it guessed wrong.