-
Notifications
You must be signed in to change notification settings - Fork 25.1k
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
[Deprecation] Refine Transform Destination Index message #122192
Changes from 2 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,37 @@ 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( | ||
"Transforms [%s] write to this index with version [%s].", | ||
String.join(", ", transforms), | ||
currentCompatibilityVersion.toReleaseVersion() | ||
), | ||
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 +137,33 @@ 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, | ||
"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( | ||
"Transforms [%s] write to this index with version [%s] and cannot be supported as read-only in 9.0", | ||
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. I'm not sure a user would know what to do after reading this. It sounds a bit like if they upgrade to 9.0 their cluster might break because this incompatible index isn't ignored and "cannot be supported as read-only in 9.0" Whereas I think we want the takeaway from this message to be "it's fine, you can upgrade, but just beaware that your transforms aren't working" Maybe something like:
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. I agree to change the messaging based on @rudolf's input above. I'm not familiar with the subject, but would it be possible to add something actionable to the end of the message, something that the user can do to mitigate/solve the issue? For example:
|
||
String.join(", ", transforms), | ||
currentCompatibilityVersion.toReleaseVersion() | ||
), | ||
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", | ||
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. Why capital letters in "Has Been Ignored"? 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. I do not know, that's what previously existed. We can edit it probably? |
||
"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.
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)