Skip to content

Commit 284b0e7

Browse files
committed
ES-9508 Update index and data stream deprecation notices to be backport proof
1 parent ccc0769 commit 284b0e7

File tree

4 files changed

+38
-34
lines changed

4 files changed

+38
-34
lines changed

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/DataStreamDeprecationChecker.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ static DeprecationIssue oldIndicesCheck(DataStream dataStream, ClusterState clus
9494
if (indicesNeedingUpgrade.isEmpty() == false) {
9595
return new DeprecationIssue(
9696
DeprecationIssue.Level.CRITICAL,
97-
"Old data stream with a compatibility version < " + Version.CURRENT.major + "0.0",
97+
"Old data stream with a compatibility version < " + Version.CURRENT.major + ".0",
9898
"https://ela.st/es-deprecation-ds-reindex",
99-
"This data stream has backing indices that were created before Elasticsearch " + Version.CURRENT.major + "0.0",
99+
"This data stream has backing indices that were created before Elasticsearch " + Version.CURRENT.major + ".0",
100100
false,
101101
ofEntries(
102102
entry("reindex_required", true),
@@ -116,11 +116,11 @@ static DeprecationIssue ignoredOldIndicesCheck(DataStream dataStream, ClusterSta
116116
if (ignoredIndices.isEmpty() == false) {
117117
return new DeprecationIssue(
118118
DeprecationIssue.Level.WARNING,
119-
"Old data stream with a compatibility version < " + Version.CURRENT.major + "0.0 has Been Ignored",
119+
"Old data stream with a compatibility version < " + Version.CURRENT.major + ".0 has Been Ignored",
120120
"https://ela.st/es-deprecation-ds-reindex",
121121
"This data stream has read only backing indices that were created before Elasticsearch "
122122
+ Version.CURRENT.major
123-
+ "0.0 and have been marked as OK to remain read-only after upgrade",
123+
+ ".0 and have been marked as OK to remain read-only after upgrade",
124124
false,
125125
ofEntries(
126126
entry("reindex_required", false),

x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecker.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
package org.elasticsearch.xpack.deprecation;
88

9+
import org.elasticsearch.Version;
910
import org.elasticsearch.cluster.ClusterState;
1011
import org.elasticsearch.cluster.metadata.IndexMetadata;
1112
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
@@ -100,13 +101,14 @@ private DeprecationIssue oldIndicesCheck(
100101
if (transforms.isEmpty() == false) {
101102
return new DeprecationIssue(
102103
DeprecationIssue.Level.CRITICAL,
103-
"One or more Transforms write to this index with a compatibility version < 9.0",
104+
"One or more Transforms write to this index with a compatibility version < " + Version.CURRENT.major + ".0",
104105
"https://ela.st/es-deprecation-9-transform-destination-index",
105106
Strings.format(
106-
"This index was created in version [%s] and requires action before upgrading to 9.0. The following transforms are "
107+
"This index was created in version [%s] and requires action before upgrading to %d.0. The following transforms are "
107108
+ "configured to write to this index: [%s]. Refer to the migration guide to learn more about how to prepare "
108109
+ "transforms destination indices for your upgrade.",
109110
currentCompatibilityVersion.toReleaseVersion(),
111+
Version.CURRENT.major,
110112
String.join(", ", transforms)
111113
),
112114
false,
@@ -115,7 +117,7 @@ private DeprecationIssue oldIndicesCheck(
115117
} else {
116118
return new DeprecationIssue(
117119
DeprecationIssue.Level.CRITICAL,
118-
"Old index with a compatibility version < 9.0",
120+
"Old index with a compatibility version < " + Version.CURRENT.major + ".0",
119121
"https://ela.st/es-deprecation-9-index-version",
120122
"This index has version: " + currentCompatibilityVersion.toReleaseVersion(),
121123
false,
@@ -142,13 +144,14 @@ private DeprecationIssue ignoredOldIndicesCheck(
142144
if (transforms.isEmpty() == false) {
143145
return new DeprecationIssue(
144146
DeprecationIssue.Level.WARNING,
145-
"One or more Transforms write to this old index with a compatibility version < 9.0",
147+
"One or more Transforms write to this old index with a compatibility version < " + Version.CURRENT.major + ".0",
146148
"https://ela.st/es-deprecation-9-transform-destination-index",
147149
Strings.format(
148-
"This index was created in version [%s] and will be supported as a read-only index in 9.0. The following "
150+
"This index was created in version [%s] and will be supported as a read-only index in %d.0. The following "
149151
+ "transforms are no longer able to write to this index: [%s]. Refer to the migration guide to learn more "
150152
+ "about how to handle your transforms destination indices.",
151153
currentCompatibilityVersion.toReleaseVersion(),
154+
Version.CURRENT.major,
152155
String.join(", ", transforms)
153156
),
154157
false,
@@ -157,11 +160,11 @@ private DeprecationIssue ignoredOldIndicesCheck(
157160
} else {
158161
return new DeprecationIssue(
159162
DeprecationIssue.Level.WARNING,
160-
"Old index with a compatibility version < 9.0 has been ignored",
163+
"Old index with a compatibility version < " + Version.CURRENT.major + ".0 has been ignored",
161164
"https://ela.st/es-deprecation-9-index-version",
162165
"This read-only index has version: "
163166
+ currentCompatibilityVersion.toReleaseVersion()
164-
+ " and will be supported as read-only in 9.0",
167+
+ " and will be supported as read-only in " + Version.CURRENT.major + ".0",
165168
false,
166169
Map.of("reindex_required", true)
167170
);

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/DataStreamDeprecationCheckerTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ public void testOldIndicesCheck() {
5757

5858
DeprecationIssue expected = new DeprecationIssue(
5959
DeprecationIssue.Level.CRITICAL,
60-
"Old data stream with a compatibility version < " + Version.CURRENT.major + "0.0",
60+
"Old data stream with a compatibility version < " + Version.CURRENT.major + ".0",
6161
"https://ela.st/es-deprecation-ds-reindex",
62-
"This data stream has backing indices that were created before Elasticsearch " + Version.CURRENT.major + "0.0",
62+
"This data stream has backing indices that were created before Elasticsearch " + Version.CURRENT.major + ".0",
6363
false,
6464
ofEntries(
6565
entry("reindex_required", true),
@@ -126,9 +126,9 @@ public void testOldIndicesCheckWithClosedAndOpenIndices() {
126126

127127
DeprecationIssue expected = new DeprecationIssue(
128128
DeprecationIssue.Level.CRITICAL,
129-
"Old data stream with a compatibility version < " + Version.CURRENT.major + "0.0",
129+
"Old data stream with a compatibility version < " + Version.CURRENT.major + ".0",
130130
"https://ela.st/es-deprecation-ds-reindex",
131-
"This data stream has backing indices that were created before Elasticsearch " + Version.CURRENT.major + "0.0",
131+
"This data stream has backing indices that were created before Elasticsearch " + Version.CURRENT.major + ".0",
132132
false,
133133
ofEntries(
134134
entry("reindex_required", true),
@@ -285,11 +285,11 @@ public void testOldIndicesIgnoredWarningCheck() {
285285

286286
DeprecationIssue expected = new DeprecationIssue(
287287
DeprecationIssue.Level.WARNING,
288-
"Old data stream with a compatibility version < " + Version.CURRENT.major + "0.0 has Been Ignored",
288+
"Old data stream with a compatibility version < " + Version.CURRENT.major + ".0 has Been Ignored",
289289
"https://ela.st/es-deprecation-ds-reindex",
290290
"This data stream has read only backing indices that were created before Elasticsearch "
291291
+ Version.CURRENT.major
292-
+ "0.0 and have been marked as OK to remain read-only after upgrade",
292+
+ ".0 and have been marked as OK to remain read-only after upgrade",
293293
false,
294294
ofEntries(
295295
entry("reindex_required", false),

x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationCheckerTests.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.carrotsearch.randomizedtesting.annotations.Name;
1111
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
1212

13+
import org.elasticsearch.Version;
1314
import org.elasticsearch.cluster.ClusterState;
1415
import org.elasticsearch.cluster.block.ClusterBlocks;
1516
import org.elasticsearch.cluster.metadata.DataStream;
@@ -78,7 +79,7 @@ public void testOldIndicesCheck() {
7879
.build();
7980
DeprecationIssue expected = new DeprecationIssue(
8081
DeprecationIssue.Level.CRITICAL,
81-
"Old index with a compatibility version < 9.0",
82+
"Old index with a compatibility version < " + Version.CURRENT.major + ".0",
8283
"https://ela.st/es-deprecation-9-index-version",
8384
"This index has version: " + OLD_VERSION.toReleaseVersion(),
8485
false,
@@ -102,11 +103,11 @@ public void testOldTransformIndicesCheck() {
102103
.build();
103104
var expected = new DeprecationIssue(
104105
DeprecationIssue.Level.CRITICAL,
105-
"One or more Transforms write to this index with a compatibility version < 9.0",
106+
"One or more Transforms write to this index with a compatibility version < " + Version.CURRENT.major + ".0",
106107
"https://ela.st/es-deprecation-9-transform-destination-index",
107108
"This index was created in version ["
108109
+ OLD_VERSION.toReleaseVersion()
109-
+ "] and requires action before upgrading to 9.0. "
110+
+ "] and requires action before upgrading to " + Version.CURRENT.major + ".0. "
110111
+ "The following transforms are configured to write to this index: [test-transform]. Refer to the "
111112
+ "migration guide to learn more about how to prepare transforms destination indices for your upgrade.",
112113
false,
@@ -128,11 +129,11 @@ public void testOldIndicesCheckWithMultipleTransforms() {
128129
.build();
129130
var expected = new DeprecationIssue(
130131
DeprecationIssue.Level.CRITICAL,
131-
"One or more Transforms write to this index with a compatibility version < 9.0",
132+
"One or more Transforms write to this index with a compatibility version < " + Version.CURRENT.major + ".0",
132133
"https://ela.st/es-deprecation-9-transform-destination-index",
133134
"This index was created in version ["
134135
+ OLD_VERSION.toReleaseVersion()
135-
+ "] and requires action before upgrading to 9.0. "
136+
+ "] and requires action before upgrading to " + Version.CURRENT.major + ".0. "
136137
+ "The following transforms are configured to write to this index: [test-transform1, test-transform2]. Refer to the "
137138
+ "migration guide to learn more about how to prepare transforms destination indices for your upgrade.",
138139
false,
@@ -158,11 +159,11 @@ public void testMultipleOldIndicesCheckWithTransforms() {
158159
List.of(
159160
new DeprecationIssue(
160161
DeprecationIssue.Level.CRITICAL,
161-
"One or more Transforms write to this index with a compatibility version < 9.0",
162+
"One or more Transforms write to this index with a compatibility version < " + Version.CURRENT.major + ".0",
162163
"https://ela.st/es-deprecation-9-transform-destination-index",
163164
"This index was created in version ["
164165
+ OLD_VERSION.toReleaseVersion()
165-
+ "] and requires action before upgrading to 9.0. "
166+
+ "] and requires action before upgrading to " + Version.CURRENT.major + ".0. "
166167
+ "The following transforms are configured to write to this index: [test-transform1]. Refer to the "
167168
+ "migration guide to learn more about how to prepare transforms destination indices for your upgrade.",
168169
false,
@@ -173,11 +174,11 @@ public void testMultipleOldIndicesCheckWithTransforms() {
173174
List.of(
174175
new DeprecationIssue(
175176
DeprecationIssue.Level.CRITICAL,
176-
"One or more Transforms write to this index with a compatibility version < 9.0",
177+
"One or more Transforms write to this index with a compatibility version < " + Version.CURRENT.major + ".0",
177178
"https://ela.st/es-deprecation-9-transform-destination-index",
178179
"This index was created in version ["
179180
+ OLD_VERSION.toReleaseVersion()
180-
+ "] and requires action before upgrading to 9.0. "
181+
+ "] and requires action before upgrading to " + Version.CURRENT.major + ".0. "
181182
+ "The following transforms are configured to write to this index: [test-transform2]. Refer to the "
182183
+ "migration guide to learn more about how to prepare transforms destination indices for your upgrade.",
183184
false,
@@ -330,11 +331,11 @@ public void testOldTransformIndicesIgnoredCheck() {
330331
.build();
331332
var expected = new DeprecationIssue(
332333
DeprecationIssue.Level.WARNING,
333-
"One or more Transforms write to this old index with a compatibility version < 9.0",
334+
"One or more Transforms write to this old index with a compatibility version < " + Version.CURRENT.major + ".0",
334335
"https://ela.st/es-deprecation-9-transform-destination-index",
335336
"This index was created in version ["
336337
+ OLD_VERSION.toReleaseVersion()
337-
+ "] and will be supported as a read-only index in 9.0. "
338+
+ "] and will be supported as a read-only index in " + Version.CURRENT.major + ".0. "
338339
+ "The following transforms are no longer able to write to this index: [test-transform]. Refer to the "
339340
+ "migration guide to learn more about how to handle your transforms destination indices.",
340341
false,
@@ -356,11 +357,11 @@ public void testOldIndicesIgnoredCheckWithMultipleTransforms() {
356357
.build();
357358
var expected = new DeprecationIssue(
358359
DeprecationIssue.Level.WARNING,
359-
"One or more Transforms write to this old index with a compatibility version < 9.0",
360+
"One or more Transforms write to this old index with a compatibility version < " + Version.CURRENT.major + ".0",
360361
"https://ela.st/es-deprecation-9-transform-destination-index",
361362
"This index was created in version ["
362363
+ OLD_VERSION.toReleaseVersion()
363-
+ "] and will be supported as a read-only index in 9.0. "
364+
+ "] and will be supported as a read-only index in " + Version.CURRENT.major + ".0. "
364365
+ "The following transforms are no longer able to write to this index: [test-transform1, test-transform2]. Refer to the "
365366
+ "migration guide to learn more about how to handle your transforms destination indices.",
366367
false,
@@ -386,11 +387,11 @@ public void testMultipleOldIndicesIgnoredCheckWithTransforms() {
386387
List.of(
387388
new DeprecationIssue(
388389
DeprecationIssue.Level.WARNING,
389-
"One or more Transforms write to this old index with a compatibility version < 9.0",
390+
"One or more Transforms write to this old index with a compatibility version < " + Version.CURRENT.major + ".0",
390391
"https://ela.st/es-deprecation-9-transform-destination-index",
391392
"This index was created in version ["
392393
+ OLD_VERSION.toReleaseVersion()
393-
+ "] and will be supported as a read-only index in 9.0. "
394+
+ "] and will be supported as a read-only index in " + Version.CURRENT.major + ".0. "
394395
+ "The following transforms are no longer able to write to this index: [test-transform1]. Refer to the "
395396
+ "migration guide to learn more about how to handle your transforms destination indices.",
396397
false,
@@ -401,11 +402,11 @@ public void testMultipleOldIndicesIgnoredCheckWithTransforms() {
401402
List.of(
402403
new DeprecationIssue(
403404
DeprecationIssue.Level.WARNING,
404-
"One or more Transforms write to this old index with a compatibility version < 9.0",
405+
"One or more Transforms write to this old index with a compatibility version < " + Version.CURRENT.major + ".0",
405406
"https://ela.st/es-deprecation-9-transform-destination-index",
406407
"This index was created in version ["
407408
+ OLD_VERSION.toReleaseVersion()
408-
+ "] and will be supported as a read-only index in 9.0. "
409+
+ "] and will be supported as a read-only index in " + Version.CURRENT.major + ".0. "
409410
+ "The following transforms are no longer able to write to this index: [test-transform2]. Refer to the "
410411
+ "migration guide to learn more about how to handle your transforms destination indices.",
411412
false,

0 commit comments

Comments
 (0)