Skip to content

Commit dd3d794

Browse files
authored
Remove some more Version.transportVersion references (#93913)
1 parent f7ac79f commit dd3d794

File tree

12 files changed

+34
-15
lines changed

12 files changed

+34
-15
lines changed

server/src/main/java/org/elasticsearch/action/bulk/TransportBulkAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ protected void doInternalExecute(Task task, BulkRequest bulkRequest, String exec
264264
}
265265

266266
if (actionRequest instanceof IndexRequest ir) {
267-
ir.checkAutoIdWithOpTypeCreateSupportedByVersion(minNodeVersion.transportVersion);
267+
ir.checkAutoIdWithOpTypeCreateSupportedByVersion(minNodeVersion);
268268
if (ir.getAutoGeneratedTimestamp() != IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP) {
269269
throw new IllegalArgumentException("autoGeneratedTimestamp should not be set externally");
270270
}

server/src/main/java/org/elasticsearch/action/index/IndexRequest.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,18 @@ public void reset() {
654654
public void checkAutoIdWithOpTypeCreateSupportedByVersion(TransportVersion version) {
655655
if (id == null && opType == OpType.CREATE && version.before(TransportVersion.V_7_5_0)) {
656656
throw new IllegalArgumentException(
657-
"optype create not supported for indexing requests without explicit id until all nodes " + "are on version 7.5.0 or higher"
657+
"optype create not supported for indexing requests without explicit id below transport version 7500099, current version "
658+
+ version
659+
);
660+
}
661+
}
662+
663+
public void checkAutoIdWithOpTypeCreateSupportedByVersion(Version version) {
664+
if (id == null && opType == OpType.CREATE && version.before(Version.V_7_5_0)) {
665+
throw new IllegalArgumentException(
666+
"optype create not supported for indexing requests without explicit id until all nodes are on version 7.5.0 or higher,"
667+
+ " current version "
668+
+ version
658669
);
659670
}
660671
}

server/src/main/java/org/elasticsearch/cluster/metadata/RepositoryMetadata.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public long pendingGeneration() {
129129

130130
public RepositoryMetadata(StreamInput in) throws IOException {
131131
name = in.readString();
132-
if (in.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_VERSION.transportVersion)) {
132+
if (in.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_TRANSPORT_VERSION)) {
133133
uuid = in.readString();
134134
} else {
135135
uuid = RepositoryData.MISSING_UUID;
@@ -148,7 +148,7 @@ public RepositoryMetadata(StreamInput in) throws IOException {
148148
@Override
149149
public void writeTo(StreamOutput out) throws IOException {
150150
out.writeString(name);
151-
if (out.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_VERSION.transportVersion)) {
151+
if (out.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_TRANSPORT_VERSION)) {
152152
out.writeString(uuid);
153153
}
154154
out.writeString(type);

server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444

4545
public class RecoverySettings {
4646
public static final Version SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = Version.V_7_15_0;
47+
public static final TransportVersion SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION = TransportVersion.V_7_15_0;
4748
public static final Version SEQ_NO_SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = Version.V_7_16_0;
48-
public static final TransportVersion SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_VERSION = TransportVersion.V_7_16_0;
49+
public static final TransportVersion SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION = TransportVersion.V_7_16_0;
4950

5051
private static final Logger logger = LogManager.getLogger(RecoverySettings.class);
5152

server/src/main/java/org/elasticsearch/indices/recovery/RecoverySnapshotFileRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public RecoverySnapshotFileRequest(StreamInput in) throws IOException {
5050

5151
@Override
5252
public void writeTo(StreamOutput out) throws IOException {
53-
assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_VERSION.transportVersion)
53+
assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)
5454
: "Unexpected serialization version " + out.getTransportVersion();
5555
super.writeTo(out);
5656
out.writeLong(recoveryId);

server/src/main/java/org/elasticsearch/indices/recovery/RecoveryState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ public FileDetail(StreamInput in) throws IOException {
631631
length = in.readVLong();
632632
recovered = in.readVLong();
633633
reused = in.readBoolean();
634-
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_VERSION.transportVersion)) {
634+
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
635635
recoveredFromSnapshot = in.readLong();
636636
}
637637
}
@@ -642,7 +642,7 @@ public void writeTo(StreamOutput out) throws IOException {
642642
out.writeVLong(length);
643643
out.writeVLong(recovered);
644644
out.writeBoolean(reused);
645-
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_VERSION.transportVersion)) {
645+
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
646646
out.writeLong(recoveredFromSnapshot);
647647
}
648648
}

server/src/main/java/org/elasticsearch/indices/recovery/StartRecoveryRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public StartRecoveryRequest(StreamInput in) throws IOException {
4343
metadataSnapshot = Store.MetadataSnapshot.readFrom(in);
4444
primaryRelocation = in.readBoolean();
4545
startingSeqNo = in.readLong();
46-
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_VERSION)) {
46+
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION)) {
4747
canDownloadSnapshotFiles = in.readBoolean();
4848
} else {
4949
canDownloadSnapshotFiles = true;
@@ -134,7 +134,7 @@ public void writeTo(StreamOutput out) throws IOException {
134134
metadataSnapshot.writeTo(out);
135135
out.writeBoolean(primaryRelocation);
136136
out.writeLong(startingSeqNo);
137-
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_VERSION)) {
137+
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION)) {
138138
out.writeBoolean(canDownloadSnapshotFiles);
139139
}
140140
}

