Skip to content

Commit

Permalink
Remove various references to 7.0 and 7.1 transport versions (elastic#…
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop authored Dec 11, 2024
1 parent 1e5d9b9 commit 368d471
Show file tree
Hide file tree
Showing 21 changed files with 23 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.Iterators;
Expand Down Expand Up @@ -131,9 +130,7 @@ public TimeValue getTook() {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeArray(items);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_0_0)) {
out.writeVLong(tookInMillis);
}
out.writeVLong(tookInMillis);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,7 @@ private enum ElasticsearchExceptionHandle {
org.elasticsearch.cluster.coordination.CoordinationStateRejectedException.class,
org.elasticsearch.cluster.coordination.CoordinationStateRejectedException::new,
150,
TransportVersions.V_7_0_0
UNKNOWN_VERSION_ADDED
),
SNAPSHOT_IN_PROGRESS_EXCEPTION(
org.elasticsearch.snapshots.SnapshotInProgressException.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static TransportVersion def(int id) {
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // remove the transport versions with which v9 will not need to interact
public static final TransportVersion ZERO = def(0);
public static final TransportVersion V_7_0_0 = def(7_00_00_99);
public static final TransportVersion V_7_0_1 = def(7_00_01_99);
public static final TransportVersion V_7_2_0 = def(7_02_00_99);
public static final TransportVersion V_7_2_1 = def(7_02_01_99);
public static final TransportVersion V_7_3_0 = def(7_03_00_99);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ public String getType() {

@Override
public TransportVersion getMinimalSupportedVersion() {
return TransportVersions.V_7_0_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public void testSearchContextMissingException() throws IOException {
public void testCircuitBreakingException() throws IOException {
CircuitBreakingException ex = serialize(
new CircuitBreakingException("Too large", 0, 100, CircuitBreaker.Durability.TRANSIENT),
TransportVersions.V_7_0_0
TransportVersions.V_8_0_0
);
assertEquals("Too large", ex.getMessage());
assertEquals(100, ex.getByteLimit());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1299,7 +1299,7 @@ public void testBuildIndexMetadataWithTransportVersionBeforeEventIngestedRangeAd
4,
sourceIndexMetadata,
false,
randomFrom(TransportVersions.V_7_0_0, TransportVersions.V_8_0_0)
TransportVersions.V_8_0_0
);

assertThat(indexMetadata.getAliases().size(), is(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void testClusterStateSerialization() throws Exception {

public void testClusterStateSerializationWithTimestampRangesWithOlderTransportVersion() throws Exception {
TransportVersion versionBeforeEventIngestedInClusterState = randomFrom(
TransportVersions.V_7_0_0,
TransportVersions.V_8_0_0,
TransportVersionUtils.getPreviousVersion(TransportVersions.V_8_15_0)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ public void testMissingValue() throws Exception {

public void testReadWriteArray() throws IOException {
BytesStreamOutput output = new BytesStreamOutput();
output.setTransportVersion(randomFrom(TransportVersion.current(), TransportVersions.V_7_0_0));
output.setTransportVersion(randomFrom(TransportVersion.current(), TransportVersions.V_8_0_0));
Settings settings = Settings.builder().putList("foo.bar", "0", "1", "2", "3").put("foo.bar.baz", "baz").build();
settings.writeTo(output);
StreamInput in = StreamInput.wrap(BytesReference.toBytes(output.bytes()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public Usage(StreamInput in) throws IOException {

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

public int getNumberOfFollowerIndices() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public GraphFeatureSetUsage(boolean available, boolean enabled) {

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public IndexLifecycleFeatureSetUsage(StreamInput input) throws IOException {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public LogstashFeatureSetUsage(boolean available) {

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public MachineLearningFeatureSetUsage(StreamInput in) throws IOException {

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public MonitoringFeatureSetUsage(boolean collectionEnabled, Map<String, Object>

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

public Map<String, Object> getExporters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected void innerXContent(XContentBuilder builder, Params params) throws IOEx

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public SecurityFeatureSetUsage(

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package org.elasticsearch.xpack.core.security.authc.support.mapper;

import org.apache.logging.log4j.Logger;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
Expand Down Expand Up @@ -139,11 +138,7 @@ public ExpressionRoleMapping(StreamInput in) throws IOException {
this.name = in.readString();
this.enabled = in.readBoolean();
this.roles = in.readStringCollectionAsList();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
this.roleTemplates = in.readCollectionAsList(TemplateRoleName::new);
} else {
this.roleTemplates = Collections.emptyList();
}
this.roleTemplates = in.readCollectionAsList(TemplateRoleName::new);
this.expression = ExpressionParser.readExpression(in);
this.metadata = in.readGenericMap();
}
Expand Down Expand Up @@ -175,9 +170,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
out.writeBoolean(enabled);
out.writeStringCollection(roles);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_2_0)) {
out.writeCollection(roleTemplates);
}
out.writeCollection(roleTemplates);
ExpressionParser.writeExpression(expression, out);
out.writeGenericMap(metadata);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public SqlFeatureSetUsage(Map<String, Object> stats) {

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

public Map<String, Object> stats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public WatcherFeatureSetUsage(boolean available, boolean enabled, Map<String, Ob

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

public Map<String, Object> stats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ public class TransportVersionUtilsTests extends ESTestCase {

private static final Map<String, CompatibilityVersions> transportVersions = Map.of(
"Alfredo",
new CompatibilityVersions(TransportVersions.V_7_0_0, Map.of()),
new CompatibilityVersions(TransportVersions.V_8_1_0, Map.of()),
"Bertram",
new CompatibilityVersions(TransportVersions.V_7_0_1, Map.of()),
new CompatibilityVersions(TransportVersions.V_8_6_0, Map.of()),
"Charles",
new CompatibilityVersions(TransportVersions.V_8_9_X, Map.of()),
"Dominic",
Expand All @@ -48,7 +48,7 @@ public class TransportVersionUtilsTests extends ESTestCase {
);

public void testGetMinTransportVersion() {
assertThat(TransportVersionUtils.getMinTransportVersion(state), equalTo(TransportVersions.V_7_0_0));
assertThat(TransportVersionUtils.getMinTransportVersion(state), equalTo(TransportVersions.V_8_0_0));
}

public void testIsMinTransformVersionSameAsCurrent() {
Expand Down Expand Up @@ -78,7 +78,7 @@ public void testIsMinTransformVersionSameAsCurrent() {
}

public void testIsMinTransportVersionOnOrAfter() {
assertThat(TransportVersionUtils.isMinTransportVersionOnOrAfter(state, TransportVersions.V_7_0_0), equalTo(true));
assertThat(TransportVersionUtils.isMinTransportVersionOnOrAfter(state, TransportVersions.V_8_0_0), equalTo(true));
assertThat(TransportVersionUtils.isMinTransportVersionOnOrAfter(state, TransportVersions.V_8_9_X), equalTo(false));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
package org.elasticsearch.xpack.security.authc.support.mapper;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesArray;
Expand Down Expand Up @@ -408,29 +407,7 @@ public void testToXContentWithTemplates() throws Exception {
public void testSerialization() throws Exception {
final ExpressionRoleMapping original = randomRoleMapping(true);

TransportVersion version = TransportVersionUtils.randomVersionBetween(random(), TransportVersions.V_7_2_0, null);
BytesStreamOutput output = new BytesStreamOutput();
output.setTransportVersion(version);
original.writeTo(output);

final NamedWriteableRegistry registry = new NamedWriteableRegistry(new XPackClientPlugin().getNamedWriteables());
StreamInput streamInput = new NamedWriteableAwareStreamInput(
ByteBufferStreamInput.wrap(BytesReference.toBytes(output.bytes())),
registry
);
streamInput.setTransportVersion(version);
final ExpressionRoleMapping serialized = new ExpressionRoleMapping(streamInput);
assertEquals(original, serialized);
}

public void testSerializationPreV71() throws Exception {
final ExpressionRoleMapping original = randomRoleMapping(false);

TransportVersion version = TransportVersionUtils.randomVersionBetween(
random(),
TransportVersions.V_7_0_0,
TransportVersions.V_7_0_1
);
TransportVersion version = TransportVersionUtils.randomCompatibleVersion(random());
BytesStreamOutput output = new BytesStreamOutput();
output.setTransportVersion(version);
original.writeTo(output);
Expand Down

0 comments on commit 368d471

Please sign in to comment.