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
5 changes: 0 additions & 5 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,6 @@ static TransportVersion def(int id) {
public static final TransportVersion STATE_PARAM_GET_SNAPSHOT = def(9_100_0_00);
public static final TransportVersion PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP = def(9_101_0_00);
public static final TransportVersion CLUSTER_STATE_PROJECTS_SETTINGS = def(9_108_0_00);
public static final TransportVersion INDEX_SOURCE = def(9_158_0_00);
public static final TransportVersion MAX_HEAP_SIZE_PER_NODE_IN_CLUSTER_INFO = def(9_159_0_00);
public static final TransportVersion TIMESERIES_DEFAULT_LIMIT = def(9_160_0_00);
public static final TransportVersion INFERENCE_API_OPENAI_HEADERS = def(9_161_0_00);
public static final TransportVersion NEW_SEMANTIC_QUERY_INTERCEPTORS = def(9_162_0_00);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@
public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implements DocWriteRequest<IndexRequest>, CompositeIndicesRequest {

private static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(IndexRequest.class);

private static final TransportVersion PIPELINES_HAVE_RUN_FIELD_ADDED = TransportVersions.V_8_10_X;
private static final TransportVersion INDEX_REQUEST_INCLUDE_TSID = TransportVersion.fromName("index_request_include_tsid");
private static final TransportVersion INDEX_SOURCE = TransportVersion.fromName("index_source");

private static final Supplier<String> ID_GENERATOR = UUIDs::base64UUID;

Expand Down Expand Up @@ -164,7 +166,7 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio
}
id = in.readOptionalString();
routing = in.readOptionalString();
boolean beforeSourceContext = in.getTransportVersion().before(TransportVersions.INDEX_SOURCE);
boolean beforeSourceContext = in.getTransportVersion().supports(INDEX_SOURCE) == false;
BytesReference source;
IndexSource localIndexSource = null;
if (beforeSourceContext) {
Expand Down Expand Up @@ -765,7 +767,7 @@ private void writeBody(StreamOutput out) throws IOException {
}
out.writeOptionalString(id);
out.writeOptionalString(routing);
if (out.getTransportVersion().onOrAfter(TransportVersions.INDEX_SOURCE)) {
if (out.getTransportVersion().supports(INDEX_SOURCE)) {
indexSource.writeTo(out);
} else {
out.writeBytesReference(indexSource.bytes());
Expand All @@ -778,7 +780,7 @@ private void writeBody(StreamOutput out) throws IOException {
out.writeBoolean(isPipelineResolved);
out.writeBoolean(isRetry);
out.writeLong(autoGeneratedTimestamp);
if (out.getTransportVersion().before(TransportVersions.INDEX_SOURCE)) {
if (out.getTransportVersion().supports(INDEX_SOURCE) == false) {
XContentType contentType = indexSource.contentType();
if (contentType != null) {
out.writeBoolean(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public class ClusterInfo implements ChunkedToXContent, Writeable, ExpectedShardS
"node_usage_stats_for_thread_pools_in_cluster_info"
);
private static final TransportVersion SHARD_WRITE_LOAD_IN_CLUSTER_INFO = TransportVersion.fromName("shard_write_load_in_cluster_info");
private static final TransportVersion MAX_HEAP_SIZE_PER_NODE_IN_CLUSTER_INFO = TransportVersion.fromName(
"max_heap_size_per_node_in_cluster_info"
);

private final Map<String, DiskUsage> leastAvailableSpaceUsage;
private final Map<String, DiskUsage> mostAvailableSpaceUsage;
Expand Down Expand Up @@ -131,7 +134,7 @@ public ClusterInfo(StreamInput in) throws IOException {
} else {
this.shardWriteLoads = Map.of();
}
if (in.getTransportVersion().onOrAfter(TransportVersions.MAX_HEAP_SIZE_PER_NODE_IN_CLUSTER_INFO)) {
if (in.getTransportVersion().supports(MAX_HEAP_SIZE_PER_NODE_IN_CLUSTER_INFO)) {
this.maxHeapSizePerNode = in.readImmutableMap(ByteSizeValue::readFrom);
} else {
this.maxHeapSizePerNode = Map.of();
Expand All @@ -155,7 +158,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().supports(SHARD_WRITE_LOAD_IN_CLUSTER_INFO)) {
out.writeMap(this.shardWriteLoads, StreamOutput::writeWriteable, StreamOutput::writeDouble);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.MAX_HEAP_SIZE_PER_NODE_IN_CLUSTER_INFO)) {
if (out.getTransportVersion().supports(MAX_HEAP_SIZE_PER_NODE_IN_CLUSTER_INFO)) {
out.writeMap(this.maxHeapSizePerNode, StreamOutput::writeWriteable);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9158000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9161000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9159000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9162000
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9160000
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public void testTransportVersionsLocked() {
"TransportVersions.java is locked. Generate transport versions with TransportVersion.fromName "
+ "and generateTransportVersion gradle task",
TransportVersions.DEFINED_VERSIONS.getLast().id(),
equalTo(9_162_0_00)
equalTo(9_108_0_00)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import java.util.stream.Collectors;

import static java.util.stream.Collectors.toMap;
import static org.elasticsearch.TransportVersions.INDEX_SOURCE;

/**
* This enum represents data types the ES|QL query processing layer is able to
Expand Down Expand Up @@ -297,9 +296,9 @@ public enum DataType implements Writeable {
// NOTE: If INDEX_SOURCE somehow gets backported to a version that doesn't actually support these types, we'll be missing validation for
// mixed/multi clusters with remotes that don't support these types. This is low-ish risk because these types require specific
// geo functions to turn up in the query, and those types aren't available before 9.2.0 either.
GEOHASH(builder().esType("geohash").typeName("GEOHASH").estimatedSize(Long.BYTES).supportedOn(INDEX_SOURCE)),
GEOTILE(builder().esType("geotile").typeName("GEOTILE").estimatedSize(Long.BYTES).supportedOn(INDEX_SOURCE)),
GEOHEX(builder().esType("geohex").typeName("GEOHEX").estimatedSize(Long.BYTES).supportedOn(INDEX_SOURCE)),
GEOHASH(builder().esType("geohash").typeName("GEOHASH").estimatedSize(Long.BYTES).supportedOn(DataTypesTransportVersions.INDEX_SOURCE)),
GEOTILE(builder().esType("geotile").typeName("GEOTILE").estimatedSize(Long.BYTES).supportedOn(DataTypesTransportVersions.INDEX_SOURCE)),
GEOHEX(builder().esType("geohex").typeName("GEOHEX").estimatedSize(Long.BYTES).supportedOn(DataTypesTransportVersions.INDEX_SOURCE)),

/**
* Fields with this type represent a Lucene doc id. This field is a bit magic in that:
Expand All @@ -322,7 +321,9 @@ public enum DataType implements Writeable {
// NOTE: If INDEX_SOURCE somehow gets backported to a version that doesn't actually support _tsid, we'll be missing validation for
// mixed/multi clusters with remotes that don't support these types. This is low-ish risk because _tsid requires specifically being
// used in `FROM idx METADATA _tsid` or in the `TS` command, which both weren't available before 9.2.0.
TSID_DATA_TYPE(builder().esType("_tsid").estimatedSize(Long.BYTES * 2).docValues().supportedOn(INDEX_SOURCE)),
TSID_DATA_TYPE(
builder().esType("_tsid").estimatedSize(Long.BYTES * 2).docValues().supportedOn(DataTypesTransportVersions.INDEX_SOURCE)
),
/**
* Fields with this type are the partial result of running a non-time-series aggregation
* inside alongside time-series aggregations. These fields are not parsable from the
Expand Down Expand Up @@ -971,6 +972,9 @@ Builder underConstruction() {
}

private static class DataTypesTransportVersions {

public static final TransportVersion INDEX_SOURCE = TransportVersion.fromName("index_source");

public static final TransportVersion ESQL_DENSE_VECTOR_CREATED_VERSION = TransportVersion.fromName(
"esql_dense_vector_created_version"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import java.util.TreeMap;
import java.util.stream.Collectors;

import static org.elasticsearch.TransportVersions.INDEX_SOURCE;
import static org.elasticsearch.common.xcontent.support.XContentMapValues.extractValue;
import static org.elasticsearch.test.ListMatcher.matchesList;
import static org.elasticsearch.test.MapMatcher.assertMap;
Expand Down Expand Up @@ -70,6 +69,8 @@
public class AllSupportedFieldsTestCase extends ESRestTestCase {
private static final Logger logger = LogManager.getLogger(FieldExtractorTestCase.class);

private static final TransportVersion INDEX_SOURCE = TransportVersion.fromName("index_source");

@Rule(order = Integer.MIN_VALUE)
public ProfileLogger profileLogger = new ProfileLogger();

Expand Down Expand Up @@ -445,7 +446,7 @@ private Matcher<?> expectedValue(DataType type) {
}

private Matcher<List<?>> expectedDenseVector(TransportVersion version) {
return version.onOrAfter(INDEX_SOURCE) // *after* 9.1
return version.supports(INDEX_SOURCE) // *after* 9.1
? matchesList().item(0.5).item(10.0).item(5.9999995)
: matchesList().item(0.04283529).item(0.85670584).item(0.5140235);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

package org.elasticsearch.xpack.esql.session;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.compress.CompressorFactory;
Expand Down Expand Up @@ -37,6 +38,8 @@ public class Configuration implements Writeable {
public static final int QUERY_COMPRESS_THRESHOLD_CHARS = KB.toIntBytes(5);
public static final ZoneId DEFAULT_TZ = ZoneOffset.UTC;

private static final TransportVersion TIMESERIES_DEFAULT_LIMIT = TransportVersion.fromName("timeseries_default_limit");

private final String clusterName;
private final String username;
private final ZonedDateTime now;
Expand Down Expand Up @@ -112,7 +115,7 @@ public Configuration(BlockStreamInput in) throws IOException {
} else {
this.allowPartialResults = false;
}
if (in.getTransportVersion().onOrAfter(TransportVersions.TIMESERIES_DEFAULT_LIMIT)) {
if (in.getTransportVersion().supports(TIMESERIES_DEFAULT_LIMIT)) {
this.resultTruncationMaxSizeTimeseries = in.readVInt();
this.resultTruncationDefaultSizeTimeseries = in.readVInt();
} else {
Expand Down Expand Up @@ -141,7 +144,7 @@ public void writeTo(StreamOutput out) throws IOException {
|| out.getTransportVersion().isPatchFrom(TransportVersions.ESQL_SUPPORT_PARTIAL_RESULTS_BACKPORT_8_19)) {
out.writeBoolean(allowPartialResults);
}
if (out.getTransportVersion().onOrAfter(TransportVersions.TIMESERIES_DEFAULT_LIMIT)) {
if (out.getTransportVersion().supports(TIMESERIES_DEFAULT_LIMIT)) {
out.writeVInt(resultTruncationMaxSizeTimeseries);
out.writeVInt(resultTruncationDefaultSizeTimeseries);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package org.elasticsearch.xpack.inference.queries;

import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ResolvedIndices;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.InferenceFieldMetadata;
Expand Down Expand Up @@ -42,6 +42,8 @@ public class InterceptedInferenceKnnVectorQueryBuilder extends InterceptedInfere
@SuppressWarnings("deprecation")
private static final QueryRewriteInterceptor BWC_INTERCEPTOR = new LegacySemanticKnnVectorQueryRewriteInterceptor();

private static final TransportVersion NEW_SEMANTIC_QUERY_INTERCEPTORS = TransportVersion.fromName("new_semantic_query_interceptors");

public InterceptedInferenceKnnVectorQueryBuilder(KnnVectorQueryBuilder originalQuery) {
super(originalQuery);
}
Expand Down Expand Up @@ -117,7 +119,7 @@ protected void coordinatorNodeValidate(ResolvedIndices resolvedIndices) {
@Override
protected QueryBuilder doRewriteBwC(QueryRewriteContext queryRewriteContext) {
QueryBuilder rewritten = this;
if (queryRewriteContext.getMinTransportVersion().before(TransportVersions.NEW_SEMANTIC_QUERY_INTERCEPTORS)) {
if (queryRewriteContext.getMinTransportVersion().supports(NEW_SEMANTIC_QUERY_INTERCEPTORS) == false) {
rewritten = BWC_INTERCEPTOR.interceptAndRewrite(queryRewriteContext, originalQuery);
}

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

package org.elasticsearch.xpack.inference.queries;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.index.mapper.MappedFieldType;
import org.elasticsearch.index.query.MatchNoneQueryBuilder;
Expand All @@ -27,6 +27,8 @@ public class InterceptedInferenceMatchQueryBuilder extends InterceptedInferenceQ
@SuppressWarnings("deprecation")
private static final QueryRewriteInterceptor BWC_INTERCEPTOR = new LegacySemanticMatchQueryRewriteInterceptor();

private static final TransportVersion NEW_SEMANTIC_QUERY_INTERCEPTORS = TransportVersion.fromName("new_semantic_query_interceptors");

public InterceptedInferenceMatchQueryBuilder(MatchQueryBuilder originalQuery) {
super(originalQuery);
}
Expand Down Expand Up @@ -63,7 +65,7 @@ protected String getQuery() {
@Override
protected QueryBuilder doRewriteBwC(QueryRewriteContext queryRewriteContext) {
QueryBuilder rewritten = this;
if (queryRewriteContext.getMinTransportVersion().before(TransportVersions.NEW_SEMANTIC_QUERY_INTERCEPTORS)) {
if (queryRewriteContext.getMinTransportVersion().supports(NEW_SEMANTIC_QUERY_INTERCEPTORS) == false) {
rewritten = BWC_INTERCEPTOR.interceptAndRewrite(queryRewriteContext, originalQuery);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
package org.elasticsearch.xpack.inference.queries;

import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ResolvedIndices;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.InferenceFieldMetadata;
Expand Down Expand Up @@ -41,6 +41,8 @@ public class InterceptedInferenceSparseVectorQueryBuilder extends InterceptedInf
@SuppressWarnings("deprecation")
private static final QueryRewriteInterceptor BWC_INTERCEPTOR = new LegacySemanticSparseVectorQueryRewriteInterceptor();

private static final TransportVersion NEW_SEMANTIC_QUERY_INTERCEPTORS = TransportVersion.fromName("new_semantic_query_interceptors");

public InterceptedInferenceSparseVectorQueryBuilder(SparseVectorQueryBuilder originalQuery) {
super(originalQuery);
}
Expand Down Expand Up @@ -104,7 +106,7 @@ protected void coordinatorNodeValidate(ResolvedIndices resolvedIndices) {
@Override
protected QueryBuilder doRewriteBwC(QueryRewriteContext queryRewriteContext) {
QueryBuilder rewritten = this;
if (queryRewriteContext.getMinTransportVersion().before(TransportVersions.NEW_SEMANTIC_QUERY_INTERCEPTORS)) {
if (queryRewriteContext.getMinTransportVersion().supports(NEW_SEMANTIC_QUERY_INTERCEPTORS) == false) {
rewritten = BWC_INTERCEPTOR.interceptAndRewrite(queryRewriteContext, originalQuery);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import java.io.IOException;
import java.util.Map;

import static org.elasticsearch.TransportVersions.INFERENCE_API_OPENAI_HEADERS;

public class OpenAiChatCompletionTaskSettings extends OpenAiTaskSettings<OpenAiChatCompletionTaskSettings> {

public static final String NAME = "openai_completion_task_settings";

private static final TransportVersion INFERENCE_API_OPENAI_HEADERS = TransportVersion.fromName("inference_api_openai_headers");

public OpenAiChatCompletionTaskSettings(Map<String, Object> map) {
super(map);
}
Expand All @@ -40,7 +40,7 @@ private static Settings readTaskSettingsFromStream(StreamInput in) throws IOExce

Map<String, String> headers;

if (in.getTransportVersion().onOrAfter(INFERENCE_API_OPENAI_HEADERS)) {
if (in.getTransportVersion().supports(INFERENCE_API_OPENAI_HEADERS)) {
headers = in.readOptionalImmutableMap(StreamInput::readString, StreamInput::readString);
} else {
headers = null;
Expand All @@ -62,7 +62,7 @@ public TransportVersion getMinimalSupportedVersion() {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(user());
if (out.getTransportVersion().onOrAfter(INFERENCE_API_OPENAI_HEADERS)) {
if (out.getTransportVersion().supports(INFERENCE_API_OPENAI_HEADERS)) {
out.writeOptionalMap(headers(), StreamOutput::writeString, StreamOutput::writeString);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@
import java.util.Map;
import java.util.function.Supplier;

import static org.elasticsearch.TransportVersions.NEW_SEMANTIC_QUERY_INTERCEPTORS;
import static org.elasticsearch.TransportVersions.V_8_15_0;
import static org.elasticsearch.xpack.core.ml.inference.trainedmodel.InferenceConfig.DEFAULT_RESULTS_FIELD;
import static org.elasticsearch.xpack.inference.queries.InterceptedInferenceQueryBuilder.INFERENCE_RESULTS_MAP_WITH_CLUSTER_ALIAS;
Expand Down Expand Up @@ -107,6 +106,8 @@ public abstract class AbstractInterceptedInferenceQueryBuilderTestCase<T extends
DENSE_INFERENCE_ID_SETTINGS
);

private static final TransportVersion NEW_SEMANTIC_QUERY_INTERCEPTORS = TransportVersion.fromName("new_semantic_query_interceptors");

private NamedWriteableRegistry namedWriteableRegistry = null;

private static class InferencePluginWithModelRegistry extends InferencePlugin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import org.apache.lucene.search.join.ScoreMode;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.index.mapper.IndexFieldMapper;
import org.elasticsearch.index.query.MatchNoneQueryBuilder;
import org.elasticsearch.index.query.NestedQueryBuilder;
Expand Down Expand Up @@ -40,6 +39,8 @@
public class InterceptedInferenceKnnVectorQueryBuilderTests extends AbstractInterceptedInferenceQueryBuilderTestCase<
KnnVectorQueryBuilder> {

private static final TransportVersion NEW_SEMANTIC_QUERY_INTERCEPTORS = TransportVersion.fromName("new_semantic_query_interceptors");

@Override
protected Collection<? extends Plugin> getPlugins() {
List<Plugin> plugins = new ArrayList<>(super.getPlugins());
Expand Down Expand Up @@ -82,7 +83,7 @@ protected void assertCoordinatorNodeRewriteOnInferenceField(
QueryRewriteContext queryRewriteContext
) {
assertThat(original, instanceOf(KnnVectorQueryBuilder.class));
if (transportVersion.onOrAfter(TransportVersions.NEW_SEMANTIC_QUERY_INTERCEPTORS)) {
if (transportVersion.supports(NEW_SEMANTIC_QUERY_INTERCEPTORS)) {
assertThat(rewritten, instanceOf(InterceptedInferenceKnnVectorQueryBuilder.class));

InterceptedInferenceKnnVectorQueryBuilder intercepted = (InterceptedInferenceKnnVectorQueryBuilder) rewritten;
Expand Down
Loading