@@ -102,9 +102,14 @@ public void testOldTransformIndicesCheck() {
102102 .build ();
103103 var expected = new DeprecationIssue (
104104 DeprecationIssue .Level .CRITICAL ,
105- "Old index with a compatibility version < 9.0" ,
106- "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html" ,
107- "This index has version: " + OLD_VERSION .toReleaseVersion (),
105+ "One or more Transforms write to this index with a compatibility version < 9.0" ,
106+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
107+ + "#breaking_90_transform_destination_index" ,
108+ "This index was created in version ["
109+ + OLD_VERSION .toReleaseVersion ()
110+ + "] and requires action before upgrading to 9.0. "
111+ + "The following transforms are configured to write to this index: [test-transform]. Refer to the "
112+ + "migration guide to learn more about how to prepare transforms destination indices for your upgrade." ,
108113 false ,
109114 Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform" ))
110115 );
@@ -124,9 +129,14 @@ public void testOldIndicesCheckWithMultipleTransforms() {
124129 .build ();
125130 var expected = new DeprecationIssue (
126131 DeprecationIssue .Level .CRITICAL ,
127- "Old index with a compatibility version < 9.0" ,
128- "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html" ,
129- "This index has version: " + OLD_VERSION .toReleaseVersion (),
132+ "One or more Transforms write to this index with a compatibility version < 9.0" ,
133+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
134+ + "#breaking_90_transform_destination_index" ,
135+ "This index was created in version ["
136+ + OLD_VERSION .toReleaseVersion ()
137+ + "] and requires action before upgrading to 9.0. "
138+ + "The following transforms are configured to write to this index: [test-transform1, test-transform2]. Refer to the "
139+ + "migration guide to learn more about how to prepare transforms destination indices for your upgrade." ,
130140 false ,
131141 Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform1" , "test-transform2" ))
132142 );
@@ -150,9 +160,14 @@ public void testMultipleOldIndicesCheckWithTransforms() {
150160 List .of (
151161 new DeprecationIssue (
152162 DeprecationIssue .Level .CRITICAL ,
153- "Old index with a compatibility version < 9.0" ,
154- "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html" ,
155- "This index has version: " + OLD_VERSION .toReleaseVersion (),
163+ "One or more Transforms write to this index with a compatibility version < 9.0" ,
164+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
165+ + "#breaking_90_transform_destination_index" ,
166+ "This index was created in version ["
167+ + OLD_VERSION .toReleaseVersion ()
168+ + "] and requires action before upgrading to 9.0. "
169+ + "The following transforms are configured to write to this index: [test-transform1]. Refer to the "
170+ + "migration guide to learn more about how to prepare transforms destination indices for your upgrade." ,
156171 false ,
157172 Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform1" ))
158173 )
@@ -161,9 +176,14 @@ public void testMultipleOldIndicesCheckWithTransforms() {
161176 List .of (
162177 new DeprecationIssue (
163178 DeprecationIssue .Level .CRITICAL ,
164- "Old index with a compatibility version < 9.0" ,
165- "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html" ,
166- "This index has version: " + OLD_VERSION .toReleaseVersion (),
179+ "One or more Transforms write to this index with a compatibility version < 9.0" ,
180+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
181+ + "#breaking_90_transform_destination_index" ,
182+ "This index was created in version ["
183+ + OLD_VERSION .toReleaseVersion ()
184+ + "] and requires action before upgrading to 9.0. "
185+ + "The following transforms are configured to write to this index: [test-transform2]. Refer to the "
186+ + "migration guide to learn more about how to prepare transforms destination indices for your upgrade." ,
167187 false ,
168188 Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform2" ))
169189 )
@@ -256,20 +276,14 @@ public void testOldIndicesCheckSnapshotIgnored() {
256276 }
257277
258278 public void testOldIndicesIgnoredWarningCheck () {
259- Settings .Builder settings = settings (OLD_VERSION ).put (MetadataIndexStateService .VERIFIED_READ_ONLY_SETTING .getKey (), true );
260- IndexMetadata indexMetadata = IndexMetadata .builder ("test" )
261- .settings (settings )
262- .numberOfShards (1 )
263- .numberOfReplicas (0 )
264- .state (indexMetdataState )
265- .build ();
279+ IndexMetadata indexMetadata = readonlyIndexMetadata ("test" , OLD_VERSION );
266280 ClusterState clusterState = ClusterState .builder (ClusterState .EMPTY_STATE )
267281 .metadata (Metadata .builder ().put (indexMetadata , true ))
268282 .blocks (clusterBlocksForIndices (indexMetadata ))
269283 .build ();
270284 DeprecationIssue expected = new DeprecationIssue (
271285 DeprecationIssue .Level .WARNING ,
272- "Old index with a compatibility version < 9.0 Has Been Ignored " ,
286+ "Old index with a compatibility version < 9.0 has been ignored " ,
273287 "https://www.elastic.co/guide/en/elasticsearch/reference/master/breaking-changes-9.0.html" ,
274288 "This read-only index has version: " + OLD_VERSION .toReleaseVersion () + " and will be supported as read-only in 9.0" ,
275289 false ,
@@ -284,6 +298,115 @@ public void testOldIndicesIgnoredWarningCheck() {
284298 assertEquals (List .of (expected ), issuesByIndex .get ("test" ));
285299 }
286300
301+ private IndexMetadata readonlyIndexMetadata (String indexName , IndexVersion indexVersion ) {
302+ Settings .Builder settings = settings (indexVersion ).put (MetadataIndexStateService .VERIFIED_READ_ONLY_SETTING .getKey (), true );
303+ return IndexMetadata .builder (indexName ).settings (settings ).numberOfShards (1 ).numberOfReplicas (0 ).state (indexMetdataState ).build ();
304+ }
305+
306+ public void testOldTransformIndicesIgnoredCheck () {
307+ var checker = new IndexDeprecationChecker (indexNameExpressionResolver );
308+ var indexMetadata = readonlyIndexMetadata ("test" , OLD_VERSION );
309+ var clusterState = ClusterState .builder (ClusterState .EMPTY_STATE )
310+ .metadata (Metadata .builder ().put (indexMetadata , true ))
311+ .blocks (clusterBlocksForIndices (indexMetadata ))
312+ .build ();
313+ var expected = new DeprecationIssue (
314+ DeprecationIssue .Level .WARNING ,
315+ "One or more Transforms write to this old index with a compatibility version < 9.0" ,
316+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
317+ + "#breaking_90_transform_destination_index" ,
318+ "This index was created in version ["
319+ + OLD_VERSION .toReleaseVersion ()
320+ + "] and will be supported as a read-only index in 9.0. "
321+ + "The following transforms are no longer able to write to this index: [test-transform]. Refer to the "
322+ + "migration guide to learn more about how to handle your transforms destination indices." ,
323+ false ,
324+ Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform" ))
325+ );
326+ var issuesByIndex = checker .check (
327+ clusterState ,
328+ new DeprecationInfoAction .Request (TimeValue .THIRTY_SECONDS ),
329+ createContextWithTransformConfigs (Map .of ("test" , List .of ("test-transform" )))
330+ );
331+ assertEquals (singletonList (expected ), issuesByIndex .get ("test" ));
332+ }
333+
334+ public void testOldIndicesIgnoredCheckWithMultipleTransforms () {
335+ var indexMetadata = readonlyIndexMetadata ("test" , OLD_VERSION );
336+ var clusterState = ClusterState .builder (ClusterState .EMPTY_STATE )
337+ .metadata (Metadata .builder ().put (indexMetadata , true ))
338+ .blocks (clusterBlocksForIndices (indexMetadata ))
339+ .build ();
340+ var expected = new DeprecationIssue (
341+ DeprecationIssue .Level .WARNING ,
342+ "One or more Transforms write to this old index with a compatibility version < 9.0" ,
343+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
344+ + "#breaking_90_transform_destination_index" ,
345+ "This index was created in version ["
346+ + OLD_VERSION .toReleaseVersion ()
347+ + "] and will be supported as a read-only index in 9.0. "
348+ + "The following transforms are no longer able to write to this index: [test-transform1, test-transform2]. Refer to the "
349+ + "migration guide to learn more about how to handle your transforms destination indices." ,
350+ false ,
351+ Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform1" , "test-transform2" ))
352+ );
353+ var issuesByIndex = checker .check (
354+ clusterState ,
355+ new DeprecationInfoAction .Request (TimeValue .THIRTY_SECONDS ),
356+ createContextWithTransformConfigs (Map .of ("test" , List .of ("test-transform1" , "test-transform2" )))
357+ );
358+ assertEquals (singletonList (expected ), issuesByIndex .get ("test" ));
359+ }
360+
361+ public void testMultipleOldIndicesIgnoredCheckWithTransforms () {
362+ var indexMetadata1 = readonlyIndexMetadata ("test1" , OLD_VERSION );
363+ var indexMetadata2 = readonlyIndexMetadata ("test2" , OLD_VERSION );
364+ var clusterState = ClusterState .builder (ClusterState .EMPTY_STATE )
365+ .metadata (Metadata .builder ().put (indexMetadata1 , true ).put (indexMetadata2 , true ))
366+ .blocks (clusterBlocksForIndices (indexMetadata1 , indexMetadata2 ))
367+ .build ();
368+ var expected = Map .of (
369+ "test1" ,
370+ List .of (
371+ new DeprecationIssue (
372+ DeprecationIssue .Level .WARNING ,
373+ "One or more Transforms write to this old index with a compatibility version < 9.0" ,
374+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
375+ + "#breaking_90_transform_destination_index" ,
376+ "This index was created in version ["
377+ + OLD_VERSION .toReleaseVersion ()
378+ + "] and will be supported as a read-only index in 9.0. "
379+ + "The following transforms are no longer able to write to this index: [test-transform1]. Refer to the "
380+ + "migration guide to learn more about how to handle your transforms destination indices." ,
381+ false ,
382+ Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform1" ))
383+ )
384+ ),
385+ "test2" ,
386+ List .of (
387+ new DeprecationIssue (
388+ DeprecationIssue .Level .WARNING ,
389+ "One or more Transforms write to this old index with a compatibility version < 9.0" ,
390+ "https://www.elastic.co/guide/en/elasticsearch/reference/master/migrating-9.0.html"
391+ + "#breaking_90_transform_destination_index" ,
392+ "This index was created in version ["
393+ + OLD_VERSION .toReleaseVersion ()
394+ + "] and will be supported as a read-only index in 9.0. "
395+ + "The following transforms are no longer able to write to this index: [test-transform2]. Refer to the "
396+ + "migration guide to learn more about how to handle your transforms destination indices." ,
397+ false ,
398+ Map .of ("reindex_required" , true , "transform_ids" , List .of ("test-transform2" ))
399+ )
400+ )
401+ );
402+ var issuesByIndex = checker .check (
403+ clusterState ,
404+ new DeprecationInfoAction .Request (TimeValue .THIRTY_SECONDS ),
405+ createContextWithTransformConfigs (Map .of ("test1" , List .of ("test-transform1" ), "test2" , List .of ("test-transform2" )))
406+ );
407+ assertEquals (expected , issuesByIndex );
408+ }
409+
287410 public void testTranslogRetentionSettings () {
288411 Settings .Builder settings = settings (IndexVersion .current ());
289412 settings .put (IndexSettings .INDEX_TRANSLOG_RETENTION_AGE_SETTING .getKey (), randomPositiveTimeValue ());
0 commit comments