Skip to content
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
20 changes: 5 additions & 15 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,19 @@ static TransportVersion def(int id) {
public static final TransportVersion TIMEOUT_GET_PARAM_FOR_RESOLVE_CLUSTER = def(8_838_0_00);
public static final TransportVersion INFERENCE_REQUEST_ADAPTIVE_RATE_LIMITING = def(8_839_0_00);
public static final TransportVersion ML_INFERENCE_IBM_WATSONX_RERANK_ADDED = def(8_840_0_00);
// TODO: add to remove_all_applicable_selector.csv
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_18 = def(8_840_0_01);
// TODO: add to retry_ilm_async_action_require_error.csv
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_18 = def(8_840_0_02);
public static final TransportVersion INITIAL_ELASTICSEARCH_8_19 = def(8_841_0_00);
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_X = def(8_841_0_01);
// TODO: add to remove_all_applicable_selector.csv
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_19 = def(8_841_0_02);
public static final TransportVersion ESQL_RETRY_ON_SHARD_LEVEL_FAILURE_BACKPORT_8_19 = def(8_841_0_03);
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS_BACKPORT_8_19 = def(8_841_0_04);
public static final TransportVersion VOYAGE_AI_INTEGRATION_ADDED_BACKPORT_8_X = def(8_841_0_05);
public static final TransportVersion JINA_AI_EMBEDDING_TYPE_SUPPORT_ADDED_BACKPORT_8_19 = def(8_841_0_06);
// TODO: add to retry_ilm_async_action_require_error.csv
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_19 = def(8_841_0_07);
public static final TransportVersion INFERENCE_CONTEXT_8_X = def(8_841_0_08);
public static final TransportVersion ML_INFERENCE_DEEPSEEK_8_19 = def(8_841_0_09);
Expand All @@ -172,36 +176,22 @@ static TransportVersion def(int id) {
public static final TransportVersion RESCORE_VECTOR_ALLOW_ZERO_BACKPORT_8_19 = def(8_841_0_27);
public static final TransportVersion INFERENCE_ADD_TIMEOUT_PUT_ENDPOINT_8_19 = def(8_841_0_28);
public static final TransportVersion ESQL_REPORT_SHARD_PARTITIONING_8_19 = def(8_841_0_29);
// TODO: add to esql_driver_task_description.csv
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION_8_19 = def(8_841_0_30);
public static final TransportVersion INITIAL_ELASTICSEARCH_9_0 = def(9_000_0_00);
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES_90 = def(9_000_0_01);
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90 = def(9_000_0_02);
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION_90 = def(9_000_0_03);
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION_90 = def(9_000_0_04);
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_9_0 = def(9_000_0_05);
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90 = def(9_000_0_06);
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90 = def(9_000_0_07);
public static final TransportVersion COHERE_BIT_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_001_0_00);
public static final TransportVersion REMOVE_SNAPSHOT_FAILURES = def(9_002_0_00);
public static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = def(9_003_0_00);
public static final TransportVersion REMOVE_DESIRED_NODE_VERSION = def(9_004_0_00);
public static final TransportVersion ESQL_DRIVER_TASK_DESCRIPTION = def(9_005_0_00);
public static final TransportVersion ESQL_RETRY_ON_SHARD_LEVEL_FAILURE = def(9_006_0_00);
public static final TransportVersion ESQL_PROFILE_ASYNC_NANOS = def(9_007_00_0);
public static final TransportVersion ESQL_LOOKUP_JOIN_SOURCE_TEXT = def(9_008_0_00);
public static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR = def(9_009_0_00);
public static final TransportVersion SLM_UNHEALTHY_IF_NO_SNAPSHOT_WITHIN = def(9_010_0_00);
public static final TransportVersion ESQL_SUPPORT_PARTIAL_RESULTS = def(9_011_0_00);
public static final TransportVersion REMOVE_REPOSITORY_CONFLICT_MESSAGE = def(9_012_0_00);
public static final TransportVersion VOYAGE_AI_INTEGRATION_ADDED = def(9_014_0_00);
public static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES = def(9_015_0_00);
public static final TransportVersion ESQL_SERIALIZE_SOURCE_FUNCTIONS_WARNINGS = def(9_016_0_00);
public static final TransportVersion ESQL_DRIVER_NODE_DESCRIPTION = def(9_017_0_00);
public static final TransportVersion MULTI_PROJECT = def(9_018_0_00);
public static final TransportVersion JINA_AI_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_020_0_00);
public static final TransportVersion UNASSIGENEDINFO_RESHARD_ADDED = def(9_022_0_00);
public static final TransportVersion MAX_OPERATION_SIZE_REJECTIONS_ADDED = def(9_024_0_00);
public static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR = def(9_025_0_00);
public static final TransportVersion ESQL_SERIALIZE_BLOCK_TYPE_CODE = def(9_026_0_00);
public static final TransportVersion ESQL_THREAD_NAME_IN_DRIVER_PROFILE = def(9_027_0_00);
public static final TransportVersion INFERENCE_CONTEXT = def(9_028_0_00);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.elasticsearch.action.admin.cluster.snapshots.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Iterators;
Expand All @@ -31,6 +31,8 @@
*/
public class GetSnapshotsResponse extends ActionResponse implements ChunkedToXContentObject {

private static final TransportVersion REMOVE_SNAPSHOT_FAILURES = TransportVersion.fromName("remove_snapshot_failures");

private final List<SnapshotInfo> snapshots;

@Nullable
Expand All @@ -49,8 +51,7 @@ public GetSnapshotsResponse(List<SnapshotInfo> snapshots, @Nullable String next,

public GetSnapshotsResponse(StreamInput in) throws IOException {
this.snapshots = in.readCollectionAsImmutableList(SnapshotInfo::readFrom);
if (in.getTransportVersion().before(TransportVersions.REMOVE_SNAPSHOT_FAILURES)
&& in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_SNAPSHOT_FAILURES_90) == false) {
if (in.getTransportVersion().supports(REMOVE_SNAPSHOT_FAILURES) == false) {
// Deprecated `failures` field
in.readMap(StreamInput::readException);
}
Expand Down Expand Up @@ -84,8 +85,7 @@ public int remaining() {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeCollection(snapshots);
if (out.getTransportVersion().before(TransportVersions.REMOVE_SNAPSHOT_FAILURES)
&& out.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_SNAPSHOT_FAILURES_90) == false) {
if (out.getTransportVersion().supports(REMOVE_SNAPSHOT_FAILURES) == false) {
// Deprecated `failures` field
out.writeMap(Map.of(), StreamOutput::writeException);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

package org.elasticsearch.action.support;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand All @@ -30,6 +31,8 @@ public enum IndexComponentSelector implements Writeable {
DATA("data", (byte) 0),
FAILURES("failures", (byte) 1);

private static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR = TransportVersion.fromName("remove_all_applicable_selector");

private final String key;
private final byte id;

Expand Down Expand Up @@ -92,8 +95,7 @@ public static IndexComponentSelector getByKeyOrThrow(@Nullable String key) {

public static IndexComponentSelector read(StreamInput in) throws IOException {
byte id = in.readByte();
if (in.getTransportVersion().onOrAfter(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR)
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_9_0)
if (in.getTransportVersion().supports(REMOVE_ALL_APPLICABLE_SELECTOR)
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_18)
|| in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_ALL_APPLICABLE_SELECTOR_BACKPORT_8_19)) {
return getById(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
public final class DesiredNode implements Writeable, ToXContentObject, Comparable<DesiredNode> {

public static final TransportVersion RANGE_FLOAT_PROCESSORS_SUPPORT_TRANSPORT_VERSION = TransportVersions.V_8_3_0;
private static final TransportVersion REMOVE_DESIRED_NODE_VERSION = TransportVersion.fromName("remove_desired_node_version");

private static final ParseField SETTINGS_FIELD = new ParseField("settings");
private static final ParseField PROCESSORS_FIELD = new ParseField("processors");
Expand Down Expand Up @@ -161,8 +162,7 @@ public static DesiredNode readFrom(StreamInput in) throws IOException {
}
final var memory = ByteSizeValue.readFrom(in);
final var storage = ByteSizeValue.readFrom(in);
if (in.getTransportVersion().before(TransportVersions.REMOVE_DESIRED_NODE_VERSION)
&& in.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_DESIRED_NODE_VERSION_90) == false) {
if (in.getTransportVersion().supports(REMOVE_DESIRED_NODE_VERSION) == false) {
in.readOptionalString();
}
return new DesiredNode(settings, processors, processorsRange, memory, storage);
Expand All @@ -181,8 +181,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
memory.writeTo(out);
storage.writeTo(out);
if (out.getTransportVersion().before(TransportVersions.REMOVE_DESIRED_NODE_VERSION)
&& out.getTransportVersion().isPatchFrom(TransportVersions.REMOVE_DESIRED_NODE_VERSION_90) == false) {
if (out.getTransportVersion().supports(REMOVE_DESIRED_NODE_VERSION) == false) {
out.writeOptionalString(null);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
import java.util.Locale;
import java.util.Objects;

import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES;
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1;
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90;
import static org.elasticsearch.TransportVersions.REVERT_BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1;
import static org.elasticsearch.common.unit.ByteSizeUnit.BYTES;
import static org.elasticsearch.common.unit.ByteSizeUnit.GB;
Expand All @@ -51,6 +49,10 @@ static class DeprecationLoggerHolder {
public static final ByteSizeValue ONE = new ByteSizeValue(1, BYTES);
public static final ByteSizeValue MINUS_ONE = new ByteSizeValue(-1, BYTES);

private static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES = TransportVersion.fromName(
"byte_size_value_always_uses_bytes"
);

/**
* @param size the number of {@code unit}s
*/
Expand Down Expand Up @@ -133,8 +135,7 @@ public void writeTo(StreamOutput out) throws IOException {
}

private static boolean alwaysUseBytes(TransportVersion tv) {
return tv.onOrAfter(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES)
|| tv.isPatchFrom(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90)
return tv.supports(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES)
|| tv.between(BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1, REVERT_BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

package org.elasticsearch.transport;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.collect.Iterators;
import org.elasticsearch.common.io.stream.StreamInput;
Expand All @@ -29,6 +30,10 @@

public class TransportStats implements Writeable, ChunkedToXContent {

private static final TransportVersion TRANSPORT_STATS_HANDLING_TIME_REQUIRED = TransportVersion.fromName(
"transport_stats_handling_time_required"
);

private final long serverOpen;
private final long totalOutboundConnections;
private final long rxCount;
Expand Down Expand Up @@ -69,8 +74,7 @@ public TransportStats(StreamInput in) throws IOException {
rxSize = in.readVLong();
txCount = in.readVLong();
txSize = in.readVLong();
if (in.getTransportVersion().before(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED)
&& in.getTransportVersion().isPatchFrom(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90) == false) {
if (in.getTransportVersion().supports(TRANSPORT_STATS_HANDLING_TIME_REQUIRED) == false) {
in.readBoolean();
}
inboundHandlingTimeBucketFrequencies = new long[HandlingTimeTracker.BUCKET_COUNT];
Expand Down Expand Up @@ -99,8 +103,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(txSize);
assert inboundHandlingTimeBucketFrequencies.length == HandlingTimeTracker.BUCKET_COUNT;
assert outboundHandlingTimeBucketFrequencies.length == HandlingTimeTracker.BUCKET_COUNT;
if (out.getTransportVersion().before(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED)
&& out.getTransportVersion().isPatchFrom(TransportVersions.TRANSPORT_STATS_HANDLING_TIME_REQUIRED_90) == false) {
if (out.getTransportVersion().supports(TRANSPORT_STATS_HANDLING_TIME_REQUIRED) == false) {
out.writeBoolean(true);
}
for (long handlingTimeBucketFrequency : inboundHandlingTimeBucketFrequencies) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9015000,9000006
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9005000,9000004
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9009000,9000005
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9004000,9000003
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9002000,9000001
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9025000,9000007
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9003000,9000002
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9000000
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,20 @@
import java.util.List;
import java.util.function.Function;

import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES;
import static org.elasticsearch.TransportVersions.BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90;
import static org.elasticsearch.TransportVersions.INITIAL_ELASTICSEARCH_9_0;
import static org.elasticsearch.TransportVersions.V_8_16_0;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;

public class ByteSizeValueTests extends AbstractWireSerializingTestCase<ByteSizeValue> {

private static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES = TransportVersion.fromName(
"byte_size_value_always_uses_bytes"
);
private static final TransportVersion BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_PATCH = BYTE_SIZE_VALUE_ALWAYS_USES_BYTES.nextPatchVersion();
private static final TransportVersion REMOVE_ALL_APPLICABLE_SELECTOR_PATCH = TransportVersion.fromName("remove_all_applicable_selector")
.nextPatchVersion();

public void testActualPeta() {
MatcherAssert.assertThat(ByteSizeValue.of(4, ByteSizeUnit.PB).getBytes(), equalTo(4503599627370496L));
}
Expand Down Expand Up @@ -523,7 +528,7 @@ protected void assertEqualInstances(ByteSizeValue expectedInstance, ByteSizeValu

public void testBWCTransportFormat() throws IOException {
var tenMegs = ByteSizeValue.ofMb(10);
for (var tv : List.of(V_8_16_0, INITIAL_ELASTICSEARCH_9_0)) {
for (var tv : List.of(TransportVersion.minimumCompatible(), REMOVE_ALL_APPLICABLE_SELECTOR_PATCH)) {
try (BytesStreamOutput expected = new BytesStreamOutput(); BytesStreamOutput actual = new BytesStreamOutput()) {
expected.writeZLong(10);
ByteSizeUnit.MB.writeTo(expected);
Expand All @@ -539,7 +544,7 @@ public void testBWCTransportFormat() throws IOException {
}

public void testTransportRoundTripsWithTwoDigitFractions() throws IOException {
for (var tv : List.of(TransportVersion.current(), BYTE_SIZE_VALUE_ALWAYS_USES_BYTES, BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_90)) {
for (var tv : List.of(TransportVersion.current(), BYTE_SIZE_VALUE_ALWAYS_USES_BYTES, BYTE_SIZE_VALUE_ALWAYS_USES_BYTES_PATCH)) {
for (var desiredUnit : ByteSizeUnit.values()) {
if (desiredUnit == ByteSizeUnit.BYTES) {
// Can't have a fraction of a byte!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package org.elasticsearch.xpack.core.ilm.action;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
Expand All @@ -21,6 +22,11 @@
import java.util.Objects;

public class RetryActionRequest extends AcknowledgedRequest<RetryActionRequest> implements IndicesRequest.Replaceable {

private static final TransportVersion RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR = TransportVersion.fromName(
"retry_ilm_async_action_require_error"
);

private String[] indices;
private IndicesOptions indicesOptions = IndicesOptions.strictExpandOpen();
private boolean requireError = true;
Expand All @@ -34,8 +40,7 @@ public RetryActionRequest(StreamInput in) throws IOException {
super(in);
this.indices = in.readStringArray();
this.indicesOptions = IndicesOptions.readIndicesOptions(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR)
|| in.getTransportVersion().isPatchFrom(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90)
if (in.getTransportVersion().supports(RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR)
|| in.getTransportVersion().isPatchFrom(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_19)
|| in.getTransportVersion().isPatchFrom(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_18)) {
this.requireError = in.readBoolean();
Expand Down Expand Up @@ -81,8 +86,7 @@ public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeStringArray(indices);
indicesOptions.writeIndicesOptions(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR)
|| out.getTransportVersion().isPatchFrom(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_90)
if (out.getTransportVersion().supports(RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR)
|| out.getTransportVersion().isPatchFrom(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_19)
|| out.getTransportVersion().isPatchFrom(TransportVersions.RETRY_ILM_ASYNC_ACTION_REQUIRE_ERROR_8_18)) {
out.writeBoolean(requireError);
Expand Down
Loading