From 8aac22e8b78ef0ec8c7653b9732a8bc94b6be040 Mon Sep 17 00:00:00 2001 From: Pat Whelan Date: Mon, 10 Feb 2025 11:06:00 -0500 Subject: [PATCH 1/3] [Deprecation] Transform Destination Index message When we detect that a Transform writes to the index and the index is incompatible with the next version, change the message, detail, and URL to help the user take the necessary steps to migrate the destination index. --- .../deprecation/IndexDeprecationChecker.java | 80 ++++++---- .../IndexDeprecationCheckerTests.java | 137 +++++++++++++++--- 2 files changed, 173 insertions(+), 44 deletions(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java index 844988c7a4896..e714116c82863 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java @@ -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 meta(IndexMetadata indexMetadata, Map> 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 transformIdsForIndex(IndexMetadata indexMetadata, Map> 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", + 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", + "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; } diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java index 296ae31cd9f24..9c9968a408a1a 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java @@ -102,9 +102,10 @@ public void testOldTransformIndicesCheck() { .build(); var expected = 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: " + OLD_VERSION.toReleaseVersion(), + "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", + "Transforms [test-transform] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform")) ); @@ -124,9 +125,10 @@ public void testOldIndicesCheckWithMultipleTransforms() { .build(); var expected = 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: " + OLD_VERSION.toReleaseVersion(), + "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", + "Transforms [test-transform1, test-transform2] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1", "test-transform2")) ); @@ -150,9 +152,10 @@ public void testMultipleOldIndicesCheckWithTransforms() { List.of( 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: " + OLD_VERSION.toReleaseVersion(), + "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", + "Transforms [test-transform1] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1")) ) @@ -161,9 +164,10 @@ public void testMultipleOldIndicesCheckWithTransforms() { List.of( 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: " + OLD_VERSION.toReleaseVersion(), + "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", + "Transforms [test-transform2] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform2")) ) @@ -256,13 +260,7 @@ public void testOldIndicesCheckSnapshotIgnored() { } public void testOldIndicesIgnoredWarningCheck() { - Settings.Builder settings = settings(OLD_VERSION).put(MetadataIndexStateService.VERIFIED_READ_ONLY_SETTING.getKey(), true); - IndexMetadata indexMetadata = IndexMetadata.builder("test") - .settings(settings) - .numberOfShards(1) - .numberOfReplicas(0) - .state(indexMetdataState) - .build(); + IndexMetadata indexMetadata = readonlyIndexMetadata("test", OLD_VERSION); ClusterState clusterState = ClusterState.builder(ClusterState.EMPTY_STATE) .metadata(Metadata.builder().put(indexMetadata, true)) .blocks(clusterBlocksForIndices(indexMetadata)) @@ -284,6 +282,107 @@ public void testOldIndicesIgnoredWarningCheck() { assertEquals(List.of(expected), issuesByIndex.get("test")); } + private IndexMetadata readonlyIndexMetadata(String indexName, IndexVersion indexVersion) { + Settings.Builder settings = settings(indexVersion).put(MetadataIndexStateService.VERIFIED_READ_ONLY_SETTING.getKey(), true); + return IndexMetadata.builder(indexName).settings(settings).numberOfShards(1).numberOfReplicas(0).state(indexMetdataState).build(); + } + + public void testOldTransformIndicesIgnoredCheck() { + var checker = new IndexDeprecationChecker(indexNameExpressionResolver); + var indexMetadata = readonlyIndexMetadata("test", OLD_VERSION); + var clusterState = ClusterState.builder(ClusterState.EMPTY_STATE) + .metadata(Metadata.builder().put(indexMetadata, true)) + .blocks(clusterBlocksForIndices(indexMetadata)) + .build(); + var expected = 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", + "Transforms [test-transform] write to this index with version [" + + OLD_VERSION.toReleaseVersion() + + "] and cannot be supported as read-only in 9.0", + false, + Map.of("reindex_required", true, "transform_ids", List.of("test-transform")) + ); + var issuesByIndex = checker.check( + clusterState, + new DeprecationInfoAction.Request(TimeValue.THIRTY_SECONDS), + createContextWithTransformConfigs(Map.of("test", List.of("test-transform"))) + ); + assertEquals(singletonList(expected), issuesByIndex.get("test")); + } + + public void testOldIndicesIgnoredCheckWithMultipleTransforms() { + var indexMetadata = readonlyIndexMetadata("test", OLD_VERSION); + var clusterState = ClusterState.builder(ClusterState.EMPTY_STATE) + .metadata(Metadata.builder().put(indexMetadata, true)) + .blocks(clusterBlocksForIndices(indexMetadata)) + .build(); + var expected = 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", + "Transforms [test-transform1, test-transform2] write to this index with version [" + + OLD_VERSION.toReleaseVersion() + + "] and cannot be supported as read-only in 9.0", + false, + Map.of("reindex_required", true, "transform_ids", List.of("test-transform1", "test-transform2")) + ); + var issuesByIndex = checker.check( + clusterState, + new DeprecationInfoAction.Request(TimeValue.THIRTY_SECONDS), + createContextWithTransformConfigs(Map.of("test", List.of("test-transform1", "test-transform2"))) + ); + assertEquals(singletonList(expected), issuesByIndex.get("test")); + } + + public void testMultipleOldIndicesIgnoredCheckWithTransforms() { + var indexMetadata1 = readonlyIndexMetadata("test1", OLD_VERSION); + var indexMetadata2 = readonlyIndexMetadata("test2", OLD_VERSION); + var clusterState = ClusterState.builder(ClusterState.EMPTY_STATE) + .metadata(Metadata.builder().put(indexMetadata1, true).put(indexMetadata2, true)) + .blocks(clusterBlocksForIndices(indexMetadata1, indexMetadata2)) + .build(); + var expected = Map.of( + "test1", + List.of( + 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", + "Transforms [test-transform1] write to this index with version [" + + OLD_VERSION.toReleaseVersion() + + "] and cannot be supported as read-only in 9.0", + false, + Map.of("reindex_required", true, "transform_ids", List.of("test-transform1")) + ) + ), + "test2", + List.of( + 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", + "Transforms [test-transform2] write to this index with version [" + + OLD_VERSION.toReleaseVersion() + + "] and cannot be supported as read-only in 9.0", + false, + Map.of("reindex_required", true, "transform_ids", List.of("test-transform2")) + ) + ) + ); + var issuesByIndex = checker.check( + clusterState, + new DeprecationInfoAction.Request(TimeValue.THIRTY_SECONDS), + createContextWithTransformConfigs(Map.of("test1", List.of("test-transform1"), "test2", List.of("test-transform2"))) + ); + assertEquals(expected, issuesByIndex); + } + public void testTranslogRetentionSettings() { Settings.Builder settings = settings(IndexVersion.current()); settings.put(IndexSettings.INDEX_TRANSLOG_RETENTION_AGE_SETTING.getKey(), randomPositiveTimeValue()); From 062a8abe10907cb50a0d4f43a91bf342bb19b1ea Mon Sep 17 00:00:00 2001 From: Pat Whelan Date: Tue, 11 Feb 2025 09:45:01 -0500 Subject: [PATCH 2/3] Change to a more descriptive details message --- .../deprecation/IndexDeprecationChecker.java | 18 ++++--- .../IndexDeprecationCheckerTests.java | 50 ++++++++++++++----- 2 files changed, 48 insertions(+), 20 deletions(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java index e714116c82863..0b4219e61e60b 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java @@ -104,9 +104,11 @@ private DeprecationIssue oldIndicesCheck( "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() + "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) @@ -145,9 +147,11 @@ private DeprecationIssue ignoredOldIndicesCheck( "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", - String.join(", ", transforms), - currentCompatibilityVersion.toReleaseVersion() + "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) @@ -155,7 +159,7 @@ private DeprecationIssue ignoredOldIndicesCheck( } else { return new DeprecationIssue( DeprecationIssue.Level.WARNING, - "Old index with a compatibility version < 9.0 Has Been Ignored", + "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() diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java index 9c9968a408a1a..9646fd755b726 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java @@ -105,7 +105,11 @@ public void testOldTransformIndicesCheck() { "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", - "Transforms [test-transform] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", + "This index was created in version [" + + OLD_VERSION.toReleaseVersion() + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms will not be able to write to this index: [test-transform]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform")) ); @@ -128,7 +132,11 @@ public void testOldIndicesCheckWithMultipleTransforms() { "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", - "Transforms [test-transform1, test-transform2] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", + "This index was created in version [" + + OLD_VERSION.toReleaseVersion() + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms will not be able to write to this index: [test-transform1, test-transform2]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1", "test-transform2")) ); @@ -155,7 +163,11 @@ public void testMultipleOldIndicesCheckWithTransforms() { "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", - "Transforms [test-transform1] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", + "This index was created in version [" + + OLD_VERSION.toReleaseVersion() + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms will not be able to write to this index: [test-transform1]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1")) ) @@ -167,7 +179,11 @@ public void testMultipleOldIndicesCheckWithTransforms() { "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", - "Transforms [test-transform2] write to this index with version [" + OLD_VERSION.toReleaseVersion() + "].", + "This index was created in version [" + + OLD_VERSION.toReleaseVersion() + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms will not be able to write to this index: [test-transform2]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform2")) ) @@ -267,7 +283,7 @@ public void testOldIndicesIgnoredWarningCheck() { .build(); DeprecationIssue expected = new DeprecationIssue( DeprecationIssue.Level.WARNING, - "Old index with a compatibility version < 9.0 Has Been Ignored", + "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: " + OLD_VERSION.toReleaseVersion() + " and will be supported as read-only in 9.0", false, @@ -299,9 +315,11 @@ public void testOldTransformIndicesIgnoredCheck() { "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", - "Transforms [test-transform] write to this index with version [" + "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and cannot be supported as read-only in 9.0", + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms are no longer able to write to this index: [test-transform]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform")) ); @@ -324,9 +342,11 @@ public void testOldIndicesIgnoredCheckWithMultipleTransforms() { "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", - "Transforms [test-transform1, test-transform2] write to this index with version [" + "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and cannot be supported as read-only in 9.0", + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms are no longer able to write to this index: [test-transform1, test-transform2]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1", "test-transform2")) ); @@ -353,9 +373,11 @@ public void testMultipleOldIndicesIgnoredCheckWithTransforms() { "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", - "Transforms [test-transform1] write to this index with version [" + "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and cannot be supported as read-only in 9.0", + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms are no longer able to write to this index: [test-transform1]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1")) ) @@ -367,9 +389,11 @@ public void testMultipleOldIndicesIgnoredCheckWithTransforms() { "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", - "Transforms [test-transform2] write to this index with version [" + "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and cannot be supported as read-only in 9.0", + + "] and will be supported as a read-only index in 9.0. " + + "The following transforms are no longer able to write to this index: [test-transform2]. Refer to the " + + "migration guide to learn more about how to handle your transforms destination indices.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform2")) ) From 1b66481ce120c767f96c05787f127154a3cbf15b Mon Sep 17 00:00:00 2001 From: Pat Whelan Date: Wed, 12 Feb 2025 10:25:43 -0500 Subject: [PATCH 3/3] Change critical message based on slack convo --- .../deprecation/IndexDeprecationChecker.java | 6 ++--- .../IndexDeprecationCheckerTests.java | 24 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java index 0b4219e61e60b..6bed9143175ca 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java @@ -104,9 +104,9 @@ private DeprecationIssue oldIndicesCheck( "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.", + "This index was created in version [%s] and requires action before upgrading to 9.0. The following transforms are " + + "configured to write to this index: [%s]. Refer to the migration guide to learn more about how to prepare " + + "transforms destination indices for your upgrade.", currentCompatibilityVersion.toReleaseVersion(), String.join(", ", transforms) ), diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java index 9646fd755b726..44a7d4bf57bdc 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java @@ -107,9 +107,9 @@ public void testOldTransformIndicesCheck() { + "#breaking_90_transform_destination_index", "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and will be supported as a read-only index in 9.0. " - + "The following transforms will not be able to write to this index: [test-transform]. Refer to the " - + "migration guide to learn more about how to handle your transforms destination indices.", + + "] and requires action before upgrading to 9.0. " + + "The following transforms are configured to write to this index: [test-transform]. Refer to the " + + "migration guide to learn more about how to prepare transforms destination indices for your upgrade.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform")) ); @@ -134,9 +134,9 @@ public void testOldIndicesCheckWithMultipleTransforms() { + "#breaking_90_transform_destination_index", "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and will be supported as a read-only index in 9.0. " - + "The following transforms will not be able to write to this index: [test-transform1, test-transform2]. Refer to the " - + "migration guide to learn more about how to handle your transforms destination indices.", + + "] and requires action before upgrading to 9.0. " + + "The following transforms are configured to write to this index: [test-transform1, test-transform2]. Refer to the " + + "migration guide to learn more about how to prepare transforms destination indices for your upgrade.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1", "test-transform2")) ); @@ -165,9 +165,9 @@ public void testMultipleOldIndicesCheckWithTransforms() { + "#breaking_90_transform_destination_index", "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and will be supported as a read-only index in 9.0. " - + "The following transforms will not be able to write to this index: [test-transform1]. Refer to the " - + "migration guide to learn more about how to handle your transforms destination indices.", + + "] and requires action before upgrading to 9.0. " + + "The following transforms are configured to write to this index: [test-transform1]. Refer to the " + + "migration guide to learn more about how to prepare transforms destination indices for your upgrade.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform1")) ) @@ -181,9 +181,9 @@ public void testMultipleOldIndicesCheckWithTransforms() { + "#breaking_90_transform_destination_index", "This index was created in version [" + OLD_VERSION.toReleaseVersion() - + "] and will be supported as a read-only index in 9.0. " - + "The following transforms will not be able to write to this index: [test-transform2]. Refer to the " - + "migration guide to learn more about how to handle your transforms destination indices.", + + "] and requires action before upgrading to 9.0. " + + "The following transforms are configured to write to this index: [test-transform2]. Refer to the " + + "migration guide to learn more about how to prepare transforms destination indices for your upgrade.", false, Map.of("reindex_required", true, "transform_ids", List.of("test-transform2")) )