From 159cb4413c165d01e358c4e9d3ffda5d42b9f4c0 Mon Sep 17 00:00:00 2001 From: William Brafford Date: Tue, 19 Oct 2021 13:32:53 -0400 Subject: [PATCH] Use 'migration' instead of 'upgrade' in GET system feature migration status responses (#79302) (#79495) * Change 'upgrade' to 'migration' in System Index Migration responses --- .../GetFeatureUpgradeStatusResponse.java | 4 +-- .../org/elasticsearch/client/MigrationIT.java | 4 +-- .../migration/apis/feature_upgrade.asciidoc | 26 +++++++++---------- .../upgrades/FeatureUpgradeIT.java | 4 +-- .../system/indices/FeatureUpgradeApiIT.java | 6 ++--- rest-api-spec/build.gradle | 2 +- .../10_get_feature_upgrade_status.yml | 2 +- .../GetFeatureUpgradeStatusResponse.java | 8 +++--- ...ransportGetFeatureUpgradeStatusAction.java | 8 +++--- .../GetFeatureUpgradeStatusResponseTests.java | 4 +-- ...ortGetFeatureUpgradeStatusActionTests.java | 4 +-- 11 files changed, 36 insertions(+), 36 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/GetFeatureUpgradeStatusResponse.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/GetFeatureUpgradeStatusResponse.java index e75d2c7ce2858..545837d7e5b87 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/GetFeatureUpgradeStatusResponse.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/migration/GetFeatureUpgradeStatusResponse.java @@ -25,7 +25,7 @@ public class GetFeatureUpgradeStatusResponse { private static final ParseField FEATURE_UPGRADE_STATUSES = new ParseField("features"); - private static final ParseField UPGRADE_STATUS = new ParseField("upgrade_status"); + private static final ParseField UPGRADE_STATUS = new ParseField("migration_status"); private final List featureUpgradeStatuses; private final String upgradeStatus; @@ -76,7 +76,7 @@ public static class FeatureUpgradeStatus { private static final ParseField FEATURE_NAME = new ParseField("feature_name"); private static final ParseField MINIMUM_INDEX_VERSION = new ParseField("minimum_index_version"); - private static final ParseField UPGRADE_STATUS = new ParseField("upgrade_status"); + private static final ParseField UPGRADE_STATUS = new ParseField("migration_status"); private static final ParseField INDEX_VERSIONS = new ParseField("indices"); @SuppressWarnings("unchecked") diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/MigrationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/MigrationIT.java index 28334d83de1e0..1df60dcee18e6 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/MigrationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/MigrationIT.java @@ -55,7 +55,7 @@ public void testGetDeprecationInfo() throws IOException { public void testGetFeatureUpgradeStatus() throws IOException { GetFeatureUpgradeStatusRequest request = new GetFeatureUpgradeStatusRequest(); GetFeatureUpgradeStatusResponse response = highLevelClient().migration().getFeatureUpgradeStatus(request, RequestOptions.DEFAULT); - assertThat(response.getUpgradeStatus(), equalTo("NO_UPGRADE_NEEDED")); + assertThat(response.getUpgradeStatus(), equalTo("NO_MIGRATION_NEEDED")); assertThat(response.getFeatureUpgradeStatuses().size(), greaterThanOrEqualTo(1)); Optional optionalTasksStatus = response.getFeatureUpgradeStatuses().stream() .filter(status -> "tasks".equals(status.getFeatureName())) @@ -65,7 +65,7 @@ public void testGetFeatureUpgradeStatus() throws IOException { GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus tasksStatus = optionalTasksStatus.get(); - assertThat(tasksStatus.getUpgradeStatus(), equalTo("NO_UPGRADE_NEEDED")); + assertThat(tasksStatus.getUpgradeStatus(), equalTo("NO_MIGRATION_NEEDED")); assertThat(tasksStatus.getMinimumIndexVersion(), equalTo(Version.CURRENT.toString())); assertThat(tasksStatus.getFeatureName(), equalTo("tasks")); } diff --git a/docs/reference/migration/apis/feature_upgrade.asciidoc b/docs/reference/migration/apis/feature_upgrade.asciidoc index e40176d40fed0..52a6f01727c02 100644 --- a/docs/reference/migration/apis/feature_upgrade.asciidoc +++ b/docs/reference/migration/apis/feature_upgrade.asciidoc @@ -46,77 +46,77 @@ Example response: { "feature_name" : "async_search", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "enrich", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "fleet", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "geoip", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "kibana", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "logstash_management", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "machine_learning", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "searchable_snapshots", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "security", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "tasks", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "transform", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] }, { "feature_name" : "watcher", "minimum_index_version" : "7.0.0", - "upgrade_status" : "NO_UPGRADE_NEEDED", + "migration_status" : "NO_MIGRATION_NEEDED", "indices" : [ ] } ], - "upgrade_status" : "NO_UPGRADE_NEEDED" + "migration_status" : "NO_MIGRATION_NEEDED" } -------------------------------------------------- // TESTRESPONSE[s/"minimum_index_version" : "7.0.0"/"minimum_index_version" : $body.$_path/] diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/FeatureUpgradeIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/FeatureUpgradeIT.java index cd48aa6062671..9739c70e92203 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/FeatureUpgradeIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/FeatureUpgradeIT.java @@ -104,9 +104,9 @@ public void testGetFeatureUpgradeStatus() throws Exception { assertThat(feature.size(), equalTo(4)); assertThat(feature.get("minimum_index_version"), equalTo(UPGRADE_FROM_VERSION.toString())); if (UPGRADE_FROM_VERSION.before(TransportGetFeatureUpgradeStatusAction.NO_UPGRADE_REQUIRED_VERSION)) { - assertThat(feature.get("upgrade_status"), equalTo("UPGRADE_NEEDED")); + assertThat(feature.get("migration_status"), equalTo("MIGRATION_NEEDED")); } else { - assertThat(feature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED")); + assertThat(feature.get("migration_status"), equalTo("NO_MIGRATION_NEEDED")); } }); } diff --git a/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/FeatureUpgradeApiIT.java b/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/FeatureUpgradeApiIT.java index af9839a772a10..32e5abfb9a3e0 100644 --- a/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/FeatureUpgradeApiIT.java +++ b/qa/system-indices/src/javaRestTest/java/org/elasticsearch/system/indices/FeatureUpgradeApiIT.java @@ -52,8 +52,8 @@ public void testGetFeatureUpgradedStatuses() throws Exception { Response response = client().performRequest(new Request("GET", "/_migration/system_features")); assertThat(response.getStatusLine().getStatusCode(), is(200)); XContentTestUtils.JsonMapView view = XContentTestUtils.createJsonMapView(response.getEntity().getContent()); - String upgradeStatus = view.get("upgrade_status"); - assertThat(upgradeStatus, equalTo("NO_UPGRADE_NEEDED")); + String upgradeStatus = view.get("migration_status"); + assertThat(upgradeStatus, equalTo("NO_MIGRATION_NEEDED")); List> features = view.get("features"); Map testFeature = features.stream() .filter(feature -> "system indices qa".equals(feature.get("feature_name"))) @@ -62,7 +62,7 @@ public void testGetFeatureUpgradedStatuses() throws Exception { assertThat(testFeature.size(), equalTo(4)); assertThat(testFeature.get("minimum_index_version"), equalTo(Version.CURRENT.toString())); - assertThat(testFeature.get("upgrade_status"), equalTo("NO_UPGRADE_NEEDED")); + assertThat(testFeature.get("migration_status"), equalTo("NO_MIGRATION_NEEDED")); assertThat(testFeature.get("indices"), instanceOf(List.class)); assertThat((List) testFeature.get("indices"), hasSize(1)); diff --git a/rest-api-spec/build.gradle b/rest-api-spec/build.gradle index 12e5e977d5976..ce879ebc99f09 100644 --- a/rest-api-spec/build.gradle +++ b/rest-api-spec/build.gradle @@ -1,5 +1,5 @@ - + apply plugin: 'elasticsearch.build' apply plugin: 'elasticsearch.publish' apply plugin: 'elasticsearch.rest-resources' diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/migration/10_get_feature_upgrade_status.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/migration/10_get_feature_upgrade_status.yml index 1fd5bc9c85a24..fefa4bb48230b 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/migration/10_get_feature_upgrade_status.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/migration/10_get_feature_upgrade_status.yml @@ -7,5 +7,5 @@ - do: migration.get_feature_upgrade_status: {} - - is_true: upgrade_status + - is_true: migration_status - is_true: features diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponse.java index 0d281ba4b6944..68b0771595593 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponse.java @@ -57,7 +57,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.value(featureUpgradeStatus); } builder.endArray(); - builder.field("upgrade_status", upgradeStatus); + builder.field("migration_status", upgradeStatus); builder.endObject(); return builder; } @@ -98,8 +98,8 @@ public String toString() { } public enum UpgradeStatus { - UPGRADE_NEEDED, - NO_UPGRADE_NEEDED, + MIGRATION_NEEDED, + NO_MIGRATION_NEEDED, IN_PROGRESS } @@ -167,7 +167,7 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws builder.startObject(); builder.field("feature_name", this.featureName); builder.field("minimum_index_version", this.minimumIndexVersion.toString()); - builder.field("upgrade_status", this.upgradeStatus); + builder.field("migration_status", this.upgradeStatus); builder.startArray("indices"); for (IndexVersion version : this.indexVersions) { builder.value(version); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusAction.java index 50c38ca10d284..8418cc71a8df3 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusAction.java @@ -28,8 +28,8 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_UPGRADE_NEEDED; -import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.UPGRADE_NEEDED; +import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED; +import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.MIGRATION_NEEDED; /** * Transport class for the get feature upgrade status action @@ -80,7 +80,7 @@ protected void masterOperation(GetFeatureUpgradeStatusRequest request, ClusterSt .orElse(Version.CURRENT) .before(Version.V_7_0_0); - listener.onResponse(new GetFeatureUpgradeStatusResponse(features, isUpgradeNeeded ? UPGRADE_NEEDED : NO_UPGRADE_NEEDED)); + listener.onResponse(new GetFeatureUpgradeStatusResponse(features, isUpgradeNeeded ? MIGRATION_NEEDED : NO_MIGRATION_NEEDED)); } // visible for testing @@ -97,7 +97,7 @@ static GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus getFeatureUpgradeSta return new GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus( featureName, minimumVersion, - minimumVersion.before(Version.V_7_0_0) ? UPGRADE_NEEDED : NO_UPGRADE_NEEDED, + minimumVersion.before(Version.V_7_0_0) ? MIGRATION_NEEDED : NO_MIGRATION_NEEDED, indexVersions ); } diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponseTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponseTests.java index 7966c2171ee87..6888aa4168e48 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/GetFeatureUpgradeStatusResponseTests.java @@ -15,7 +15,7 @@ import java.io.IOException; import java.util.Collections; -import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.UPGRADE_NEEDED; +import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.MIGRATION_NEEDED; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; @@ -50,7 +50,7 @@ protected GetFeatureUpgradeStatusResponse mutateInstance(GetFeatureUpgradeStatus /** If constructor is called with null for a list, we just use an empty list */ public void testConstructorHandlesNullLists() { - GetFeatureUpgradeStatusResponse response = new GetFeatureUpgradeStatusResponse(null, UPGRADE_NEEDED); + GetFeatureUpgradeStatusResponse response = new GetFeatureUpgradeStatusResponse(null, MIGRATION_NEEDED); assertThat(response.getFeatureUpgradeStatuses(), notNullValue()); assertThat(response.getFeatureUpgradeStatuses(), equalTo(Collections.emptyList())); } diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusActionTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusActionTests.java index c83409e51069f..f2b466ad5191e 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusActionTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/migration/TransportGetFeatureUpgradeStatusActionTests.java @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.List; -import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_UPGRADE_NEEDED; +import static org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusResponse.UpgradeStatus.NO_MIGRATION_NEEDED; import static org.hamcrest.Matchers.equalTo; public class TransportGetFeatureUpgradeStatusActionTests extends ESTestCase { @@ -35,7 +35,7 @@ public void testGetFeatureStatus() { TransportGetFeatureUpgradeStatusAction.getFeatureUpgradeStatus( CLUSTER_STATE, "test-feature", FEATURE); - assertThat(status.getUpgradeStatus(), equalTo(NO_UPGRADE_NEEDED)); + assertThat(status.getUpgradeStatus(), equalTo(NO_MIGRATION_NEEDED)); assertThat(status.getFeatureName(), equalTo("test-feature")); assertThat(status.getMinimumIndexVersion(), equalTo(Version.V_7_0_0)); assertThat(status.getIndexVersions().size(), equalTo(2)); // additional testing below