Skip to content

Commit 5c6a481

Browse files
Use 'migration' instead of 'upgrade' in GET system feature migration status responses (#79302)
* Change 'upgrade' to 'migration' in System Index Migration responses * Mute rest compatibility test
1 parent 074b023 commit 5c6a481

File tree

11 files changed

+37
-35
lines changed

11 files changed

+37
-35
lines changed

client/rest-high-level/src/main/java/org/elasticsearch/client/migration/GetFeatureUpgradeStatusResponse.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
public class GetFeatureUpgradeStatusResponse {
2626

2727
private static final ParseField FEATURE_UPGRADE_STATUSES = new ParseField("features");
28-
private static final ParseField UPGRADE_STATUS = new ParseField("upgrade_status");
28+
private static final ParseField UPGRADE_STATUS = new ParseField("migration_status");
2929

3030
private final List<FeatureUpgradeStatus> featureUpgradeStatuses;
3131
private final String upgradeStatus;
@@ -76,7 +76,7 @@ public static class FeatureUpgradeStatus {
7676

7777
private static final ParseField FEATURE_NAME = new ParseField("feature_name");
7878
private static final ParseField MINIMUM_INDEX_VERSION = new ParseField("minimum_index_version");
79-
private static final ParseField UPGRADE_STATUS = new ParseField("upgrade_status");
79+
private static final ParseField UPGRADE_STATUS = new ParseField("migration_status");
8080
private static final ParseField INDEX_VERSIONS = new ParseField("indices");
8181

8282
@SuppressWarnings("unchecked")

client/rest-high-level/src/test/java/org/elasticsearch/client/MigrationIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void testGetDeprecationInfo() throws IOException {
4242
public void testGetFeatureUpgradeStatus() throws IOException {
4343
GetFeatureUpgradeStatusRequest request = new GetFeatureUpgradeStatusRequest();
4444
GetFeatureUpgradeStatusResponse response = highLevelClient().migration().getFeatureUpgradeStatus(request, RequestOptions.DEFAULT);
45-
assertThat(response.getUpgradeStatus(), equalTo("NO_UPGRADE_NEEDED"));
45+
assertThat(response.getUpgradeStatus(), equalTo("NO_MIGRATION_NEEDED"));
4646
assertThat(response.getFeatureUpgradeStatuses().size(), greaterThanOrEqualTo(1));
4747
Optional<GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus> optionalTasksStatus = response.getFeatureUpgradeStatuses().stream()
4848
.filter(status -> "tasks".equals(status.getFeatureName()))
@@ -52,7 +52,7 @@ public void testGetFeatureUpgradeStatus() throws IOException {
5252

5353
GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus tasksStatus = optionalTasksStatus.get();
5454

55-
assertThat(tasksStatus.getUpgradeStatus(), equalTo("NO_UPGRADE_NEEDED"));
55+
assertThat(tasksStatus.getUpgradeStatus(), equalTo("NO_MIGRATION_NEEDED"));
5656
assertThat(tasksStatus.getMinimumIndexVersion(), equalTo(Version.CURRENT.toString()));
5757
assertThat(tasksStatus.getFeatureName(), equalTo("tasks"));
5858
}

docs/reference/migration/apis/feature_upgrade.asciidoc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,79 +46,80 @@ Example response:
4646
{
4747
"feature_name" : "async_search",
4848
"minimum_index_version" : "8.0.0",
49-
"upgrade_status" : "NO_UPGRADE_NEEDED",
49+
"migration_status" : "NO_MIGRATION_NEEDED",
5050
"indices" : [ ]
5151
},
5252
{
5353
"feature_name" : "enrich",
5454
"minimum_index_version" : "8.0.0",
55-
"upgrade_status" : "NO_UPGRADE_NEEDED",
55+
"migration_status" : "NO_MIGRATION_NEEDED",
5656
"indices" : [ ]
5757
},
5858
{
5959
"feature_name" : "fleet",
6060
"minimum_index_version" : "8.0.0",
61-
"upgrade_status" : "NO_UPGRADE_NEEDED",
61+
"migration_status" : "NO_MIGRATION_NEEDED",
6262
"indices" : [ ]
6363
},
6464
{
6565
"feature_name" : "geoip",
6666
"minimum_index_version" : "8.0.0",
67-
"upgrade_status" : "NO_UPGRADE_NEEDED",
67+
"migration_status" : "NO_MIGRATION_NEEDED",
6868
"indices" : [ ]
6969
},
7070
{
7171
"feature_name" : "kibana",
7272
"minimum_index_version" : "8.0.0",
73-
"upgrade_status" : "NO_UPGRADE_NEEDED",
73+
"migration_status" : "NO_MIGRATION_NEEDED",
7474
"indices" : [ ]
7575
},
7676
{
7777
"feature_name" : "logstash_management",
7878
"minimum_index_version" : "8.0.0",
79-
"upgrade_status" : "NO_UPGRADE_NEEDED",
79+
"migration_status" : "NO_MIGRATION_NEEDED",
8080
"indices" : [ ]
8181
},
8282
{
8383
"feature_name" : "machine_learning",
8484
"minimum_index_version" : "8.0.0",
85-
"upgrade_status" : "NO_UPGRADE_NEEDED",
85+
"migration_status" : "NO_MIGRATION_NEEDED",
8686
"indices" : [ ]
8787
},
8888
{
8989
"feature_name" : "searchable_snapshots",
9090
"minimum_index_version" : "8.0.0",
91-
"upgrade_status" : "NO_UPGRADE_NEEDED",
91+
"migration_status" : "NO_MIGRATION_NEEDED",
9292
"indices" : [ ]
9393
},
9494
{
9595
"feature_name" : "security",
9696
"minimum_index_version" : "8.0.0",
97-
"upgrade_status" : "NO_UPGRADE_NEEDED",
97+
"migration_status" : "NO_MIGRATION_NEEDED",
9898
"indices" : [ ]
9999
},
100100
{
101101
"feature_name" : "tasks",
102102
"minimum_index_version" : "8.0.0",
103-
"upgrade_status" : "NO_UPGRADE_NEEDED",
103+
"migration_status" : "NO_MIGRATION_NEEDED",
104104
"indices" : [ ]
105105
},
106106
{
107107
"feature_name" : "transform",
108108
"minimum_index_version" : "8.0.0",
109-
"upgrade_status" : "NO_UPGRADE_NEEDED",
109+
"migration_status" : "NO_MIGRATION_NEEDED",
110110
"indices" : [ ]
111111
},
112112
{
113113
"feature_name" : "watcher",
114114
"minimum_index_version" : "8.0.0",
115-
"upgrade_status" : "NO_UPGRADE_NEEDED",
115+
"migration_status" : "NO_MIGRATION_NEEDED",
116116
"indices" : [ ]
117117
}
118118
],
119-
"upgrade_status" : "NO_UPGRADE_NEEDED"
119+
"migration_status" : "NO_MIGRATION_NEEDED"
120120
}
121121
--------------------------------------------------
122+
// TESTRESPONSE[s/"minimum_index_version" : "8.0.0"/"minimum_index_version" : $body.$_path/]
122123

123124
This response tells us that Elasticsearch security needs its internal
124125
indices upgraded before we can upgrade the cluster to 8.0.

qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/FeatureUpgradeIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public void testGetFeatureUpgradeStatus() throws Exception {
9292
assertThat(feature.size(), equalTo(4));
9393
assertThat(feature.get("minimum_index_version"), equalTo(UPGRADE_FROM_VERSION.toString()));
9494
if (UPGRADE_FROM_VERSION.before(Version.CURRENT.minimumIndexCompatibilityVersion())) {
95-
assertThat(feature.get("upgrade_status"), equalTo("UPGRADE_NEEDED"));
95+
assertThat(feature.get("migration_status"), equalTo("MIGRATION_NEEDED"));
9696
} else {
97-
assertThat(feature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED"));
97+
assertThat(feature.get("migration_status"), equalTo("NO_MIGRATION_NEEDED"));
9898
}
9999
});
100100
}

qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/FeatureUpgradeApiIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ public void testGetFeatureUpgradedStatuses() throws Exception {
5252
Response response = client().performRequest(new Request("GET", "/_migration/system_features"));
5353
assertThat(response.getStatusLine().getStatusCode(), is(200));
5454
XContentTestUtils.JsonMapView view = XContentTestUtils.createJsonMapView(response.getEntity().getContent());
55-
String upgradeStatus = view.get("upgrade_status");
56-
assertThat(upgradeStatus, equalTo("NO_UPGRADE_NEEDED"));
55+
String upgradeStatus = view.get("migration_status");
56+
assertThat(upgradeStatus, equalTo("NO_MIGRATION_NEEDED"));
5757
List<Map<String, Object>> features = view.get("features");
5858
Map<String, Object> testFeature = features.stream()
5959
.filter(feature -> "system indices qa".equals(feature.get("feature_name")))
@@ -62,7 +62,7 @@ public void testGetFeatureUpgradedStatuses() throws Exception {
6262

6363
assertThat(testFeature.size(), equalTo(4));
6464
assertThat(testFeature.get("minimum_index_version"), equalTo(Version.CURRENT.toString()));
65-
assertThat(testFeature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED"));
65+
assertThat(testFeature.get("migration_status"), equalTo("NO_MIGRATION_NEEDED"));
6666
assertThat(testFeature.get("indices"), instanceOf(List.class));
6767

6868
assertThat((List<Object>) testFeature.get("indices"), hasSize(1));

rest-api-spec/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task ->
8181
task.skipTest("search.aggregation/20_terms/string profiler via global ordinals native implementation", "The profiler results aren't backwards compatible.")
8282
task.skipTest("search.aggregation/20_terms/string profiler via map", "The profiler results aren't backwards compatible.")
8383
task.skipTest("search.aggregation/20_terms/numeric profiler", "The profiler results aren't backwards compatible.")
84+
task.skipTest("migration/10_get_feature_upgrade_status/Get feature upgrade status", "Awaits backport")
8485

8586
task.replaceValueInMatch("_type", "_doc")
8687
task.addAllowedWarningRegex("\\[types removal\\].*")

rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/migration/10_get_feature_upgrade_status.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
- do:
88
migration.get_feature_upgrade_status: {}
99

10-
- is_true: upgrade_status
10+
- is_true: migration_status
1111
- is_true: features

server/src/main/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponse.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
5757
builder.value(featureUpgradeStatus);
5858
}
5959
builder.endArray();
60-
builder.field("upgrade_status", upgradeStatus);
60+
builder.field("migration_status", upgradeStatus);
6161
builder.endObject();
6262
return builder;
6363
}
@@ -98,8 +98,8 @@ public String toString() {
9898
}
9999

100100
public enum UpgradeStatus {
101-
UPGRADE_NEEDED,
102-
NO_UPGRADE_NEEDED,
101+
MIGRATION_NEEDED,
102+
NO_MIGRATION_NEEDED,
103103
IN_PROGRESS
104104
}
105105

@@ -167,7 +167,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
167167
builder.startObject();
168168
builder.field("feature_name", this.featureName);
169169
builder.field("minimum_index_version", this.minimumIndexVersion.toString());
170-
builder.field("upgrade_status", this.upgradeStatus);
170+
builder.field("migration_status", this.upgradeStatus);
171171
builder.startArray("indices");
172172
for (IndexVersion version : this.indexVersions) {
173173
builder.value(version);

server/src/main/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusAction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import java.util.stream.Collectors;
3030
import java.util.stream.Stream;
3131

32-
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_UPGRADE_NEEDED;
33-
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.UPGRADE_NEEDED;
32+
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED;
33+
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.MIGRATION_NEEDED;
3434

3535
/**
3636
* Transport class for the get feature upgrade status action
@@ -79,7 +79,7 @@ protected void masterOperation(Task task, GetFeatureUpgradeStatusRequest request
7979
.orElse(Version.CURRENT)
8080
.before(Version.V_7_0_0);
8181

82-
listener.onResponse(new GetFeatureUpgradeStatusResponse(features, isUpgradeNeeded ? UPGRADE_NEEDED : NO_UPGRADE_NEEDED));
82+
listener.onResponse(new GetFeatureUpgradeStatusResponse(features, isUpgradeNeeded ? MIGRATION_NEEDED : NO_MIGRATION_NEEDED));
8383
}
8484

8585
// visible for testing
@@ -99,7 +99,7 @@ static GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus getFeatureUpgradeSta
9999
return new GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus(
100100
featureName,
101101
minimumVersion,
102-
minimumVersion.before(Version.V_7_0_0) ? UPGRADE_NEEDED : NO_UPGRADE_NEEDED,
102+
minimumVersion.before(Version.V_7_0_0) ? MIGRATION_NEEDED : NO_MIGRATION_NEEDED,
103103
indexVersions
104104
);
105105
}

server/src/test/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponseTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import java.io.IOException;
1616
import java.util.Collections;
1717

18-
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.UPGRADE_NEEDED;
18+
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.MIGRATION_NEEDED;
1919
import static org.hamcrest.Matchers.equalTo;
2020
import static org.hamcrest.Matchers.notNullValue;
2121

@@ -50,7 +50,7 @@ protected GetFeatureUpgradeStatusResponse mutateInstance(GetFeatureUpgradeStatus
5050

5151
/** If constructor is called with null for a list, we just use an empty list */
5252
public void testConstructorHandlesNullLists() {
53-
GetFeatureUpgradeStatusResponse response = new GetFeatureUpgradeStatusResponse(null, UPGRADE_NEEDED);
53+
GetFeatureUpgradeStatusResponse response = new GetFeatureUpgradeStatusResponse(null, MIGRATION_NEEDED);
5454
assertThat(response.getFeatureUpgradeStatuses(), notNullValue());
5555
assertThat(response.getFeatureUpgradeStatuses(), equalTo(Collections.emptyList()));
5656
}

server/src/test/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusActionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.util.List;
2323
import java.util.Map;
2424

25-
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_UPGRADE_NEEDED;
25+
import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED;
2626
import static org.hamcrest.Matchers.equalTo;
2727

2828
public class TransportGetFeatureUpgradeStatusActionTests extends ESTestCase {
@@ -37,7 +37,7 @@ public void testGetFeatureStatus() {
3737
CLUSTER_STATE,
3838
Map.entry("test-feature", FEATURE));
3939

40-
assertThat(status.getUpgradeStatus(), equalTo(NO_UPGRADE_NEEDED));
40+
assertThat(status.getUpgradeStatus(), equalTo(NO_MIGRATION_NEEDED));
4141
assertThat(status.getFeatureName(), equalTo("test-feature"));
4242
assertThat(status.getMinimumIndexVersion(), equalTo(Version.V_7_0_0));
4343
assertThat(status.getIndexVersions().size(), equalTo(2)); // additional testing below

0 commit comments

Comments
 (0)