Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'migration' instead of 'upgrade' in GET system feature migration status responses #79302

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<FeatureUpgradeStatus> featureUpgradeStatuses;
private final String upgradeStatus;
Expand Down Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,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<GetFeatureUpgradeStatusResponse.FeatureUpgradeStatus> optionalTasksStatus = response.getFeatureUpgradeStatuses().stream()
.filter(status -> "tasks".equals(status.getFeatureName()))
Expand All @@ -52,7 +52,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"));
}
Expand Down
27 changes: 14 additions & 13 deletions docs/reference/migration/apis/feature_upgrade.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,79 +46,80 @@ Example response:
{
"feature_name" : "async_search",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "enrich",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "fleet",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "geoip",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "kibana",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "logstash_management",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "machine_learning",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "searchable_snapshots",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "security",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "tasks",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "transform",
"minimum_index_version" : "8.0.0",
"upgrade_status" : "NO_UPGRADE_NEEDED",
"migration_status" : "NO_MIGRATION_NEEDED",
"indices" : [ ]
},
{
"feature_name" : "watcher",
"minimum_index_version" : "8.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" : "8.0.0"/"minimum_index_version" : $body.$_path/]

This response tells us that Elasticsearch security needs its internal
indices upgraded before we can upgrade the cluster to 8.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,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(Version.CURRENT.minimumIndexCompatibilityVersion())) {
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"));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Map<String, Object>> features = view.get("features");
Map<String, Object> testFeature = features.stream()
.filter(feature -> "system indices qa".equals(feature.get("feature_name")))
Expand All @@ -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<Object>) testFeature.get("indices"), hasSize(1));
Expand Down
1 change: 1 addition & 0 deletions rest-api-spec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ tasks.named("yamlRestTestV7CompatTransform").configure { task ->
task.skipTest("search.aggregation/20_terms/string profiler via global ordinals native implementation", "The profiler results aren't backwards compatible.")
task.skipTest("search.aggregation/20_terms/string profiler via map", "The profiler results aren't backwards compatible.")
task.skipTest("search.aggregation/20_terms/numeric profiler", "The profiler results aren't backwards compatible.")
task.skipTest("migration/10_get_feature_upgrade_status/Get feature upgrade status", "Awaits backport")

task.replaceValueInMatch("_type", "_doc")
task.addAllowedWarningRegex("\\[types removal\\].*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
- do:
migration.get_feature_upgrade_status: {}

- is_true: upgrade_status
- is_true: migration_status
- is_true: features
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -98,8 +98,8 @@ public String toString() {
}

public enum UpgradeStatus {
UPGRADE_NEEDED,
NO_UPGRADE_NEEDED,
MIGRATION_NEEDED,
NO_MIGRATION_NEEDED,
IN_PROGRESS
}

Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,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
Expand Down Expand Up @@ -79,7 +79,7 @@ protected void masterOperation(Task task, GetFeatureUpgradeStatusRequest request
.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
Expand All @@ -99,7 +99,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
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.List;
import java.util.Map;

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 {
Expand All @@ -37,7 +37,7 @@ public void testGetFeatureStatus() {
CLUSTER_STATE,
Map.entry("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
Expand Down