Skip to content

Commit 40f90fb

Browse files
authored
Remove V_8_0_0 transport version from xpack (#136037)
1 parent fe8ba14 commit 40f90fb

27 files changed

+31
-197
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoRequest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@
66
*/
77
package org.elasticsearch.protocol.xpack;
88

9-
import org.elasticsearch.TransportVersion;
10-
import org.elasticsearch.TransportVersions;
119
import org.elasticsearch.action.ActionRequestValidationException;
1210
import org.elasticsearch.action.LegacyActionRequest;
1311
import org.elasticsearch.common.io.stream.StreamInput;
1412
import org.elasticsearch.common.io.stream.StreamOutput;
15-
import org.elasticsearch.license.License;
1613

1714
import java.io.IOException;
1815
import java.util.EnumSet;
@@ -58,9 +55,6 @@ public XPackInfoRequest(StreamInput in) throws IOException {
5855
categories.add(Category.valueOf(in.readString()));
5956
}
6057
this.categories = categories;
61-
if (hasLicenseVersionField(in.getTransportVersion())) {
62-
int ignoredLicenseVersion = in.readVInt();
63-
}
6458
}
6559

6660
public void setVerbose(boolean verbose) {
@@ -92,12 +86,5 @@ public void writeTo(StreamOutput out) throws IOException {
9286
for (Category category : categories) {
9387
out.writeString(category.name());
9488
}
95-
if (hasLicenseVersionField(out.getTransportVersion())) {
96-
out.writeVInt(License.VERSION_CURRENT);
97-
}
98-
}
99-
100-
private static boolean hasLicenseVersionField(TransportVersion streamVersion) {
101-
return streamVersion.between(TransportVersions.V_7_8_1, TransportVersions.V_8_0_0);
10289
}
10390
}

x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/XPackInfoResponse.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
package org.elasticsearch.protocol.xpack;
88

9-
import org.elasticsearch.TransportVersions;
109
import org.elasticsearch.action.ActionResponse;
1110
import org.elasticsearch.common.Strings;
1211
import org.elasticsearch.common.io.stream.StreamInput;
@@ -328,19 +327,13 @@ public FeatureSet(String name, boolean available, boolean enabled) {
328327

329328
public FeatureSet(StreamInput in) throws IOException {
330329
this(in.readString(), in.readBoolean(), in.readBoolean());
331-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
332-
in.readGenericMap(); // backcompat reading native code info, but no longer used here
333-
}
334330
}
335331

336332
@Override
337333
public void writeTo(StreamOutput out) throws IOException {
338334
out.writeString(name);
339335
out.writeBoolean(available);
340336
out.writeBoolean(enabled);
341-
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
342-
out.writeGenericMap(Collections.emptyMap());
343-
}
344337
}
345338

