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
12 changes: 0 additions & 12 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ static TransportVersion def(int id) {
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 RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90 = def(9_000_0_08);
public static final TransportVersion STORED_SCRIPT_CONTENT_LENGTH_90 = def(9_000_0_09);
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);
Expand All @@ -200,9 +198,7 @@ static TransportVersion def(int id) {
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 STORED_SCRIPT_CONTENT_LENGTH = def(9_019_0_00);
public static final TransportVersion JINA_AI_EMBEDDING_TYPE_SUPPORT_ADDED = def(9_020_0_00);
public static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE = def(9_021_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);
Expand Down Expand Up @@ -252,14 +248,6 @@ static TransportVersion def(int id) {
public static final TransportVersion ESQL_TIME_SERIES_SOURCE_STATUS = def(9_076_0_00);
public static final TransportVersion NODES_STATS_SUPPORTS_MULTI_PROJECT = def(9_079_0_00);
public static final TransportVersion ESQL_LIMIT_ROW_SIZE = def(9_085_0_00);
public static final TransportVersion SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS = def(9_093_0_00);
public static final TransportVersion SEARCH_LOAD_PER_INDEX_STATS = def(9_095_0_00);
public static final TransportVersion HEAP_USAGE_IN_CLUSTER_INFO = def(9_096_0_00);
public static final TransportVersion PROJECT_DELETION_GLOBAL_BLOCK = def(9_098_0_00);
public static final TransportVersion SECURITY_CLOUD_API_KEY_REALM_AND_TYPE = def(9_099_0_00);
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);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class GetSnapshotsRequest extends MasterNodeRequest<GetSnapshotsRequest>
public static final boolean DEFAULT_VERBOSE_MODE = true;

private static final TransportVersion INDICES_FLAG_VERSION = TransportVersions.V_8_3_0;
private static final TransportVersion STATE_FLAG_VERSION = TransportVersions.STATE_PARAM_GET_SNAPSHOT;
private static final TransportVersion STATE_FLAG_VERSION = TransportVersion.fromName("state_param_get_snapshot");

public static final int NO_LIMIT = -1;

Expand Down Expand Up @@ -124,7 +124,7 @@ public GetSnapshotsRequest(StreamInput in) throws IOException {
if (in.getTransportVersion().onOrAfter(INDICES_FLAG_VERSION)) {
includeIndexNames = in.readBoolean();
}
if (in.getTransportVersion().onOrAfter(STATE_FLAG_VERSION)) {
if (in.getTransportVersion().supports(STATE_FLAG_VERSION)) {
states = in.readEnumSet(SnapshotState.class);
} else {
states = EnumSet.allOf(SnapshotState.class);
Expand All @@ -148,7 +148,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(INDICES_FLAG_VERSION)) {
out.writeBoolean(includeIndexNames);
}
if (out.getTransportVersion().onOrAfter(STATE_FLAG_VERSION)) {
if (out.getTransportVersion().supports(STATE_FLAG_VERSION)) {
out.writeEnumSet(states);
} else if (states.equals(EnumSet.allOf(SnapshotState.class)) == false) {
final var errorString = "GetSnapshotsRequest [states] field is not supported on all nodes in the cluster";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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

import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.support.broadcast.BroadcastShardResponse;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
Expand All @@ -22,10 +23,12 @@
import java.io.IOException;
import java.util.Objects;

import static org.elasticsearch.TransportVersions.SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS;

public class SnapshotIndexShardStatus extends BroadcastShardResponse implements ToXContentFragment {

private static final TransportVersion SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS = TransportVersion.fromName(
"snapshot_index_shard_status_missing_stats"
);

private final SnapshotIndexShardStage stage;

private final SnapshotStats stats;
Expand All @@ -42,7 +45,7 @@ public SnapshotIndexShardStatus(StreamInput in) throws IOException {
stats = new SnapshotStats(in);
nodeId = in.readOptionalString();
failure = in.readOptionalString();
if (in.getTransportVersion().onOrAfter(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
if (in.getTransportVersion().supports(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
description = in.readOptionalString();
}
}
Expand Down Expand Up @@ -159,7 +162,7 @@ public void writeTo(StreamOutput out) throws IOException {
stats.writeTo(out);
out.writeOptionalString(nodeId);
out.writeOptionalString(failure);
if (out.getTransportVersion().onOrAfter(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
if (out.getTransportVersion().supports(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
out.writeOptionalString(description);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

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

import org.elasticsearch.TransportVersion;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand All @@ -21,10 +22,12 @@

import java.io.IOException;

import static org.elasticsearch.TransportVersions.SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS;

public class SnapshotStats implements Writeable, ToXContentObject {

private static final TransportVersion SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS = TransportVersion.fromName(
"snapshot_index_shard_status_missing_stats"
);

private long startTime;
private long time;
private int incrementalFileCount;
Expand All @@ -38,7 +41,7 @@ public class SnapshotStats implements Writeable, ToXContentObject {

SnapshotStats(StreamInput in) throws IOException {
// We use a boolean to indicate if the stats are present (true) or missing (false), to skip writing all the values if missing.
if (in.getTransportVersion().onOrAfter(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS) && in.readBoolean() == false) {
if (in.getTransportVersion().supports(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS) && in.readBoolean() == false) {
startTime = 0L;
time = 0L;
incrementalFileCount = -1;
Expand Down Expand Up @@ -156,7 +159,7 @@ public long getProcessedSize() {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
if (out.getTransportVersion().supports(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
// We use a boolean to indicate if the stats are present (true) or missing (false), to skip writing all the values if missing.
if (isMissingStats()) {
out.writeBoolean(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.ActionFilters;
Expand Down Expand Up @@ -73,6 +72,10 @@ public class TransportSnapshotsStatusAction extends TransportMasterNodeAction<Sn
public static final ActionType<SnapshotsStatusResponse> TYPE = new ActionType<>("cluster:admin/snapshot/status");
private static final Logger logger = LogManager.getLogger(TransportSnapshotsStatusAction.class);

private static final TransportVersion SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS = TransportVersion.fromName(
"snapshot_index_shard_status_missing_stats"
);

private final RepositoriesService repositoriesService;

private final NodeClient client;
Expand Down Expand Up @@ -245,7 +248,7 @@ void buildResponse(
// When processing currently running snapshots, instead of reading the statistics from the repository, which can be
// expensive, we choose instead to provide a message to the caller explaining why the stats are missing and the API
// that can be used to load them once the snapshot has completed.
if (minTransportVersion.onOrAfter(TransportVersions.SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
if (minTransportVersion.supports(SNAPSHOT_INDEX_SHARD_STATUS_MISSING_STATS)) {
shardStatus = SnapshotIndexShardStatus.forDoneButMissingStats(shardId, """
Snapshot shard stats missing from a currently running snapshot due to a node leaving the cluster after \
completing the shard snapshot; retry once the snapshot has completed to load all shard stats from the \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

package org.elasticsearch.action.admin.cluster.storedscripts;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
import org.elasticsearch.common.Strings;
Expand All @@ -32,6 +32,8 @@

public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptRequest> implements ToXContentFragment {

private static final TransportVersion STORED_SCRIPT_CONTENT_LENGTH = TransportVersion.fromName("stored_script_content_length");

@Nullable
private final String id;

Expand All @@ -45,8 +47,7 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
public PutStoredScriptRequest(StreamInput in) throws IOException {
super(in);
id = in.readOptionalString();
if (in.getTransportVersion().isPatchFrom(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90)
|| in.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
if (in.getTransportVersion().supports(STORED_SCRIPT_CONTENT_LENGTH)) {
contentLength = in.readVInt();
} else {
BytesReference content = in.readBytesReference();
Expand Down Expand Up @@ -106,8 +107,7 @@ public StoredScriptSource source() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeOptionalString(id);
if (out.getTransportVersion().isPatchFrom(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH_90)
|| out.getTransportVersion().onOrAfter(TransportVersions.STORED_SCRIPT_CONTENT_LENGTH)) {
if (out.getTransportVersion().supports(STORED_SCRIPT_CONTENT_LENGTH)) {
out.writeVInt(contentLength);
} else {
// generate a bytes reference of the correct size (the content isn't actually used in 8.18)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

package org.elasticsearch.action.search;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
Expand Down Expand Up @@ -62,6 +63,10 @@ public class SearchRequest extends LegacyActionRequest implements IndicesRequest

private static final long DEFAULT_ABSOLUTE_START_MILLIS = -1;

private static final TransportVersion RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE = TransportVersion.fromName(
"re_remove_min_compatible_shard_node"
);

private final String localClusterAlias;
private final long absoluteStartMillis;
private final boolean finalReduce;
Expand Down Expand Up @@ -254,8 +259,7 @@ public SearchRequest(StreamInput in) throws IOException {
finalReduce = true;
}
ccsMinimizeRoundtrips = in.readBoolean();
if ((in.getTransportVersion().isPatchFrom(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90) == false
&& in.getTransportVersion().before(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE)) && in.readBoolean()) {
if (in.getTransportVersion().supports(RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE) == false && in.readBoolean()) {
Version.readVersion(in); // and drop on the floor
}
waitForCheckpoints = in.readMap(StreamInput::readLongArray);
Expand Down Expand Up @@ -299,8 +303,7 @@ public void writeTo(StreamOutput out, boolean skipIndices) throws IOException {
out.writeBoolean(finalReduce);
}
out.writeBoolean(ccsMinimizeRoundtrips);
if ((out.getTransportVersion().isPatchFrom(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE_90) == false
&& out.getTransportVersion().before(TransportVersions.RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE))) {
if (out.getTransportVersion().supports(RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE) == false) {
out.writeBoolean(false);
}
out.writeMap(waitForCheckpoints, StreamOutput::writeLongArray);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public class ClusterInfo implements ChunkedToXContent, Writeable {
public static final ClusterInfo EMPTY = new ClusterInfo();

public static final TransportVersion DATA_PATH_NEW_KEY_VERSION = TransportVersions.V_8_6_0;
private static final TransportVersion HEAP_USAGE_IN_CLUSTER_INFO = TransportVersion.fromName("heap_usage_in_cluster_info");

private final Map<String, DiskUsage> leastAvailableSpaceUsage;
private final Map<String, DiskUsage> mostAvailableSpaceUsage;
Expand Down Expand Up @@ -102,7 +103,7 @@ public ClusterInfo(StreamInput in) throws IOException {
? in.readImmutableMap(NodeAndShard::new, StreamInput::readString)
: in.readImmutableMap(nested -> NodeAndShard.from(new ShardRouting(nested)), StreamInput::readString);
this.reservedSpace = in.readImmutableMap(NodeAndPath::new, ReservedSpace::new);
if (in.getTransportVersion().onOrAfter(TransportVersions.HEAP_USAGE_IN_CLUSTER_INFO)) {
if (in.getTransportVersion().supports(HEAP_USAGE_IN_CLUSTER_INFO)) {
this.estimatedHeapUsages = in.readImmutableMap(EstimatedHeapUsage::new);
} else {
this.estimatedHeapUsages = Map.of();
Expand All @@ -121,7 +122,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeMap(this.dataPath, (o, k) -> createFakeShardRoutingFromNodeAndShard(k).writeTo(o), StreamOutput::writeString);
}
out.writeMap(this.reservedSpace);
if (out.getTransportVersion().onOrAfter(TransportVersions.HEAP_USAGE_IN_CLUSTER_INFO)) {
if (out.getTransportVersion().supports(HEAP_USAGE_IN_CLUSTER_INFO)) {
out.writeMap(this.estimatedHeapUsages, StreamOutput::writeWriteable);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import java.util.List;
import java.util.Objects;

import static org.elasticsearch.TransportVersions.PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP;

/**
* A repository cleanup request entry. Part of the cluster state.
*/
Expand All @@ -34,6 +32,10 @@ public final class RepositoryCleanupInProgress extends AbstractNamedDiffable<Clu

public static final String TYPE = "repository_cleanup";

private static final TransportVersion PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP = TransportVersion.fromName(
"project_id_in_snapshots_deletions_and_repo_cleanup"
);

private final List<Entry> entries;

public static RepositoryCleanupInProgress get(ClusterState state) {
Expand Down Expand Up @@ -114,7 +116,7 @@ public TransportVersion getMinimalSupportedVersion() {
public record Entry(ProjectId projectId, String repository, long repositoryStateId) implements Writeable, RepositoryOperation {

public static Entry readFrom(StreamInput in) throws IOException {
final ProjectId projectId = in.getTransportVersion().onOrAfter(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)
final ProjectId projectId = in.getTransportVersion().supports(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)
? ProjectId.readFrom(in)
: ProjectId.DEFAULT;
return new Entry(projectId, in.readString(), in.readLong());
Expand All @@ -137,7 +139,7 @@ public String repository() {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)) {
if (out.getTransportVersion().supports(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)) {
projectId.writeTo(out);
} else {
if (ProjectId.DEFAULT.equals(projectId) == false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
import java.util.List;
import java.util.Set;

import static org.elasticsearch.TransportVersions.PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP;

/**
* Represents the in-progress snapshot deletions in the cluster state.
*/
Expand All @@ -43,6 +41,10 @@ public class SnapshotDeletionsInProgress extends AbstractNamedDiffable<Custom> i

public static final String TYPE = "snapshot_deletions";

private static final TransportVersion PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP = TransportVersion.fromName(
"project_id_in_snapshots_deletions_and_repo_cleanup"
);

// the list of snapshot deletion request entries
private final List<Entry> entries;

Expand Down Expand Up @@ -237,7 +239,7 @@ public Entry(

@SuppressForbidden(reason = "using a private constructor within the same file")
public static Entry readFrom(StreamInput in) throws IOException {
final ProjectId projectId = in.getTransportVersion().onOrAfter(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)
final ProjectId projectId = in.getTransportVersion().supports(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)
? ProjectId.readFrom(in)
: ProjectId.DEFAULT;
return new Entry(
Expand Down Expand Up @@ -279,7 +281,7 @@ public Entry withRepoGen(long repoGen) {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)) {
if (out.getTransportVersion().supports(PROJECT_ID_IN_SNAPSHOTS_DELETIONS_AND_REPO_CLEANUP)) {
projectId.writeTo(out);
} else {
if (ProjectId.DEFAULT.equals(projectId) == false) {
Expand Down
Loading