Skip to content

Commit

Permalink
Remove most references to 7.9 and 7.10 transport versions
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop committed Dec 16, 2024
1 parent 693bb79 commit 67f8e6d
Show file tree
Hide file tree
Showing 30 changed files with 55 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ private enum ElasticsearchExceptionHandle {
org.elasticsearch.indices.recovery.PeerRecoveryNotFound.class,
org.elasticsearch.indices.recovery.PeerRecoveryNotFound::new,
158,
TransportVersions.V_7_9_0
UNKNOWN_VERSION_ADDED
),
NODE_HEALTH_CHECK_FAILURE_EXCEPTION(
org.elasticsearch.cluster.coordination.NodeHealthCheckFailureException.class,
Expand All @@ -1836,7 +1836,7 @@ private enum ElasticsearchExceptionHandle {
org.elasticsearch.transport.NoSeedNodeLeftException.class,
org.elasticsearch.transport.NoSeedNodeLeftException::new,
160,
TransportVersions.V_7_10_0
UNKNOWN_VERSION_ADDED
),
AUTHENTICATION_PROCESSING_ERROR(
org.elasticsearch.ElasticsearchAuthenticationProcessingError.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ static TransportVersion def(int id) {
public static final TransportVersion V_7_8_1 = def(7_08_01_99);
public static final TransportVersion V_7_9_0 = def(7_09_00_99);
public static final TransportVersion V_7_10_0 = def(7_10_00_99);
public static final TransportVersion V_7_10_1 = def(7_10_01_99);
public static final TransportVersion V_7_11_0 = def(7_11_00_99);
public static final TransportVersion V_7_12_0 = def(7_12_00_99);
public static final TransportVersion V_7_13_0 = def(7_13_00_99);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ public NodeInfo(StreamInput in) throws IOException {
addInfoIfNonNull(HttpInfo.class, in.readOptionalWriteable(HttpInfo::new));
addInfoIfNonNull(PluginsAndModules.class, in.readOptionalWriteable(PluginsAndModules::new));
addInfoIfNonNull(IngestInfo.class, in.readOptionalWriteable(IngestInfo::new));
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
addInfoIfNonNull(AggregationInfo.class, in.readOptionalWriteable(AggregationInfo::new));
}
addInfoIfNonNull(AggregationInfo.class, in.readOptionalWriteable(AggregationInfo::new));
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
addInfoIfNonNull(RemoteClusterServerInfo.class, in.readOptionalWriteable(RemoteClusterServerInfo::new));
}
Expand Down Expand Up @@ -285,9 +283,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalWriteable(getInfo(HttpInfo.class));
out.writeOptionalWriteable(getInfo(PluginsAndModules.class));
out.writeOptionalWriteable(getInfo(IngestInfo.class));
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeOptionalWriteable(getInfo(AggregationInfo.class));
}
out.writeOptionalWriteable(getInfo(AggregationInfo.class));
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
out.writeOptionalWriteable(getInfo(RemoteClusterServerInfo.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.common.xcontent.ChunkedToXContent;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.store.StoreStats;
import org.elasticsearch.xcontent.ToXContent;
import org.elasticsearch.xcontent.XContentBuilder;

Expand Down Expand Up @@ -97,9 +96,7 @@ public ClusterInfo(StreamInput in) throws IOException {
this.dataPath = in.getTransportVersion().onOrAfter(DATA_PATH_NEW_KEY_VERSION)
? in.readImmutableMap(NodeAndShard::new, StreamInput::readString)
: in.readImmutableMap(nested -> NodeAndShard.from(new ShardRouting(nested)), StreamInput::readString);
this.reservedSpace = in.getTransportVersion().onOrAfter(StoreStats.RESERVED_BYTES_VERSION)
? in.readImmutableMap(NodeAndPath::new, ReservedSpace::new)
: Map.of();
this.reservedSpace = in.readImmutableMap(NodeAndPath::new, ReservedSpace::new);
}

@Override
Expand All @@ -115,9 +112,7 @@ public void writeTo(StreamOutput out) throws IOException {
} else {
out.writeMap(this.dataPath, (o, k) -> createFakeShardRoutingFromNodeAndShard(k).writeTo(o), StreamOutput::writeString);
}
if (out.getTransportVersion().onOrAfter(StoreStats.RESERVED_BYTES_VERSION)) {
out.writeMap(this.reservedSpace);
}
out.writeMap(this.reservedSpace);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,6 @@ public Iterator<Setting<?>> settings() {

public static final String INDEX_STATE_FILE_PREFIX = "state-";

static final TransportVersion SYSTEM_INDEX_FLAG_ADDED = TransportVersions.V_7_10_0;

static final TransportVersion STATS_AND_FORECAST_ADDED = TransportVersions.V_8_6_0;

private final int routingNumShards;
Expand Down Expand Up @@ -1655,11 +1653,7 @@ private static class IndexMetadataDiff implements Diff<IndexMetadata> {
} else {
mappingsUpdatedVersion = IndexVersions.ZERO;
}
if (in.getTransportVersion().onOrAfter(SYSTEM_INDEX_FLAG_ADDED)) {
isSystem = in.readBoolean();
} else {
isSystem = false;
}
isSystem = in.readBoolean();
timestampRange = IndexLongFieldRange.readFrom(in);
if (in.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
stats = in.readOptionalWriteable(IndexMetadataStats::new);
Expand Down Expand Up @@ -1705,9 +1699,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
IndexVersion.writeVersion(mappingsUpdatedVersion, out);
}
if (out.getTransportVersion().onOrAfter(SYSTEM_INDEX_FLAG_ADDED)) {
out.writeBoolean(isSystem);
}
out.writeBoolean(isSystem);
timestampRange.writeTo(out);
if (out.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
out.writeOptionalWriteable(stats);
Expand Down Expand Up @@ -1814,9 +1806,7 @@ public static IndexMetadata readFrom(StreamInput in, @Nullable Function<String,
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
builder.mappingsUpdatedVersion(IndexVersion.readVersion(in));
}
if (in.getTransportVersion().onOrAfter(SYSTEM_INDEX_FLAG_ADDED)) {
builder.system(in.readBoolean());
}
builder.system(in.readBoolean());
builder.timestampRange(IndexLongFieldRange.readFrom(in));

if (in.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
Expand Down Expand Up @@ -1870,9 +1860,7 @@ public void writeTo(StreamOutput out, boolean mappingsAsHash) throws IOException
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_15_0)) {
IndexVersion.writeVersion(mappingsUpdatedVersion, out);
}
if (out.getTransportVersion().onOrAfter(SYSTEM_INDEX_FLAG_ADDED)) {
out.writeBoolean(isSystem);
}
out.writeBoolean(isSystem);
timestampRange.writeTo(out);
if (out.getTransportVersion().onOrAfter(STATS_AND_FORECAST_ADDED)) {
out.writeOptionalWriteable(stats);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/
package org.elasticsearch.index.query;

import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
Expand Down Expand Up @@ -189,11 +188,7 @@ public InnerHitBuilder(StreamInput in) throws IOException {
highlightBuilder = in.readOptionalWriteable(HighlightBuilder::new);
this.innerCollapseBuilder = in.readOptionalWriteable(CollapseBuilder::new);

if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
if (in.readBoolean()) {
fetchFields = in.readCollectionAsList(FieldAndFormat::new);
}
}
fetchFields = in.readOptionalCollectionAsList(FieldAndFormat::new);
}

@Override
Expand Down Expand Up @@ -228,13 +223,7 @@ public void writeTo(StreamOutput out) throws IOException {
}
out.writeOptionalWriteable(highlightBuilder);
out.writeOptionalWriteable(innerCollapseBuilder);

if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeBoolean(fetchFields != null);
if (fetchFields != null) {
out.writeCollection(fetchFields);
}
}
out.writeOptionalCollection(fetchFields);
}

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,7 @@ public MatchPhrasePrefixQueryBuilder(StreamInput in) throws IOException {
slop = in.readVInt();
maxExpansions = in.readVInt();
analyzer = in.readOptionalString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
this.zeroTermsQuery = ZeroTermsQueryOption.readFromStream(in);
}
zeroTermsQuery = ZeroTermsQueryOption.readFromStream(in);
}

@Override
Expand All @@ -78,9 +76,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeVInt(slop);
out.writeVInt(maxExpansions);
out.writeOptionalString(analyzer);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
zeroTermsQuery.writeTo(out);
}
zeroTermsQuery.writeTo(out);
}