server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.apache.logging.log4j.LogManager;
1313
import org.apache.logging.log4j.Logger;
1414
import org.elasticsearch.ExceptionsHelper;
15+
import org.elasticsearch.TransportVersion;
1516
import org.elasticsearch.Version;
1617
import org.elasticsearch.action.ActionListener;
1718
import org.elasticsearch.action.ActionResponse;
@@ -132,6 +133,7 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
132133
public static final Version INDEX_GEN_IN_REPO_DATA_VERSION = Version.V_7_9_0;
133134

134135
public static final Version UUIDS_IN_REPO_DATA_VERSION = Version.V_7_12_0;
136+
public static final TransportVersion UUIDS_IN_REPO_DATA_TRANSPORT_VERSION = TransportVersion.V_7_12_0;
135137

136138
public static final Version FILE_INFO_WRITER_UUIDS_IN_SHARD_DATA_VERSION = Version.V_7_16_0;
137139

server/src/test/java/org/elasticsearch/cluster/routing/IndexRoutingTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.apache.lucene.util.BytesRef;
1111
import org.apache.lucene.util.StringHelper;
1212
import org.elasticsearch.ResourceNotFoundException;
13+
import org.elasticsearch.TransportVersion;
1314
import org.elasticsearch.Version;
1415
import org.elasticsearch.action.RoutingMissingException;
1516
import org.elasticsearch.action.index.IndexRequest;
@@ -68,7 +69,8 @@ public void testSimpleRoutingAssignedRandomId() {
6869
);
6970
IndexRequest req = new IndexRequest();
7071
indexRouting.process(req);
71-
req.checkAutoIdWithOpTypeCreateSupportedByVersion(null);
72+
req.checkAutoIdWithOpTypeCreateSupportedByVersion((Version) null);
73+
req.checkAutoIdWithOpTypeCreateSupportedByVersion((TransportVersion) null);
7274
assertThat(req.id(), not(nullValue()));
7375
assertThat(req.getAutoGeneratedTimestamp(), not(equalTo(IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP)));
7476
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public String toString() {
145145
public static class TaskParams implements PersistentTaskParams, MlTaskParams {
146146

147147
public static final Version VERSION_INTRODUCED = Version.V_7_3_0;
148+
public static final TransportVersion TRANSPORT_VERSION_INTRODUCED = TransportVersion.V_7_3_0;
148149
public static final Version VERSION_DESTINATION_INDEX_MAPPINGS_CHANGED = Version.V_7_10_0;
149150

150151
public static final ConstructingObjectParser<TaskParams, Void> PARSER = new ConstructingObjectParser<>(
@@ -202,7 +203,7 @@ public String getWriteableName() {
202203

203204
@Override
204205
public TransportVersion getMinimalSupportedVersion() {
205-
return VERSION_INTRODUCED.transportVersion;
206+
return TRANSPORT_VERSION_INTRODUCED;
206207
}
207208

208209
@Override

0 commit comments

Comments
 (0)