346339
public String name() {

x-pack/plugin/core/src/main/java/org/elasticsearch/protocol/xpack/graph/GraphExploreRequest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
*/
77
package org.elasticsearch.protocol.xpack.graph;
88

9-
import org.elasticsearch.TransportVersions;
109
import org.elasticsearch.action.ActionRequestValidationException;
1110
import org.elasticsearch.action.IndicesRequest;
1211
import org.elasticsearch.action.LegacyActionRequest;
@@ -111,10 +110,6 @@ public GraphExploreRequest(StreamInput in) throws IOException {
111110

112111
indices = in.readStringArray();
113112
indicesOptions = IndicesOptions.readIndicesOptions(in);
114-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
115-
String[] types = in.readStringArray();
116-
assert types.length == 0;
117-
}
118113
routing = in.readOptionalString();
119114
timeout = in.readOptionalTimeValue();
120115
sampleSize = in.readInt();
@@ -174,9 +169,6 @@ public void writeTo(StreamOutput out) throws IOException {
174169
super.writeTo(out);
175170
out.writeStringArray(indices);
176171
indicesOptions.writeIndicesOptions(out);
177-
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
178-
out.writeStringArray(Strings.EMPTY_ARRAY);
179-
}
180172
out.writeOptionalString(routing);
181173
out.writeOptionalTimeValue(timeout);
182174

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/ExplainLifecycleRequest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
package org.elasticsearch.xpack.core.ilm;
99

10-
import org.elasticsearch.TransportVersions;
1110
import org.elasticsearch.action.ActionRequestValidationException;
1211
import org.elasticsearch.action.IndicesRequest;
1312
import org.elasticsearch.action.support.IndicesOptions;
@@ -51,9 +50,6 @@ public ExplainLifecycleRequest(TimeValue masterTimeout) {
5150
public ExplainLifecycleRequest(StreamInput in) throws IOException {
5251
super(in);
5352
indices = in.readStringArray();
54-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
55-
in.readStringArray();
56-
}
5753
indicesOptions = IndicesOptions.readIndicesOptions(in);
5854
onlyErrors = in.readBoolean();
5955
onlyManaged = in.readBoolean();

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/MlMetadata.java

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77
package org.elasticsearch.xpack.core.ml;
88

99
import org.elasticsearch.TransportVersion;
10-
import org.elasticsearch.TransportVersions;
1110
import org.elasticsearch.cluster.ClusterState;
1211
import org.elasticsearch.cluster.Diff;
13-
import org.elasticsearch.cluster.DiffableUtils;
1412
import org.elasticsearch.cluster.NamedDiff;
1513
import org.elasticsearch.cluster.SimpleDiffable;
1614
import org.elasticsearch.cluster.metadata.Metadata;
@@ -28,12 +26,10 @@
2826
import org.elasticsearch.xpack.core.ml.job.config.Job;
2927

3028
import java.io.IOException;
31-
import java.util.Collections;
3229
import java.util.EnumSet;
3330
import java.util.Iterator;
3431
import java.util.Map;
3532
import java.util.Objects;
36-
import java.util.SortedMap;
3733

3834
public class MlMetadata implements Metadata.ProjectCustom {
3935

@@ -87,28 +83,12 @@ public Diff<Metadata.ProjectCustom> diff(Metadata.ProjectCustom previousState) {
8783
}
8884

8985
public MlMetadata(StreamInput in) throws IOException {
90-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
91-
int size = in.readVInt();
92-
for (int i = 0; i < size; i++) {
93-
in.readString();
94-
new Job(in);
95-
}
96-
size = in.readVInt();
97-
for (int i = 0; i < size; i++) {
98-
in.readString();
99-
new DatafeedConfig(in);
100-
}
101-
}
10286
this.upgradeMode = in.readBoolean();
10387
this.resetMode = in.readBoolean();
10488
}
10589

10690
@Override
10791
public void writeTo(StreamOutput out) throws IOException {
108-
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
109-
writeMap(Collections.emptySortedMap(), out);
110-
writeMap(Collections.emptySortedMap(), out);
111-
}
11292
out.writeBoolean(upgradeMode);
11393
out.writeBoolean(resetMode);
11494
}
@@ -140,15 +120,6 @@ public static class MlMetadataDiff implements NamedDiff<Metadata.ProjectCustom>
140120
}
141121

142122
public MlMetadataDiff(StreamInput in) throws IOException {
143-
if (in.getTransportVersion().before(TransportVersions.V_8_0_0)) {
144-
DiffableUtils.readJdkMapDiff(in, DiffableUtils.getStringKeySerializer(), Job::new, MlMetadataDiff::readJobDiffFrom);
145-
DiffableUtils.readJdkMapDiff(
146-
in,
147-
DiffableUtils.getStringKeySerializer(),
148-
DatafeedConfig::new,
149-
MlMetadataDiff::readDatafeedDiffFrom
150-
);
151-
}
152123
upgradeMode = in.readBoolean();
153124
resetMode = in.readBoolean();
154125
}
@@ -165,12 +136,6 @@ public Metadata.ProjectCustom apply(Metadata.ProjectCustom part) {
165136

166137
@Override
167138
public void writeTo(StreamOutput out) throws IOException {
168-
if (out.getTransportVersion().before(TransportVersions.V_8_0_0)) {
169-
SortedMap<String, Job> jobs = Collections.emptySortedMap();
170-
DiffableUtils.diff(jobs, jobs, DiffableUtils.getStringKeySerializer()).writeTo(out);
171-
SortedMap<String, DatafeedConfig> datafeeds = Collections.emptySortedMap();
172-
DiffableUtils.diff(datafeeds, datafeeds, DiffableUtils.getStringKeySerializer()).writeTo(out);
173-
}
174139
out.writeBoolean(upgradeMode);
175140
out.writeBoolean(resetMode);
176141
}

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/GetTrainedModelsStatsAction.java

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package org.elasticsearch.xpack.core.ml.action;
88

99
import org.elasticsearch.ElasticsearchException;
10-
import org.elasticsearch.TransportVersions;
1110
import org.elasticsearch.action.ActionType;
1211
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -110,19 +109,11 @@ public TrainedModelStats(
110109

111110
public TrainedModelStats(StreamInput in) throws IOException {
112111
modelId = in.readString();
113-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
114-
modelSizeStats = in.readOptionalWriteable(TrainedModelSizeStats::new);
115-
} else {
116-
modelSizeStats = null;
117-
}
112+
modelSizeStats = in.readOptionalWriteable(TrainedModelSizeStats::new);
118113
ingestStats = IngestStats.read(in);
119114
pipelineCount = in.readVInt();
120115
inferenceStats = in.readOptionalWriteable(InferenceStats::new);
121-
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
122-
this.deploymentStats = in.readOptionalWriteable(AssignmentStats::new);
123-
} else {
124-
this.deploymentStats = null;
125-
}
116+
this.deploymentStats = in.readOptionalWriteable(AssignmentStats::new);
126117
}
127118

