Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
29 changes: 6 additions & 23 deletions server/src/main/java/org/elasticsearch/Build.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,21 +216,9 @@ public static Build readBuild(StreamInput in) throws IOException {
final String minWireVersion;
final String minIndexVersion;
final String displayString;
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
version = in.readString();
qualifier = in.readOptionalString();
snapshot = in.readBoolean();
} else {
snapshot = in.readBoolean();
String rawVersion = in.readString();
// need to separate out qualifiers from older nodes
var versionMatcher = qualfiedVersionRegex.matcher(rawVersion);
if (versionMatcher.matches() == false) {
throw new IllegalStateException(String.format(Locale.ROOT, "Malformed elasticsearch compile version: %s", rawVersion));
}
version = versionMatcher.group(1);
qualifier = versionMatcher.group(2);
}
version = in.readString();
qualifier = in.readOptionalString();
snapshot = in.readBoolean();
minWireVersion = in.readString();
minIndexVersion = in.readString();
displayString = in.readString();
Expand All @@ -242,14 +230,9 @@ public static void writeBuild(Build build, StreamOutput out) throws IOException
out.writeString(build.type().displayName());
out.writeString(build.hash());
out.writeString(build.date());
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeString(build.version());
out.writeOptionalString(build.qualifier());
out.writeBoolean(build.isSnapshot());
} else {
out.writeBoolean(build.isSnapshot());
out.writeString(build.qualifiedVersion());
}
out.writeString(build.version());
out.writeOptionalString(build.qualifier());
out.writeBoolean(build.isSnapshot());
out.writeString(build.minWireCompatVersion());
out.writeString(build.minIndexCompatVersion());
out.writeString(build.displayString());
Expand Down
2 changes: 0 additions & 2 deletions server/src/main/java/org/elasticsearch/TransportVersions.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ static TransportVersion def(int id) {
* READ THE COMMENT BELOW THIS BLOCK OF DECLARATIONS BEFORE ADDING NEW TRANSPORT VERSIONS
* Detached transport versions added below here.
*/
public static final TransportVersion V_8_12_0 = def(8_560_0_00);
public static final TransportVersion V_8_12_1 = def(8_560_0_01);
public static final TransportVersion V_8_13_0 = def(8_595_0_00);
public static final TransportVersion V_8_13_4 = def(8_595_0_01);
public static final TransportVersion V_8_14_0 = def(8_636_0_01);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

import org.elasticsearch.Build;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.Version;
import org.elasticsearch.action.support.nodes.BaseNodeResponse;
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.version.CompatibilityVersions;
Expand Down Expand Up @@ -64,16 +62,9 @@ public class NodeInfo extends BaseNodeResponse {

public NodeInfo(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
version = in.readString();
compatibilityVersions = CompatibilityVersions.readVersion(in);
indexVersion = IndexVersion.readVersion(in);
} else {
Version legacyVersion = Version.readVersion(in);
version = legacyVersion.toString();
compatibilityVersions = new CompatibilityVersions(TransportVersion.readVersion(in), Map.of()); // unknown mappings versions;
indexVersion = IndexVersion.readVersion(in);
}
version = in.readString();
compatibilityVersions = CompatibilityVersions.readVersion(in);
indexVersion = IndexVersion.readVersion(in);
componentVersions = in.readImmutableMap(StreamInput::readString, StreamInput::readVInt);
build = Build.readBuild(in);
if (in.readBoolean()) {
Expand Down Expand Up @@ -228,11 +219,7 @@ private <T extends ReportingService.Info> void addInfoIfNonNull(Class<T> clazz,
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeString(version);
} else {
Version.writeVersion(Version.fromString(version), out);
}
out.writeString(version);
compatibilityVersions.writeTo(out);
IndexVersion.writeVersion(indexVersion, out);
out.writeMap(componentVersions, StreamOutput::writeString, StreamOutput::writeVInt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,14 @@ public NodesStatsRequestParameters() {
public NodesStatsRequestParameters(StreamInput in) throws IOException {
indices = new CommonStatsFlags(in);
requestedMetrics = Metric.readSetFrom(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
includeShardsStats = in.readBoolean();
} else {
includeShardsStats = true;
}
includeShardsStats = in.readBoolean();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
indices.writeTo(out);
Metric.writeSetTo(out, requestedMetrics);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeBoolean(includeShardsStats);
}
out.writeBoolean(includeShardsStats);
}

public CommonStatsFlags indices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.Map;
import java.util.Objects;

import static org.elasticsearch.TransportVersions.V_8_12_0;
import static org.elasticsearch.TransportVersions.V_8_16_0;

/**
Expand Down Expand Up @@ -78,7 +77,7 @@ public SearchUsageStats(StreamInput in) throws IOException {
this.queries = in.readMap(StreamInput::readLong);
this.sections = in.readMap(StreamInput::readLong);
this.totalSearchCount = in.readVLong();
this.rescorers = in.getTransportVersion().onOrAfter(V_8_12_0) ? in.readMap(StreamInput::readLong) : Map.of();
this.rescorers = in.readMap(StreamInput::readLong);
this.retrievers = in.getTransportVersion().onOrAfter(V_8_16_0) ? in.readMap(StreamInput::readLong) : Map.of();
this.extendedSearchUsageStats = in.getTransportVersion().supports(EXTENDED_SEARCH_USAGE_TELEMETRY)
? new ExtendedSearchUsageStats(in)
Expand All @@ -91,9 +90,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeMap(sections, StreamOutput::writeLong);
out.writeVLong(totalSearchCount);

if (out.getTransportVersion().onOrAfter(V_8_12_0)) {
out.writeMap(rescorers, StreamOutput::writeLong);
}
out.writeMap(rescorers, StreamOutput::writeLong);
if (out.getTransportVersion().onOrAfter(V_8_16_0)) {
out.writeMap(retrievers, StreamOutput::writeLong);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

package org.elasticsearch.action.admin.indices.refresh;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.support.broadcast.unpromotable.BroadcastUnpromotableRequest;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
Expand Down Expand Up @@ -55,7 +54,7 @@ public UnpromotableShardRefreshRequest(
public UnpromotableShardRefreshRequest(StreamInput in) throws IOException {
super(in);
segmentGeneration = in.readVLong();
primaryTerm = in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0) ? in.readVLong() : Engine.UNKNOWN_PRIMARY_TERM;
primaryTerm = in.readVLong();
// The timeout is only used by the request sender, therefore we don't write it over the wire
timeout = null;
}
Expand All @@ -75,9 +74,7 @@ public ActionRequestValidationException validate() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeVLong(segmentGeneration);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeVLong(primaryTerm);
}
out.writeVLong(primaryTerm);
}

public long getSegmentGeneration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.action.admin.indices.settings.put;

import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.IndicesRequest;
import org.elasticsearch.action.support.IndicesOptions;
Expand Down Expand Up @@ -57,9 +56,7 @@ public UpdateSettingsRequest(StreamInput in) throws IOException {
settings = readSettingsFromStream(in);
preserveExisting = in.readBoolean();
origin = in.readString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
reopen = in.readBoolean();
}
reopen = in.readBoolean();
}

public UpdateSettingsRequest() {
Expand Down Expand Up @@ -204,9 +201,7 @@ public void writeTo(StreamOutput out) throws IOException {
settings.writeTo(out);
out.writeBoolean(preserveExisting);
out.writeString(origin);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeBoolean(reopen);
}
out.writeBoolean(reopen);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import java.util.Objects;
import java.util.function.Supplier;

import static org.elasticsearch.TransportVersions.V_8_12_0;

/**
* Encapsulates the information that describes an index from its data stream lifecycle perspective.
*/
Expand Down Expand Up @@ -92,12 +90,7 @@ public ExplainIndexDataStreamLifecycle(StreamInput in) throws IOException {
this.rolloverDate = in.readOptionalLong();
this.generationDateMillis = in.readOptionalLong();
this.lifecycle = in.readOptionalWriteable(DataStreamLifecycle::new);
if (in.getTransportVersion().onOrAfter(V_8_12_0)) {
this.error = in.readOptionalWriteable(ErrorEntry::new);
} else {
String bwcErrorMessage = in.readOptionalString();
this.error = new ErrorEntry(-1L, bwcErrorMessage, -1L, -1);
}
this.error = in.readOptionalWriteable(ErrorEntry::new);
} else {
this.indexCreationDate = null;
this.rolloverDate = null;
Expand Down Expand Up @@ -173,12 +166,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalLong(rolloverDate);
out.writeOptionalLong(generationDateMillis);
out.writeOptionalWriteable(lifecycle);
if (out.getTransportVersion().onOrAfter(V_8_12_0)) {
out.writeOptionalWriteable(error);
} else {
String errorMessage = error != null ? error.error() : null;
out.writeOptionalString(errorMessage);
}
out.writeOptionalWriteable(error);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
package org.elasticsearch.action.get;

import org.apache.lucene.util.BytesRef;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
Expand All @@ -24,7 +23,6 @@
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.engine.Engine;
import org.elasticsearch.index.engine.InternalEngine;
import org.elasticsearch.index.get.GetResult;
import org.elasticsearch.index.shard.IndexShard;
Expand Down Expand Up @@ -152,16 +150,14 @@ public Response(GetResult getResult, long primaryTerm, long segmentGeneration) {
public Response(StreamInput in) throws IOException {
segmentGeneration = in.readZLong();
getResult = in.readOptionalWriteable(GetResult::new);
primaryTerm = in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0) ? in.readVLong() : Engine.UNKNOWN_PRIMARY_TERM;
primaryTerm = in.readVLong();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeZLong(segmentGeneration);
out.writeOptionalWriteable(getResult);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeVLong(primaryTerm);
}
out.writeVLong(primaryTerm);
}

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

package org.elasticsearch.action.get;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
Expand All @@ -21,7 +20,6 @@
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.index.IndexService;
import org.elasticsearch.index.engine.Engine;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.indices.IndicesService;
Expand Down Expand Up @@ -176,16 +174,14 @@ public Response(MultiGetShardResponse response, long primaryTerm, long segmentGe
public Response(StreamInput in) throws IOException {
segmentGeneration = in.readZLong();
multiGetShardResponse = new MultiGetShardResponse(in);
primaryTerm = in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0) ? in.readVLong() : Engine.UNKNOWN_PRIMARY_TERM;
primaryTerm = in.readVLong();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeZLong(segmentGeneration);
multiGetShardResponse.writeTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeVLong(primaryTerm);
}
out.writeVLong(primaryTerm);
}

public long segmentGeneration() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,14 +196,12 @@ public IndexRequest(@Nullable ShardId shardId, StreamInput in) throws IOExceptio
ifPrimaryTerm = in.readVLong();
requireAlias = in.readBoolean();
dynamicTemplates = in.readMap(StreamInput::readString);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
this.listExecutedPipelines = in.readBoolean();
if (listExecutedPipelines) {
List<String> possiblyImmutableExecutedPipelines = in.readOptionalCollectionAsList(StreamInput::readString);
this.executedPipelines = possiblyImmutableExecutedPipelines == null
? null
: new ArrayList<>(possiblyImmutableExecutedPipelines);
}
this.listExecutedPipelines = in.readBoolean();
if (listExecutedPipelines) {
List<String> possiblyImmutableExecutedPipelines = in.readOptionalCollectionAsList(StreamInput::readString);
this.executedPipelines = possiblyImmutableExecutedPipelines == null
? null
: new ArrayList<>(possiblyImmutableExecutedPipelines);
}
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_13_0)) {
requireDataStream = in.readBoolean();
Expand Down Expand Up @@ -776,11 +774,9 @@ private void writeBody(StreamOutput out) throws IOException {
out.writeVLong(ifPrimaryTerm);
out.writeBoolean(requireAlias);
out.writeMap(dynamicTemplates, StreamOutput::writeString);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeBoolean(listExecutedPipelines);
if (listExecutedPipelines) {
out.writeOptionalCollection(executedPipelines, StreamOutput::writeString);
}
out.writeBoolean(listExecutedPipelines);
if (listExecutedPipelines) {
out.writeOptionalCollection(executedPipelines, StreamOutput::writeString);
}

if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_13_0)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ public class IndexResponse extends DocWriteResponse {

public IndexResponse(ShardId shardId, StreamInput in) throws IOException {
super(shardId, in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
executedPipelines = in.readOptionalCollectionAsList(StreamInput::readString);
} else {
executedPipelines = null;
}
executedPipelines = in.readOptionalCollectionAsList(StreamInput::readString);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
failureStoreStatus = IndexDocFailureStoreStatus.read(in);
} else {
Expand All @@ -55,11 +51,7 @@ public IndexResponse(ShardId shardId, StreamInput in) throws IOException {

public IndexResponse(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
executedPipelines = in.readOptionalCollectionAsList(StreamInput::readString);
} else {
executedPipelines = null;
}
executedPipelines = in.readOptionalCollectionAsList(StreamInput::readString);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
failureStoreStatus = IndexDocFailureStoreStatus.read(in);
} else {
Expand Down Expand Up @@ -123,9 +115,7 @@ private IndexResponse(
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeOptionalCollection(executedPipelines, StreamOutput::writeString);
}
out.writeOptionalCollection(executedPipelines, StreamOutput::writeString);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
failureStoreStatus.writeTo(out);
}
Expand All @@ -134,9 +124,7 @@ public void writeTo(StreamOutput out) throws IOException {
@Override
public void writeThin(StreamOutput out) throws IOException {
super.writeThin(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_12_0)) {
out.writeOptionalCollection(executedPipelines, StreamOutput::writeString);
}
out.writeOptionalCollection(executedPipelines, StreamOutput::writeString);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_16_0)) {
failureStoreStatus.writeTo(out);
}
Expand Down
Loading