Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed Dec 11, 2024
1 parent 5da0298 commit 091c139
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ static void checkForIndexCompatibility(Logger logger, DataPath... dataPaths) thr

logger.info("oldest index version recorded in NodeMetadata {}", metadata.oldestIndexVersion());

if (metadata.oldestIndexVersion().isLegacyIndexVersion()) {
if (metadata.oldestIndexVersion().before(IndexVersions.MINIMUM_COMPATIBLE)) {
String bestDowngradeVersion = getBestDowngradeVersion(metadata.previousNodeVersion().toString());
throw new IllegalStateException(
"Cannot start this node because it holds metadata for indices with version ["
Expand All @@ -534,7 +534,7 @@ static void checkForIndexCompatibility(Logger logger, DataPath... dataPaths) thr
+ "] is incompatible. Revert this node to version ["
+ bestDowngradeVersion
+ "] and delete any indices with versions earlier than ["
+ IndexVersions.MINIMUM_READONLY_COMPATIBLE.toReleaseVersion()
+ IndexVersions.MINIMUM_COMPATIBLE.toReleaseVersion()
+ "] before upgrading to version ["
+ Build.current().version()
+ "]. If all such indices have already been deleted, revert this node to version ["
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ public RepositoriesModule(
}
if (preRestoreChecks.isEmpty()) {
preRestoreChecks.add((snapshot, version) -> {
if (version.isLegacyIndexVersion()) {
if (version.before(IndexVersions.MINIMUM_COMPATIBLE)) {
throw new SnapshotRestoreException(
snapshot,
"the snapshot was created with Elasticsearch version ["
+ version.toReleaseVersion()
+ "] which is below the current versions minimum index compatibility version ["
+ IndexVersions.MINIMUM_READONLY_COMPATIBLE.toReleaseVersion()
+ IndexVersions.MINIMUM_COMPATIBLE.toReleaseVersion()
+ "]"
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ public IndexMetadata getSnapshotIndexMetaData(RepositoryData repositoryData, Sna
.put(
IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey(),
metadata.settings()
.getAsVersionId(
"version",
IndexVersion::fromId,
IndexVersion.fromId(randomFrom(5000099, 6000099, 7000099))
)
.getAsVersionId("version", IndexVersion::fromId, IndexVersion.fromId(randomFrom(5000099, 6000099)))
)
)
.build();
Expand Down

0 comments on commit 091c139

Please sign in to comment.