Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Transform] remove old mixed cluster BWC layers, not required for 8x #79927

Merged
merged 5 commits into from
Oct 28, 2021
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 @@ -6,7 +6,6 @@
*/
package org.elasticsearch.xpack.core.transform.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
Expand Down Expand Up @@ -42,11 +41,7 @@ public Request(String id, boolean force, TimeValue timeout) {
public Request(StreamInput in) throws IOException {
super(in);
id = in.readString();
if (in.getVersion().onOrAfter(Version.V_7_4_0)) {
force = in.readBoolean();
} else {
force = false;
}
force = in.readBoolean();
}

public String getId() {
Expand All @@ -61,9 +56,7 @@ public boolean isForce() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(id);
if (out.getVersion().onOrAfter(Version.V_7_4_0)) {
out.writeBoolean(force);
}
out.writeBoolean(force);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.elasticsearch.xpack.core.transform.action;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.TaskOperationFailure;
Expand Down Expand Up @@ -66,9 +65,7 @@ public Request(StreamInput in) throws IOException {
id = in.readString();
expandedIds = Collections.unmodifiableList(in.readStringList());
pageParams = new PageParams(in);
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
allowNoMatch = in.readBoolean();
}
allowNoMatch = in.readBoolean();
}

@Override
Expand Down Expand Up @@ -112,9 +109,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeString(id);
out.writeStringCollection(expandedIds);
pageParams.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
out.writeBoolean(allowNoMatch);
}
out.writeBoolean(allowNoMatch);
}

@Override
Expand Down Expand Up @@ -178,12 +173,7 @@ private Response(

public Response(StreamInput in) throws IOException {
super(in);
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
transformsStats = new QueryPage<>(in, TransformStats::new);
} else {
List<TransformStats> stats = in.readList(TransformStats::new);
transformsStats = new QueryPage<>(stats, stats.size(), TransformField.TRANSFORMS);
}
transformsStats = new QueryPage<>(in, TransformStats::new);
}

public List<TransformStats> getTransformsStats() {
Expand All @@ -197,11 +187,7 @@ public long getCount() {
@Override
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
transformsStats.writeTo(out);
} else {
out.writeList(transformsStats.results());
}
transformsStats.writeTo(out);
}

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

package org.elasticsearch.xpack.core.transform.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ActionType;
Expand Down Expand Up @@ -177,14 +176,7 @@ public Response(StreamInput in) throws IOException {
for (int i = 0; i < size; i++) {
this.docs.add(in.readMap());
}
if (in.getVersion().onOrAfter(Version.V_7_7_0)) {
this.generatedDestIndexSettings = new TransformDestIndexSettings(in);
} else if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
Map<String, Object> objectMap = in.readMap();
this.generatedDestIndexSettings = new TransformDestIndexSettings(objectMap, null, null);
} else {
this.generatedDestIndexSettings = new TransformDestIndexSettings(null, null, null);
}
this.generatedDestIndexSettings = new TransformDestIndexSettings(in);
}

public List<Map<String, Object>> getDocs() {
Expand All @@ -201,11 +193,7 @@ public void writeTo(StreamOutput out) throws IOException {
for (Map<String, Object> doc : docs) {
out.writeMapWithConsistentOrder(doc);
}
if (out.getVersion().onOrAfter(Version.V_7_7_0)) {
generatedDestIndexSettings.writeTo(out);
} else if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
out.writeMap(generatedDestIndexSettings.getMappings());
}
generatedDestIndexSettings.writeTo(out);
}

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

package org.elasticsearch.xpack.core.transform.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
Expand Down Expand Up @@ -53,11 +52,7 @@ public Request(TransformConfig config, boolean deferValidation, TimeValue timeou
public Request(StreamInput in) throws IOException {
super(in);
this.config = new TransformConfig(in);
if (in.getVersion().onOrAfter(Version.V_7_4_0)) {
this.deferValidation = in.readBoolean();
} else {
this.deferValidation = false;
}
this.deferValidation = in.readBoolean();
}

public static Request fromXContent(
Expand Down Expand Up @@ -122,9 +117,7 @@ public boolean isDeferValidation() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
this.config.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_7_4_0)) {
out.writeBoolean(this.deferValidation);
}
out.writeBoolean(this.deferValidation);
}

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

