Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ protected void doInternalExecute(Task task, BulkRequest bulkRequest, String exec
}

if (actionRequest instanceof IndexRequest ir) {
ir.checkAutoIdWithOpTypeCreateSupportedByVersion(minNodeVersion.transportVersion);
ir.checkAutoIdWithOpTypeCreateSupportedByVersion(minNodeVersion);
if (ir.getAutoGeneratedTimestamp() != IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP) {
throw new IllegalArgumentException("autoGeneratedTimestamp should not be set externally");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,18 @@ public void reset() {
public void checkAutoIdWithOpTypeCreateSupportedByVersion(TransportVersion version) {
if (id == null && opType == OpType.CREATE && version.before(TransportVersion.V_7_5_0)) {
throw new IllegalArgumentException(
"optype create not supported for indexing requests without explicit id until all nodes " + "are on version 7.5.0 or higher"
"optype create not supported for indexing requests without explicit id below transport version 7500099, current version "
+ version
);
}
}

public void checkAutoIdWithOpTypeCreateSupportedByVersion(Version version) {
if (id == null && opType == OpType.CREATE && version.before(Version.V_7_5_0)) {
throw new IllegalArgumentException(
"optype create not supported for indexing requests without explicit id until all nodes are on version 7.5.0 or higher,"
+ " current version "
+ version
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public long pendingGeneration() {

public RepositoryMetadata(StreamInput in) throws IOException {
name = in.readString();
if (in.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_VERSION.transportVersion)) {
if (in.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_TRANSPORT_VERSION)) {
uuid = in.readString();
} else {
uuid = RepositoryData.MISSING_UUID;
Expand All @@ -148,7 +148,7 @@ public RepositoryMetadata(StreamInput in) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeString(name);
if (out.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_VERSION.transportVersion)) {
if (out.getTransportVersion().onOrAfter(SnapshotsService.UUIDS_IN_REPO_DATA_TRANSPORT_VERSION)) {
out.writeString(uuid);
}
out.writeString(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@

public class RecoverySettings {
public static final Version SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = Version.V_7_15_0;
public static final TransportVersion SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION = TransportVersion.V_7_15_0;
public static final Version SEQ_NO_SNAPSHOT_RECOVERIES_SUPPORTED_VERSION = Version.V_7_16_0;
public static final TransportVersion SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_VERSION = TransportVersion.V_7_16_0;
public static final TransportVersion SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION = TransportVersion.V_7_16_0;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public RecoverySnapshotFileRequest(StreamInput in) throws IOException {

@Override
public void writeTo(StreamOutput out) throws IOException {
assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_VERSION.transportVersion)
assert out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)
: "Unexpected serialization version " + out.getTransportVersion();
super.writeTo(out);
out.writeLong(recoveryId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ public FileDetail(StreamInput in) throws IOException {
length = in.readVLong();
recovered = in.readVLong();
reused = in.readBoolean();
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_VERSION.transportVersion)) {
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
recoveredFromSnapshot = in.readLong();
}
}
Expand All @@ -642,7 +642,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(length);
out.writeVLong(recovered);
out.writeBoolean(reused);
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_VERSION.transportVersion)) {
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_RECOVERIES_SUPPORTED_TRANSPORT_VERSION)) {
out.writeLong(recoveredFromSnapshot);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public StartRecoveryRequest(StreamInput in) throws IOException {
metadataSnapshot = Store.MetadataSnapshot.readFrom(in);
primaryRelocation = in.readBoolean();
startingSeqNo = in.readLong();
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_VERSION)) {
if (in.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION)) {
canDownloadSnapshotFiles = in.readBoolean();
} else {
canDownloadSnapshotFiles = true;
Expand Down Expand Up @@ -134,7 +134,7 @@ public void writeTo(StreamOutput out) throws IOException {
metadataSnapshot.writeTo(out);
out.writeBoolean(primaryRelocation);
out.writeLong(startingSeqNo);
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_VERSION)) {
if (out.getTransportVersion().onOrAfter(RecoverySettings.SNAPSHOT_FILE_DOWNLOAD_THROTTLING_SUPPORTED_TRANSPORT_VERSION)) {
out.writeBoolean(canDownloadSnapshotFiles);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionResponse;
Expand Down Expand Up @@ -132,6 +133,7 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
public static final Version INDEX_GEN_IN_REPO_DATA_VERSION = Version.V_7_9_0;

public static final Version UUIDS_IN_REPO_DATA_VERSION = Version.V_7_12_0;
public static final TransportVersion UUIDS_IN_REPO_DATA_TRANSPORT_VERSION = TransportVersion.V_7_12_0;

public static final Version FILE_INFO_WRITER_UUIDS_IN_SHARD_DATA_VERSION = Version.V_7_16_0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.StringHelper;
import org.elasticsearch.ResourceNotFoundException;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.action.RoutingMissingException;
import org.elasticsearch.action.index.IndexRequest;
Expand Down Expand Up @@ -68,7 +69,8 @@ public void testSimpleRoutingAssignedRandomId() {
);
IndexRequest req = new IndexRequest();
indexRouting.process(req);
req.checkAutoIdWithOpTypeCreateSupportedByVersion(null);
req.checkAutoIdWithOpTypeCreateSupportedByVersion((Version) null);
req.checkAutoIdWithOpTypeCreateSupportedByVersion((TransportVersion) null);
assertThat(req.id(), not(nullValue()));
assertThat(req.getAutoGeneratedTimestamp(), not(equalTo(IndexRequest.UNSET_AUTO_GENERATED_TIMESTAMP)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public String toString() {
public static class TaskParams implements PersistentTaskParams, MlTaskParams {

public static final Version VERSION_INTRODUCED = Version.V_7_3_0;
public static final TransportVersion TRANSPORT_VERSION_INTRODUCED = TransportVersion.V_7_3_0;
public static final Version VERSION_DESTINATION_INDEX_MAPPINGS_CHANGED = Version.V_7_10_0;

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

@Override
public TransportVersion getMinimalSupportedVersion() {
return VERSION_INTRODUCED.transportVersion;
return TRANSPORT_VERSION_INTRODUCED;
}

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

package org.elasticsearch.xpack.ql.index;

import org.elasticsearch.TransportVersion;
import org.elasticsearch.Version;
import org.elasticsearch.core.Nullable;
import org.elasticsearch.xpack.ql.type.DataType;
Expand All @@ -19,6 +20,7 @@
public final class VersionCompatibilityChecks {

public static final Version INTRODUCING_UNSIGNED_LONG = V_8_2_0;
public static final TransportVersion INTRODUCING_UNSIGNED_LONG_TRANSPORT = TransportVersion.V_8_2_0;
public static final Version INTRODUCING_VERSION_FIELD_TYPE = V_8_4_0;

private VersionCompatibilityChecks() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Map;
import java.util.Objects;

import static org.elasticsearch.xpack.ql.index.VersionCompatibilityChecks.INTRODUCING_UNSIGNED_LONG;
import static org.elasticsearch.xpack.ql.index.VersionCompatibilityChecks.INTRODUCING_UNSIGNED_LONG_TRANSPORT;
import static org.elasticsearch.xpack.ql.type.DataTypeConverter.toUnsignedLong;
import static org.elasticsearch.xpack.ql.type.DataTypes.DATETIME;
import static org.elasticsearch.xpack.ql.type.DataTypes.NULL;
Expand Down Expand Up @@ -54,7 +54,7 @@ public CompositeKeyExtractor(String key, Property property, ZoneId zoneId, DataT
CompositeKeyExtractor(StreamInput in) throws IOException {
key = in.readString();
property = in.readEnum(Property.class);
if (in.getTransportVersion().onOrAfter(INTRODUCING_UNSIGNED_LONG.transportVersion)) {
if (in.getTransportVersion().onOrAfter(INTRODUCING_UNSIGNED_LONG_TRANSPORT)) {
dataType = SqlDataTypes.fromTypeName(in.readString());
} else {
// for pre-UNSIGNED_LONG versions, the only relevant fact about the dataType was if this isDateBased() or not.
Expand All @@ -68,7 +68,7 @@ public CompositeKeyExtractor(String key, Property property, ZoneId zoneId, DataT
public void writeTo(StreamOutput out) throws IOException {
out.writeString(key);
out.writeEnum(property);
if (out.getTransportVersion().onOrAfter((INTRODUCING_UNSIGNED_LONG.transportVersion))) {
if (out.getTransportVersion().onOrAfter(INTRODUCING_UNSIGNED_LONG_TRANSPORT)) {
out.writeString(dataType.typeName());
} else {
out.writeBoolean(isDateBased(dataType));
Expand Down