Skip to content

Commit

Permalink
Squash transport versions into 8.15 (elastic#114827)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop authored Oct 17, 2024
1 parent 64ae0ae commit 32ddbb3
Show file tree
Hide file tree
Showing 127 changed files with 254 additions and 345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
public class GeoIpTaskState implements PersistentTaskState, VersionedNamedWriteable {

private static boolean includeSha256(TransportVersion version) {
return version.isPatchFrom(TransportVersions.ENTERPRISE_GEOIP_DOWNLOADER_BACKPORT_8_15)
|| version.onOrAfter(TransportVersions.ENTERPRISE_GEOIP_DOWNLOADER);
return version.isPatchFrom(TransportVersions.V_8_15_0) || version.onOrAfter(TransportVersions.ENTERPRISE_GEOIP_DOWNLOADER);
}

private static final ParseField DATABASES = new ParseField("databases");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.RANK_FEATURE_PHASE_ADDED;
return TransportVersions.V_8_15_0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.RANK_FEATURE_PHASE_ADDED;
return TransportVersions.V_8_15_0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1917,7 +1917,7 @@ private enum ElasticsearchExceptionHandle {
ResourceAlreadyUploadedException.class,
ResourceAlreadyUploadedException::new,
181,
TransportVersions.ADD_RESOURCE_ALREADY_UPLOADED_EXCEPTION
TransportVersions.V_8_15_0
),
INGEST_PIPELINE_EXCEPTION(
org.elasticsearch.ingest.IngestPipelineException.class,
Expand Down
78 changes: 3 additions & 75 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,80 +102,8 @@ static TransportVersion def(int id) {
public static final TransportVersion V_8_13_0 = def(8_595_00_0);
public static final TransportVersion V_8_13_4 = def(8_595_00_1);
public static final TransportVersion V_8_14_0 = def(8_636_00_1);
// 8.15.0+
public static final TransportVersion WATERMARK_THRESHOLDS_STATS = def(8_637_00_0);
public static final TransportVersion ENRICH_CACHE_ADDITIONAL_STATS = def(8_638_00_0);
public static final TransportVersion ML_INFERENCE_RATE_LIMIT_SETTINGS_ADDED = def(8_639_00_0);
public static final TransportVersion ML_TRAINED_MODEL_CACHE_METADATA_ADDED = def(8_640_00_0);
public static final TransportVersion TOP_LEVEL_KNN_SUPPORT_QUERY_NAME = def(8_641_00_0);
public static final TransportVersion INDEX_SEGMENTS_VECTOR_FORMATS = def(8_642_00_0);
public static final TransportVersion ADD_RESOURCE_ALREADY_UPLOADED_EXCEPTION = def(8_643_00_0);
public static final TransportVersion ESQL_MV_ORDERING_SORTED_ASCENDING = def(8_644_00_0);
public static final TransportVersion ESQL_PAGE_MAPPING_TO_ITERATOR = def(8_645_00_0);
public static final TransportVersion BINARY_PIT_ID = def(8_646_00_0);
public static final TransportVersion SECURITY_ROLE_MAPPINGS_IN_CLUSTER_STATE = def(8_647_00_0);
public static final TransportVersion ESQL_REQUEST_TABLES = def(8_648_00_0);
public static final TransportVersion ROLE_REMOTE_CLUSTER_PRIVS = def(8_649_00_0);
public static final TransportVersion NO_GLOBAL_RETENTION_FOR_SYSTEM_DATA_STREAMS = def(8_650_00_0);
public static final TransportVersion SHUTDOWN_REQUEST_TIMEOUTS_FIX = def(8_651_00_0);
public static final TransportVersion INDEXING_PRESSURE_REQUEST_REJECTIONS_COUNT = def(8_652_00_0);
public static final TransportVersion ROLLUP_USAGE = def(8_653_00_0);
public static final TransportVersion SECURITY_ROLE_DESCRIPTION = def(8_654_00_0);
public static final TransportVersion ML_INFERENCE_AZURE_OPENAI_COMPLETIONS = def(8_655_00_0);
public static final TransportVersion JOIN_STATUS_AGE_SERIALIZATION = def(8_656_00_0);
public static final TransportVersion ML_RERANK_DOC_OPTIONAL = def(8_657_00_0);
public static final TransportVersion FAILURE_STORE_FIELD_PARITY = def(8_658_00_0);
public static final TransportVersion ML_INFERENCE_AZURE_AI_STUDIO = def(8_659_00_0);
public static final TransportVersion ML_INFERENCE_COHERE_COMPLETION_ADDED = def(8_660_00_0);
public static final TransportVersion ESQL_REMOVE_ES_SOURCE_OPTIONS = def(8_661_00_0);
public static final TransportVersion NODE_STATS_INGEST_BYTES = def(8_662_00_0);
public static final TransportVersion SEMANTIC_QUERY = def(8_663_00_0);
public static final TransportVersion GET_AUTOSCALING_CAPACITY_UNUSED_TIMEOUT = def(8_664_00_0);
public static final TransportVersion SIMULATE_VALIDATES_MAPPINGS = def(8_665_00_0);
public static final TransportVersion RULE_QUERY_RENAME = def(8_666_00_0);
public static final TransportVersion SPARSE_VECTOR_QUERY_ADDED = def(8_667_00_0);
public static final TransportVersion ESQL_ADD_INDEX_MODE_TO_SOURCE = def(8_668_00_0);
public static final TransportVersion GET_SHUTDOWN_STATUS_TIMEOUT = def(8_669_00_0);
public static final TransportVersion FAILURE_STORE_TELEMETRY = def(8_670_00_0);
public static final TransportVersion ADD_METADATA_FLATTENED_TO_ROLES = def(8_671_00_0);
public static final TransportVersion ML_INFERENCE_GOOGLE_AI_STUDIO_COMPLETION_ADDED = def(8_672_00_0);
public static final TransportVersion WATCHER_REQUEST_TIMEOUTS = def(8_673_00_0);
public static final TransportVersion ML_INFERENCE_ENHANCE_DELETE_ENDPOINT = def(8_674_00_0);
public static final TransportVersion ML_INFERENCE_GOOGLE_AI_STUDIO_EMBEDDINGS_ADDED = def(8_675_00_0);
public static final TransportVersion ADD_MISTRAL_EMBEDDINGS_INFERENCE = def(8_676_00_0);
public static final TransportVersion ML_CHUNK_INFERENCE_OPTION = def(8_677_00_0);
public static final TransportVersion RANK_FEATURE_PHASE_ADDED = def(8_678_00_0);
public static final TransportVersion RANK_DOC_IN_SHARD_FETCH_REQUEST = def(8_679_00_0);
public static final TransportVersion SECURITY_SETTINGS_REQUEST_TIMEOUTS = def(8_680_00_0);
public static final TransportVersion QUERY_RULE_CRUD_API_PUT = def(8_681_00_0);
public static final TransportVersion DROP_UNUSED_NODES_REQUESTS = def(8_682_00_0);
public static final TransportVersion QUERY_RULE_CRUD_API_GET_DELETE = def(8_683_00_0);
public static final TransportVersion MORE_LIGHTER_NODES_REQUESTS = def(8_684_00_0);
public static final TransportVersion DROP_UNUSED_NODES_IDS = def(8_685_00_0);
public static final TransportVersion DELETE_SNAPSHOTS_ASYNC_ADDED = def(8_686_00_0);
public static final TransportVersion VERSION_SUPPORTING_SPARSE_VECTOR_STATS = def(8_687_00_0);
public static final TransportVersion ML_AD_OUTPUT_MEMORY_ALLOCATOR_FIELD = def(8_688_00_0);
public static final TransportVersion FAILURE_STORE_LAZY_CREATION = def(8_689_00_0);
public static final TransportVersion SNAPSHOT_REQUEST_TIMEOUTS = def(8_690_00_0);
public static final TransportVersion INDEX_METADATA_MAPPINGS_UPDATED_VERSION = def(8_691_00_0);
public static final TransportVersion ML_INFERENCE_ELAND_SETTINGS_ADDED = def(8_692_00_0);
public static final TransportVersion ML_ANTHROPIC_INTEGRATION_ADDED = def(8_693_00_0);
public static final TransportVersion ML_INFERENCE_GOOGLE_VERTEX_AI_EMBEDDINGS_ADDED = def(8_694_00_0);
public static final TransportVersion EVENT_INGESTED_RANGE_IN_CLUSTER_STATE = def(8_695_00_0);
public static final TransportVersion ESQL_ADD_AGGREGATE_TYPE = def(8_696_00_0);
public static final TransportVersion SECURITY_MIGRATIONS_MIGRATION_NEEDED_ADDED = def(8_697_00_0);
public static final TransportVersion K_FOR_KNN_QUERY_ADDED = def(8_698_00_0);
public static final TransportVersion TEXT_SIMILARITY_RERANKER_RETRIEVER = def(8_699_00_0);
public static final TransportVersion ML_INFERENCE_GOOGLE_VERTEX_AI_RERANKING_ADDED = def(8_700_00_0);
public static final TransportVersion VERSIONED_MASTER_NODE_REQUESTS = def(8_701_00_0);
public static final TransportVersion ML_INFERENCE_AMAZON_BEDROCK_ADDED = def(8_702_00_0);
public static final TransportVersion ENTERPRISE_GEOIP_DOWNLOADER_BACKPORT_8_15 = def(8_702_00_1);
public static final TransportVersion FIX_VECTOR_SIMILARITY_INNER_HITS_BACKPORT_8_15 = def(8_702_00_2);
/**
* we made a single backport for ESQL_ES_FIELD_CACHED_SERIALIZATION and ESQL_ATTRIBUTE_CACHED_SERIALIZATION
* with only one TransportVersion entry
*/
public static final TransportVersion ESQL_ATTRIBUTE_CACHED_SERIALIZATION_8_15 = def(8_702_00_3);
public static final TransportVersion V_8_15_0 = def(8_702_00_2);
public static final TransportVersion V_8_15_2 = def(8_702_00_3);
public static final TransportVersion ML_INFERENCE_DONT_DELETE_WHEN_SEMANTIC_TEXT_EXISTS = def(8_703_00_0);
public static final TransportVersion INFERENCE_ADAPTIVE_ALLOCATIONS = def(8_704_00_0);
public static final TransportVersion INDEX_REQUEST_UPDATE_BY_SCRIPT_ORIGIN = def(8_705_00_0);
Expand Down Expand Up @@ -313,7 +241,7 @@ static TransportVersion def(int id) {
* Reference to the minimum transport version that can be used with CCS.
* This should be the transport version used by the previous minor release.
*/
public static final TransportVersion MINIMUM_CCS_VERSION = FIX_VECTOR_SIMILARITY_INNER_HITS_BACKPORT_8_15;
public static final TransportVersion MINIMUM_CCS_VERSION = V_8_15_0;

static final NavigableMap<Integer, TransportVersion> VERSION_IDS = getAllVersionIds(TransportVersions.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public Response(Map<String, NodeAllocationStats> nodeAllocationStats, DiskThresh
public Response(StreamInput in) throws IOException {
super(in);
this.nodeAllocationStats = in.readImmutableMap(StreamInput::readString, NodeAllocationStats::new);
if (in.getTransportVersion().onOrAfter(TransportVersions.WATERMARK_THRESHOLDS_STATS)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
this.diskThresholdSettings = in.readOptionalWriteable(DiskThresholdSettings::readFrom);
} else {
this.diskThresholdSettings = null;
Expand All @@ -166,7 +166,7 @@ public Response(StreamInput in) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeMap(nodeAllocationStats, StreamOutput::writeString, StreamOutput::writeWriteable);
if (out.getTransportVersion().onOrAfter(TransportVersions.WATERMARK_THRESHOLDS_STATS)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeOptionalWriteable(diskThresholdSettings);
} else {
assert diskThresholdSettings == null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ public static class NodeStatsRequest extends TransportRequest {
public NodeStatsRequest(StreamInput in) throws IOException {
super(in);
this.nodesStatsRequestParameters = new NodesStatsRequestParameters(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_13_0)
&& in.getTransportVersion().before(TransportVersions.DROP_UNUSED_NODES_IDS)) {
if (in.getTransportVersion().between(TransportVersions.V_8_13_0, TransportVersions.V_8_15_0)) {
in.readStringArray(); // formerly nodeIds, now unused
}
}
Expand All @@ -214,8 +213,7 @@ public String getDescription() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
nodesStatsRequestParameters.writeTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_13_0)
&& out.getTransportVersion().before(TransportVersions.DROP_UNUSED_NODES_IDS)) {
if (out.getTransportVersion().between(TransportVersions.V_8_13_0, TransportVersions.V_8_15_0)) {
out.writeStringArray(Strings.EMPTY_ARRAY); // formerly nodeIds, now unused
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public CleanupRepositoryRequest(TimeValue masterNodeTimeout, TimeValue ackTimeou
}

public static CleanupRepositoryRequest readFrom(StreamInput in) throws IOException {
if (in.getTransportVersion().onOrAfter(TransportVersions.SNAPSHOT_REQUEST_TIMEOUTS)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
return new CleanupRepositoryRequest(in);
} else {
return new CleanupRepositoryRequest(TimeValue.THIRTY_SECONDS, TimeValue.THIRTY_SECONDS, in);
Expand All @@ -48,7 +48,7 @@ public CleanupRepositoryRequest(TimeValue masterNodeTimeout, TimeValue ackTimeou

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(TransportVersions.SNAPSHOT_REQUEST_TIMEOUTS)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
super.writeTo(out);
}
out.writeString(repository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public DeleteSnapshotRequest(StreamInput in) throws IOException {
super(in);
repository = in.readString();
snapshots = in.readStringArray();
if (in.getTransportVersion().onOrAfter(TransportVersions.DELETE_SNAPSHOTS_ASYNC_ADDED)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
waitForCompletion = in.readBoolean();
}
}
Expand All @@ -61,7 +61,7 @@ public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(repository);
out.writeStringArray(snapshots);
if (out.getTransportVersion().onOrAfter(TransportVersions.DELETE_SNAPSHOTS_ASYNC_ADDED)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(waitForCompletion);
} else {
assert waitForCompletion : "Using wait_for_completion parameter when it should have been disallowed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ protected ClusterBlockException checkBlock(DeleteSnapshotRequest request, Cluste

@Override
protected void doExecute(Task task, DeleteSnapshotRequest request, ActionListener<AcknowledgedResponse> listener) {
if (clusterService.state().getMinTransportVersion().before(TransportVersions.DELETE_SNAPSHOTS_ASYNC_ADDED)
&& request.waitForCompletion() == false) {
if (clusterService.state().getMinTransportVersion().before(TransportVersions.V_8_15_0) && request.waitForCompletion() == false) {
throw new UnsupportedOperationException("wait_for_completion parameter is not supported by all nodes in this cluster");
}
super.doExecute(task, request, listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public CreateIndexRequest(StreamInput in) throws IOException {
} else {
requireDataStream = false;
}
if (in.getTransportVersion().onOrAfter(TransportVersions.FAILURE_STORE_LAZY_CREATION)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
initializeFailureStore = in.readBoolean();
} else {
initializeFailureStore = true;
Expand Down Expand Up @@ -518,7 +518,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_13_0)) {
out.writeBoolean(this.requireDataStream);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.FAILURE_STORE_LAZY_CREATION)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(this.initializeFailureStore);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public IndicesSegmentsRequest(StreamInput in) throws IOException {
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
in.readBoolean(); // old 'verbose' option, since removed
}
if (in.getTransportVersion().onOrAfter(TransportVersions.INDEX_SEGMENTS_VECTOR_FORMATS)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
this.includeVectorFormatsInfo = in.readBoolean();
}
}
Expand All @@ -59,7 +59,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
out.writeBoolean(false);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.INDEX_SEGMENTS_VECTOR_FORMATS)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(includeVectorFormatsInfo);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,11 @@
import java.io.IOException;
import java.util.Objects;

import static org.elasticsearch.TransportVersions.VERSION_SUPPORTING_SPARSE_VECTOR_STATS;

public class CommonStats implements Writeable, ToXContentFragment {

private static final TransportVersion VERSION_SUPPORTING_NODE_MAPPINGS = TransportVersions.V_8_5_0;
private static final TransportVersion VERSION_SUPPORTING_DENSE_VECTOR_STATS = TransportVersions.V_8_10_X;
private static final TransportVersion VERSION_SUPPORTING_SPARSE_VECTOR_STATS = TransportVersions.V_8_15_0;

@Nullable
public DocsStats docs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public final class BulkShardRequest extends ReplicatedWriteRequest<BulkShardRequ
public BulkShardRequest(StreamInput in) throws IOException {
super(in);
items = in.readArray(i -> i.readOptionalWriteable(inpt -> new BulkItemRequest(shardId, inpt)), BulkItemRequest[]::new);
if (in.getTransportVersion().onOrAfter(TransportVersions.SIMULATE_VALIDATES_MAPPINGS)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
isSimulated = in.readBoolean();
} else {
isSimulated = false;
Expand Down Expand Up @@ -132,7 +132,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
super.writeTo(out);
out.writeArray((o, item) -> o.writeOptional(BulkItemRequest.THIN_WRITER, item), items);
if (out.getTransportVersion().onOrAfter(TransportVersions.SIMULATE_VALIDATES_MAPPINGS)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(isSimulated);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public ExplainIndexDataStreamLifecycle(
public ExplainIndexDataStreamLifecycle(StreamInput in) throws IOException {
this.index = in.readString();
this.managedByLifecycle = in.readBoolean();
if (in.getTransportVersion().onOrAfter(TransportVersions.NO_GLOBAL_RETENTION_FOR_SYSTEM_DATA_STREAMS)) {
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
this.isInternalDataStream = in.readBoolean();
} else {
this.isInternalDataStream = false;
Expand Down Expand Up @@ -165,7 +165,7 @@ public XContentBuilder toXContent(
public void writeTo(StreamOutput out) throws IOException {
out.writeString(index);
out.writeBoolean(managedByLifecycle);
if (out.getTransportVersion().onOrAfter(TransportVersions.NO_GLOBAL_RETENTION_FOR_SYSTEM_DATA_STREAMS)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(isInternalDataStream);
}
if (managedByLifecycle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ public record DataStreamLifecycle(
this(
in.readString(),
in.readOptionalWriteable(org.elasticsearch.cluster.metadata.DataStreamLifecycle::new),
in.getTransportVersion().onOrAfter(TransportVersions.NO_GLOBAL_RETENTION_FOR_SYSTEM_DATA_STREAMS) && in.readBoolean()
in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0) && in.readBoolean()
);
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(dataStreamName);
out.writeOptionalWriteable(lifecycle);
if (out.getTransportVersion().onOrAfter(TransportVersions.NO_GLOBAL_RETENTION_FOR_SYSTEM_DATA_STREAMS)) {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
out.writeBoolean(isInternalDataStream);
}
}
Expand Down
Loading

0 comments on commit 32ddbb3

Please sign in to comment.