package org.elasticsearch.xpack.core.transform.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.master.AcknowledgedRequest;
Expand Down Expand Up @@ -45,9 +44,6 @@ public Request(String id, TimeValue timeout) {
public Request(StreamInput in) throws IOException {
super(in);
id = in.readString();
if (in.getVersion().before(Version.V_7_5_0)) {
in.readBoolean();
}
}

public String getId() {
Expand All @@ -58,9 +54,6 @@ public String getId() {
public void writeTo(StreamOutput out) throws IOException {
super.writeTo(out);
out.writeString(id);
if (out.getVersion().before(Version.V_7_5_0)) {
out.writeBoolean(false);
}
}

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

import org.apache.logging.log4j.message.ParameterizedMessage;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.TaskOperationFailure;
Expand Down Expand Up @@ -81,16 +80,8 @@ public Request(StreamInput in) throws IOException {
if (in.readBoolean()) {
expandedIds = new HashSet<>(Arrays.asList(in.readStringArray()));
}
if (in.getVersion().onOrAfter(Version.V_7_3_0)) {
this.allowNoMatch = in.readBoolean();
} else {
this.allowNoMatch = true;
}
if (in.getVersion().onOrAfter(Version.V_7_6_0)) {
this.waitForCheckpoint = in.readBoolean();
} else {
this.waitForCheckpoint = false;
}
this.allowNoMatch = in.readBoolean();
this.waitForCheckpoint = in.readBoolean();
}

public String getId() {
Expand Down Expand Up @@ -132,12 +123,8 @@ public void writeTo(StreamOutput out) throws IOException {
if (hasExpandedIds) {
out.writeStringArray(expandedIds.toArray(new String[0]));
}
if (out.getVersion().onOrAfter(Version.V_7_3_0)) {
out.writeBoolean(allowNoMatch);
}
if (out.getVersion().onOrAfter(Version.V_7_6_0)) {
out.writeBoolean(waitForCheckpoint);
}
out.writeBoolean(allowNoMatch);
out.writeBoolean(waitForCheckpoint);
}

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

package org.elasticsearch.xpack.core.transform.action;

import org.elasticsearch.Version;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionType;
import org.elasticsearch.action.support.tasks.BaseTasksRequest;
Expand All @@ -20,7 +19,6 @@
import org.elasticsearch.xcontent.XContentParser;
import org.elasticsearch.xpack.core.common.validation.SourceDestValidator;
import org.elasticsearch.xpack.core.transform.TransformField;
import org.elasticsearch.xpack.core.transform.action.compat.UpdateTransformActionPre78;
import org.elasticsearch.xpack.core.transform.transforms.TransformConfig;
import org.elasticsearch.xpack.core.transform.transforms.TransformConfigUpdate;

Expand Down Expand Up @@ -56,8 +54,7 @@ public Request(TransformConfigUpdate update, String id, boolean deferValidation,
this.setTimeout(timeout);
}

// use fromStreamWithBWC, this can be changed back to public after BWC is not required anymore
private Request(StreamInput in) throws IOException {
public Request(StreamInput in) throws IOException {
super(in);
this.update = new TransformConfigUpdate(in);
this.id = in.readString();
Expand All @@ -67,14 +64,6 @@ private Request(StreamInput in) throws IOException {
}
}

public static Request fromStreamWithBWC(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_7_8_0)) {
return new Request(in);
}
UpdateTransformActionPre78.Request r = new UpdateTransformActionPre78.Request(in);
return new Request(r.getUpdate(), r.getId(), r.isDeferValidation(), r.timeout());
}

public static Request fromXContent(
final XContentParser parser,
final String id,
Expand Down Expand Up @@ -137,22 +126,16 @@ public void setConfig(TransformConfig config) {

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_7_8_0)) {
super.writeTo(out);
update.writeTo(out);
out.writeString(id);
out.writeBoolean(deferValidation);
if (config == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
config.writeTo(out);
}
return;
super.writeTo(out);
update.writeTo(out);
out.writeString(id);
out.writeBoolean(deferValidation);
if (config == null) {
out.writeBoolean(false);
} else {
out.writeBoolean(true);
config.writeTo(out);
}

UpdateTransformActionPre78.Request r = new UpdateTransformActionPre78.Request(update, id, deferValidation);
r.writeTo(out);
}

@Override
Expand Down Expand Up @@ -190,34 +173,19 @@ public Response(TransformConfig config) {
this.config = config;
}

// use fromStreamWithBWC, this can be changed back to public after BWC is not required anymore
private Response(StreamInput in) throws IOException {
public Response(StreamInput in) throws IOException {
super(in);
this.config = new TransformConfig(in);
}

public static Response fromStreamWithBWC(StreamInput in) throws IOException {
if (in.getVersion().onOrAfter(Version.V_7_8_0)) {
return new Response(in);
}
UpdateTransformActionPre78.Response r = new UpdateTransformActionPre78.Response(in);
return new Response(r.getConfig());
}

public TransformConfig getConfig() {
return config;
}

@Override
public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_7_8_0)) {
super.writeTo(out);
config.writeTo(out);
return;
}

UpdateTransformActionPre78.Response r = new UpdateTransformActionPre78.Response(config);
r.writeTo(out);
super.writeTo(out);
config.writeTo(out);
}

@Override
Expand Down

This file was deleted.

This file was deleted.

Loading