/** Returns the field name used in this query. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,15 @@ public PrefixQueryBuilder(StreamInput in) throws IOException {
fieldName = in.readString();
value = in.readString();
rewrite = in.readOptionalString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
caseInsensitive = in.readBoolean();
}
caseInsensitive = in.readBoolean();
}

@Override
protected void doWriteTo(StreamOutput out) throws IOException {
out.writeString(fieldName);
out.writeString(value);
out.writeOptionalString(rewrite);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeBoolean(caseInsensitive);
}
out.writeBoolean(caseInsensitive);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ public RegexpQueryBuilder(StreamInput in) throws IOException {
syntaxFlagsValue = in.readVInt();
maxDeterminizedStates = in.readVInt();
rewrite = in.readOptionalString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
caseInsensitive = in.readBoolean();
}
caseInsensitive = in.readBoolean();
}

@Override
Expand All @@ -100,9 +98,7 @@ protected void doWriteTo(StreamOutput out) throws IOException {
out.writeVInt(syntaxFlagsValue);
out.writeVInt(maxDeterminizedStates);
out.writeOptionalString(rewrite);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeBoolean(caseInsensitive);
}
out.writeBoolean(caseInsensitive);
}

/** Returns the field name used in this query. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,13 @@ public boolean caseInsensitive() {
*/
public TermQueryBuilder(StreamInput in) throws IOException {
super(in);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
caseInsensitive = in.readBoolean();
}
caseInsensitive = in.readBoolean();
}

