-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Address and remove all occurrences of the Java annotation @UpdateForV9 (ES-9378) #117992
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
Changes from 25 commits
0359c4f
fea2615
9355aa5
af4d6d6
7ebfa1e
dbfdffa
7e16865
75691c2
4f20def
73e715e
58866bd
2071242
16e5f4a
691ceb7
1562b27
6736d8c
cc9268c
852f4be
d7420d4
00beba2
2708b04
f458502
a7b77d1
5fa378f
2b63f8c
cfcd121
cdc716a
662d81e
5ccd08e
d4e3d31
cd9b451
d25d217
0910600
5fe78c0
85d45e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ | |
import org.apache.lucene.store.NativeFSLockFactory; | ||
import org.elasticsearch.Build; | ||
import org.elasticsearch.ElasticsearchException; | ||
import org.elasticsearch.Version; | ||
import org.elasticsearch.cluster.metadata.IndexMetadata; | ||
import org.elasticsearch.cluster.node.DiscoveryNode; | ||
import org.elasticsearch.cluster.node.DiscoveryNodeRole; | ||
|
@@ -86,8 +87,6 @@ | |
import java.util.function.Consumer; | ||
import java.util.function.Function; | ||
import java.util.function.Predicate; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
|
@@ -525,7 +524,7 @@ static void checkForIndexCompatibility(Logger logger, DataPath... dataPaths) thr | |
logger.info("oldest index version recorded in NodeMetadata {}", metadata.oldestIndexVersion()); | ||
|
||
if (metadata.oldestIndexVersion().before(IndexVersions.MINIMUM_COMPATIBLE)) { | ||
String bestDowngradeVersion = getBestDowngradeVersion(metadata.previousNodeVersion().toString()); | ||
BuildVersion bestDowngradeVersion = getBestDowngradeVersion(metadata.previousNodeVersion()); | ||
throw new IllegalStateException( | ||
"Cannot start this node because it holds metadata for indices with version [" | ||
+ metadata.oldestIndexVersion().toReleaseVersion() | ||
|
@@ -1504,28 +1503,17 @@ private static void tryWriteTempFile(Path path) throws IOException { | |
/** | ||
* Get a useful version string to direct a user's downgrade operation | ||
* | ||
* <p>If a user is trying to install 8.0 but has incompatible indices, the user should | ||
* downgrade to 7.17.x. We return 7.17.0, unless the user is trying to upgrade from | ||
* a 7.17.x release, in which case we return the last installed version. | ||
* <p>If a user is trying to install 9.0 (current major) but has incompatible indices, the user should | ||
* downgrade to 8.18.x (last minor of the previous major). We return 8.18.0, unless the user is trying to upgrade from | ||
* a 8.18.x release, in which case we return the last installed version. | ||
* @return Version to downgrade to | ||
*/ | ||
// visible for testing | ||
static String getBestDowngradeVersion(String previousNodeVersion) { | ||
// this method should only be called in the context of an upgrade to 8.x | ||
assert Build.current().version().startsWith("9.") == false; | ||
Pattern pattern = Pattern.compile("^7\\.(\\d+)\\.\\d+$"); | ||
Matcher matcher = pattern.matcher(previousNodeVersion); | ||
if (matcher.matches()) { | ||
try { | ||
int minorVersion = Integer.parseInt(matcher.group(1)); | ||
if (minorVersion >= 17) { | ||
return previousNodeVersion; | ||
} | ||
} catch (NumberFormatException e) { | ||
// continue and return default | ||
} | ||
static BuildVersion getBestDowngradeVersion(BuildVersion previousNodeVersion) { | ||
if (previousNodeVersion.onOrAfterMinimumCompatible()) { | ||
return previousNodeVersion; | ||
} | ||
return "7.17.0"; | ||
return BuildVersion.fromVersionId(Version.CURRENT.minimumCompatibilityVersion().id); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it ok to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not ideal. Maybe we need a |
||
} | ||
|
||
} |
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.
Do we need it?