128119
public String getModelId() {
@@ -174,15 +165,11 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws
174165
@Override
175166
public void writeTo(StreamOutput out) throws IOException {
176167
out.writeString(modelId);
177-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
178-
out.writeOptionalWriteable(modelSizeStats);
179-
}
168+
out.writeOptionalWriteable(modelSizeStats);
180169
ingestStats.writeTo(out);
181170
out.writeVInt(pipelineCount);
182171
out.writeOptionalWriteable(inferenceStats);
183-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
184-
out.writeOptionalWriteable(deploymentStats);
185-
}
172+
out.writeOptionalWriteable(deploymentStats);
186173
}
187174

188175
@Override

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/datafeed/AggProvider.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import org.apache.logging.log4j.LogManager;
1010
import org.apache.logging.log4j.Logger;
11-
import org.elasticsearch.TransportVersions;
1211
import org.elasticsearch.common.io.stream.StreamInput;
1312
import org.elasticsearch.common.io.stream.StreamOutput;
1413
import org.elasticsearch.common.io.stream.Writeable;
@@ -117,7 +116,7 @@ static AggProvider fromStream(StreamInput in) throws IOException {
117116
in.readGenericMap(),
118117
in.readOptionalWriteable(AggregatorFactories.Builder::new),
119118
in.readException(),
120-
in.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0) ? in.readBoolean() : false
119+
in.readBoolean()
121120
);
122121
}
123122

@@ -140,9 +139,7 @@ public void writeTo(StreamOutput out) throws IOException {
140139
out.writeGenericMap(aggs);
141140
out.writeOptionalWriteable(parsedAggs);
142141
out.writeException(parsingException);
143-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
144-
out.writeBoolean(rewroteAggs);
145-
}
142+
out.writeBoolean(rewroteAggs);
146143
}
147144

