-
Notifications
You must be signed in to change notification settings - Fork 25.7k
[Deprecation] Refine Transform Destination Index message #122192
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 3 commits
8aac22e
99a66aa
062a8ab
1b66481
78785d8
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 |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| import org.elasticsearch.common.TriFunction; | ||
| import org.elasticsearch.common.time.DateFormatter; | ||
| import org.elasticsearch.common.time.LegacyFormatNames; | ||
| import org.elasticsearch.core.Strings; | ||
| import org.elasticsearch.index.IndexModule; | ||
| import org.elasticsearch.index.IndexSettings; | ||
| import org.elasticsearch.index.IndexVersion; | ||
|
|
@@ -95,25 +96,39 @@ private DeprecationIssue oldIndicesCheck( | |
| IndexVersion currentCompatibilityVersion = indexMetadata.getCompatibilityVersion(); | ||
| // We intentionally exclude indices that are in data streams because they will be picked up by DataStreamDeprecationChecks | ||
| if (DeprecatedIndexPredicate.reindexRequired(indexMetadata, false) && isNotDataStreamIndex(indexMetadata, clusterState)) { | ||
| return new DeprecationIssue( | ||
| DeprecationIssue.Level.CRITICAL, | ||
| "Old index with a compatibility version < 9.0", | ||
| "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html", | ||
| "This index has version: " + currentCompatibilityVersion.toReleaseVersion(), | ||
| false, | ||
| meta(indexMetadata, indexToTransformIds) | ||
| ); | ||
| var transforms = transformIdsForIndex(indexMetadata, indexToTransformIds); | ||
| if (transforms.isEmpty() == false) { | ||
| return new DeprecationIssue( | ||
| DeprecationIssue.Level.CRITICAL, | ||
| "One or more Transforms write to this index with a compatibility version < 9.0", | ||
| "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html" | ||
| + "#breaking_90_transform_destination_index", | ||
| Strings.format( | ||
| "This index was created in version [%s] and will be supported as a read-only index in 9.0. The following " | ||
| + "transforms will not be able to write to this index: [%s]. Refer to the migration guide to learn more " | ||
| + "about how to handle your transforms destination indices.", | ||
| currentCompatibilityVersion.toReleaseVersion(), | ||
| String.join(", ", transforms) | ||
| ), | ||
| false, | ||
| Map.of("reindex_required", true, "transform_ids", transforms) | ||
| ); | ||
| } else { | ||
| return new DeprecationIssue( | ||
| DeprecationIssue.Level.CRITICAL, | ||
| "Old index with a compatibility version < 9.0", | ||
| "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html", | ||
| "This index has version: " + currentCompatibilityVersion.toReleaseVersion(), | ||
| false, | ||
| Map.of("reindex_required", true) | ||
| ); | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| private Map<String, Object> meta(IndexMetadata indexMetadata, Map<String, List<String>> indexToTransformIds) { | ||
| var transforms = indexToTransformIds.getOrDefault(indexMetadata.getIndex().getName(), List.of()); | ||
| if (transforms.isEmpty()) { | ||
| return Map.of("reindex_required", true); | ||
| } else { | ||
| return Map.of("reindex_required", true, "transform_ids", transforms); | ||
| } | ||
| private List<String> transformIdsForIndex(IndexMetadata indexMetadata, Map<String, List<String>> indexToTransformIds) { | ||
| return indexToTransformIds.getOrDefault(indexMetadata.getIndex().getName(), List.of()); | ||
| } | ||
|
|
||
| private DeprecationIssue ignoredOldIndicesCheck( | ||
|
|
@@ -124,16 +139,35 @@ private DeprecationIssue ignoredOldIndicesCheck( | |
| IndexVersion currentCompatibilityVersion = indexMetadata.getCompatibilityVersion(); | ||
| // We intentionally exclude indices that are in data streams because they will be picked up by DataStreamDeprecationChecks | ||
| if (DeprecatedIndexPredicate.reindexRequired(indexMetadata, true) && isNotDataStreamIndex(indexMetadata, clusterState)) { | ||
| return new DeprecationIssue( | ||
| DeprecationIssue.Level.WARNING, | ||
| "Old index with a compatibility version < 9.0 Has Been Ignored", | ||
| "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html", | ||
| "This read-only index has version: " | ||
| + currentCompatibilityVersion.toReleaseVersion() | ||
| + " and will be supported as read-only in 9.0", | ||
| false, | ||
| meta(indexMetadata, indexToTransformIds) | ||
| ); | ||
| var transforms = transformIdsForIndex(indexMetadata, indexToTransformIds); | ||
| if (transforms.isEmpty() == false) { | ||
| return new DeprecationIssue( | ||
| DeprecationIssue.Level.WARNING, | ||
|
Member
Author
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. This is probably fine as a warning - this message is emitted when there is a write block on the index, which will pause the transform indefinitely. The Transform will be effectively disabled anyway, and the user should probably delete or reset the Transform (which we can put in the link) |
||
| "One or more Transforms write to this old index with a compatibility version < 9.0", | ||
| "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html" | ||
| + "#breaking_90_transform_destination_index", | ||
| Strings.format( | ||
| "This index was created in version [%s] and will be supported as a read-only index in 9.0. The following " | ||
| + "transforms are no longer able to write to this index: [%s]. Refer to the migration guide to learn more " | ||
| + "about how to handle your transforms destination indices.", | ||
| currentCompatibilityVersion.toReleaseVersion(), | ||
| String.join(", ", transforms) | ||
| ), | ||
| false, | ||
| Map.of("reindex_required", true, "transform_ids", transforms) | ||
| ); | ||
| } else { | ||
| return new DeprecationIssue( | ||
| DeprecationIssue.Level.WARNING, | ||
| "Old index with a compatibility version < 9.0 has been ignored", | ||
| "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html", | ||
| "This read-only index has version: " | ||
| + currentCompatibilityVersion.toReleaseVersion() | ||
| + " and will be supported as read-only in 9.0", | ||
| false, | ||
| Map.of("reindex_required", true) | ||
| ); | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
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.
if (transforms.isEmpty() == false) {doesn't mean this index is read-only. As aCRITICALdeprecation the user still needs to do something to make this index safe for upgrade.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.
We spoke over slack, I'll summarize the discussion here:
I agree that the messaging doesn't quite make sense. We reworded it to highlight:
Much of what we can say will go in the supplemental document supplied by the URL.