@Override
protected void doWriteTo(StreamOutput out) throws IOException {
super.doWriteTo(out);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeBoolean(caseInsensitive);
}
out.writeBoolean(caseInsensitive);
}

public static TermQueryBuilder fromXContent(XContentParser parser) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,15 @@ public WildcardQueryBuilder(StreamInput in) throws IOException {
fieldName = in.readString();
value = in.readString();
rewrite = in.readOptionalString();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
caseInsensitive = in.readBoolean();
}
caseInsensitive = in.readBoolean();
}

@Override
protected void doWriteTo(StreamOutput out) throws IOException {
out.writeString(fieldName);
out.writeString(value);
out.writeOptionalString(rewrite);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeBoolean(caseInsensitive);
}
out.writeBoolean(caseInsensitive);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ public IndexingPressureStats(StreamInput in) throws IOException {
primaryRejections = in.readVLong();
replicaRejections = in.readVLong();

if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
memoryLimit = in.readVLong();
} else {
memoryLimit = -1L;
}
memoryLimit = in.readVLong();

// These are not currently propagated across the network yet
this.totalCoordinatingOps = 0;
Expand Down Expand Up @@ -168,9 +164,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(primaryRejections);
out.writeVLong(replicaRejections);

if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_10_0)) {
out.writeVLong(memoryLimit);
}
out.writeVLong(memoryLimit);

if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_14_0)) {
out.writeVLong(primaryDocumentRejections);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ public class StoreStats implements Writeable, ToXContentFragment {
*/
public static final long UNKNOWN_RESERVED_BYTES = -1L;

public static final TransportVersion RESERVED_BYTES_VERSION = TransportVersions.V_7_9_0;
public static final TransportVersion TOTAL_DATA_SET_SIZE_SIZE_VERSION = TransportVersions.V_7_13_0;

private long sizeInBytes;
Expand All @@ -47,11 +46,7 @@ public StoreStats(StreamInput in) throws IOException {
} else {
totalDataSetSizeInBytes = sizeInBytes;
}
if (in.getTransportVersion().onOrAfter(RESERVED_BYTES_VERSION)) {
reservedSizeInBytes = in.readZLong();
} else {
reservedSizeInBytes = UNKNOWN_RESERVED_BYTES;
}
reservedSizeInBytes = in.readZLong();
}

/**
Expand Down Expand Up @@ -115,9 +110,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getTransportVersion().onOrAfter(TOTAL_DATA_SET_SIZE_SIZE_VERSION)) {
out.writeVLong(totalDataSetSizeInBytes);
}
if (out.getTransportVersion().onOrAfter(RESERVED_BYTES_VERSION)) {
out.writeZLong(reservedSizeInBytes);
}
out.writeZLong(reservedSizeInBytes);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.index.store.StoreStats;
import org.elasticsearch.xcontent.ToXContentFragment;
import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down Expand Up @@ -781,23 +780,13 @@ public RecoveryFilesDetails() {

RecoveryFilesDetails(StreamInput in) throws IOException {
fileDetails = in.readMapValues(FileDetail::new, FileDetail::name);
if (in.getTransportVersion().onOrAfter(StoreStats.RESERVED_BYTES_VERSION)) {
complete = in.readBoolean();
} else {
// This flag is used by disk-based allocation to decide whether the remaining bytes measurement is accurate or not; if not
// then it falls back on an estimate. There's only a very short window in which the file details are present but incomplete
// so this is a reasonable approximation, and the stats reported to the disk-based allocator don't hit this code path
// anyway since they always use IndexShard#getRecoveryState which is never transported over the wire.
complete = fileDetails.isEmpty() == false;
}
complete = in.readBoolean();
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeCollection(values());
if (out.getTransportVersion().onOrAfter(StoreStats.RESERVED_BYTES_VERSION)) {
out.writeBoolean(complete);
}
out.writeBoolean(complete);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,6 @@ public String getType() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_9_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ public int hashCode() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_10_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ protected boolean overrideBucketsPath() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_9_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,6 @@ public String getWriteableName() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_9_0;
return TransportVersions.ZERO;
}
}
Loading

0 comments on commit 67f8e6d

Please sign in to comment.