148145
public Exception getParsingException() {

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/TrainedModelConfig.java

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public class TrainedModelConfig implements ToXContentObject, Writeable {
104104
public static final ParseField PER_ALLOCATION_MEMORY_BYTES = new ParseField("per_allocation_memory_bytes");
105105
public static final ParseField PLATFORM_ARCHITECTURE = new ParseField("platform_architecture");
106106

107-
public static final TransportVersion VERSION_3RD_PARTY_CONFIG_ADDED = TransportVersions.V_8_0_0;
108107
public static final TransportVersion VERSION_ALLOCATION_MEMORY_ADDED = TransportVersions.V_8_11_X;
109108

110109
// These parsers follow the pattern that metadata is parsed leniently (to allow for enhancements), whilst config is parsed strictly
@@ -278,13 +277,8 @@ public TrainedModelConfig(StreamInput in) throws IOException {
278277
this.defaultFieldMap = in.readBoolean() ? in.readImmutableMap(StreamInput::readString) : null;
279278

280279
this.inferenceConfig = in.readOptionalNamedWriteable(InferenceConfig.class);
281-
if (in.getTransportVersion().onOrAfter(VERSION_3RD_PARTY_CONFIG_ADDED)) {
282-
this.modelType = in.readOptionalEnum(TrainedModelType.class);
283-
this.location = in.readOptionalNamedWriteable(TrainedModelLocation.class);
284-
} else {
285-
this.modelType = null;
286-
this.location = null;
287-
}
280+
this.modelType = in.readOptionalEnum(TrainedModelType.class);
281+
this.location = in.readOptionalNamedWriteable(TrainedModelLocation.class);
288282
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
289283
modelPackageConfig = in.readOptionalWriteable(ModelPackageConfig::new);
290284
fullDefinition = in.readOptionalBoolean();
@@ -471,10 +465,8 @@ public void writeTo(StreamOutput out) throws IOException {
471465
out.writeBoolean(false);
472466
}
473467
out.writeOptionalNamedWriteable(inferenceConfig);
474-
if (out.getTransportVersion().onOrAfter(VERSION_3RD_PARTY_CONFIG_ADDED)) {
475-
out.writeOptionalEnum(modelType);
476-
out.writeOptionalNamedWriteable(location);
477-
}
468+
out.writeOptionalEnum(modelType);
469+
out.writeOptionalNamedWriteable(location);
478470

479471
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
480472
out.writeOptionalWriteable(modelPackageConfig);
@@ -1094,11 +1086,7 @@ public static LazyModelDefinition fromBase64String(String base64String) {
10941086
}
10951087

10961088
public static LazyModelDefinition fromStreamInput(StreamInput input) throws IOException {
1097-
if (input.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
1098-
return new LazyModelDefinition(input.readBytesReference(), null);
1099-
} else {
1100-
return fromBase64String(input.readString());
1101-
}
1089+
return new LazyModelDefinition(input.readBytesReference(), null);
11021090
}
11031091

11041092
private LazyModelDefinition(LazyModelDefinition definition) {
@@ -1158,11 +1146,7 @@ private void ensureParsedDefinitionUnsafe(NamedXContentRegistry xContentRegistry
11581146

11591147
@Override
11601148
public void writeTo(StreamOutput out) throws IOException {
1161-
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_0_0)) {
1162-
out.writeBytesReference(getCompressedDefinition());
1163-
} else {
1164-
out.writeString(getBase64CompressedDefinition());
1165-
}
1149+
out.writeBytesReference(getCompressedDefinition());
11661150
}
11671151

11681152
@Override

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/assignment/TrainedModelAssignmentMetadata.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.elasticsearch.ResourceAlreadyExistsException;
1111
import org.elasticsearch.ResourceNotFoundException;
1212
import org.elasticsearch.TransportVersion;
13-
import org.elasticsearch.TransportVersions;
1413
import org.elasticsearch.cluster.ClusterState;
1514
import org.elasticsearch.cluster.Diff;
1615
import org.elasticsearch.cluster.DiffableUtils;
@@ -156,7 +155,7 @@ public String getWriteableName() {
156155

157156
@Override
158157
public TransportVersion getMinimalSupportedVersion() {
159-
return TransportVersions.V_8_0_0;
158+
return TransportVersion.minimumCompatible();
160159
}
161160

162161
@Override
@@ -321,7 +320,7 @@ public String getWriteableName() {
321320

322321
@Override
323322
public TransportVersion getMinimalSupportedVersion() {
324-
return TransportVersions.V_8_0_0;
323+
return TransportVersion.minimumCompatible();
325324
}
326325

327326
@Override

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/FillMaskConfig.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
package org.elasticsearch.xpack.core.ml.inference.trainedmodel;
99

1010
import org.elasticsearch.TransportVersion;
11-
import org.elasticsearch.TransportVersions;
1211
import org.elasticsearch.common.Strings;
1312
import org.elasticsearch.common.io.stream.StreamInput;
1413
import org.elasticsearch.common.io.stream.StreamOutput;
@@ -162,7 +161,7 @@ public MlConfigVersion getMinimalSupportedMlConfigVersion() {
162161

163162
@Override
164163
public TransportVersion getMinimalSupportedTransportVersion() {
165-
return TransportVersions.V_8_0_0;
164+
return TransportVersion.minimumCompatible();
166165
}
167166

168167
@Override

0 commit comments

Comments
 (0)