Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.MediaType;
import org.elasticsearch.xcontent.ParsedMediaType;

Expand All @@ -27,7 +26,6 @@ class RestCompatibleVersionHelper {
/**
* @return The requested API version, or {@link Optional#empty()} if there was no explicit version in the request.
*/
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
static Optional<RestApiVersion> getCompatibleVersion(
@Nullable ParsedMediaType acceptHeader,
@Nullable ParsedMediaType contentTypeHeader,
Expand All @@ -52,8 +50,7 @@ static Optional<RestApiVersion> getCompatibleVersion(
if (hasContent) {

// content-type version must be current or prior
// This can be uncommented once all references to RestApiVersion.V_7 are removed
/*if (contentTypeVersion > RestApiVersion.current().major || contentTypeVersion < RestApiVersion.minimumSupported().major) {
if (contentTypeVersion > RestApiVersion.current().major || contentTypeVersion < RestApiVersion.minimumSupported().major) {
throw new ElasticsearchStatusException(
"Content-Type version must be either version {} or {}, but found {}. Content-Type={}",
RestStatus.BAD_REQUEST,
Expand All @@ -62,7 +59,7 @@ static Optional<RestApiVersion> getCompatibleVersion(
contentTypeVersion,
contentTypeHeader
);
}*/
}
// if both accept and content-type are sent, the version must match
if (contentTypeVersion != acceptVersion) {
throw new ElasticsearchStatusException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.index.IndexVersions;
import org.elasticsearch.indices.SystemIndexDescriptor;
import org.elasticsearch.indices.SystemIndexDescriptorUtils;
import org.elasticsearch.indices.SystemIndices;
Expand All @@ -31,7 +31,8 @@
public class TransportGetFeatureUpgradeStatusActionTests extends ESTestCase {

public static String TEST_SYSTEM_INDEX_PATTERN = ".test*";
private static final IndexVersion TEST_OLD_VERSION = IndexVersion.fromId(6000099);
// Version just before MINIMUM_COMPATIBLE in order to check that UpgradeStatus.MIGRATION_NEEDED is set correctly
private static final IndexVersion TEST_OLD_VERSION = IndexVersion.fromId(IndexVersions.MINIMUM_COMPATIBLE.id() - 1);
private static final ClusterState CLUSTER_STATE = getClusterState();
private static final SystemIndices.Feature FEATURE = getFeature();

Expand Down Expand Up @@ -85,8 +86,6 @@ private static ClusterState getClusterState() {
.numberOfReplicas(0)
.build();

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
// Once we start testing 9.x, we should update this test to use a 7.x "version created"
IndexMetadata indexMetadata2 = IndexMetadata.builder(".test-index-2")
.settings(Settings.builder().put("index.version.created", TEST_OLD_VERSION).build())
.numberOfShards(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.Version;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.test.rest.FakeRestRequest;
Expand Down Expand Up @@ -116,8 +115,6 @@ public static NewSubObject parse(XContentParser parser) {
}
}

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA)
@AwaitsFix(bugUrl = "this can be re-enabled once our rest api version is bumped to V_9")
public void testNotCompatibleRequest() throws IOException {
NamedXContentRegistry registry = new NamedXContentRegistry(
List.of(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,15 @@ public void testObsoleteVersion() {
assertThat(
e.getMessage(),
equalTo(
"A compatible version is required on both Content-Type and Accept headers if either one has requested a "
+ "compatible version and the compatible versions must match. "
+ "Accept="
+ acceptHeader(PREVIOUS_VERSION)
+ ", Content-Type="
+ contentTypeHeader(OBSOLETE_VERSION)
"Content-Type version must be either version "
+ CURRENT_VERSION
+ " or "
+ PREVIOUS_VERSION
+ ", but found "
+ OBSOLETE_VERSION
+ ". "
+ "Content-Type="
+ acceptHeader(OBSOLETE_VERSION)
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.transport.TransportRequest;
import org.elasticsearch.xpack.core.deprecation.DeprecationIssue;

Expand All @@ -32,19 +31,13 @@ private NodesDeprecationCheckAction() {
super(NAME);
}

@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // this can be replaced with TransportRequest.Empty in v9
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slack thread confirming that we don't need it anymore: https://elastic.slack.com/archives/C8UUBNASY/p1733330314431679

public static class NodeRequest extends TransportRequest {

public NodeRequest() {}

public NodeRequest(StreamInput in) throws IOException {
super(in);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
}
}

public static class NodeResponse extends BaseNodeResponse {
Expand Down