Skip to content

Commit

Permalink
Complete backport of #72931 (#73143)
Browse files Browse the repository at this point in the history
Adjusts wire-compat and re-enables BWC tests
  • Loading branch information
DaveCTurner authored May 17, 2021
1 parent a9229ab commit 9061e59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ tasks.register("verifyVersions") {
* after the backport of the backcompat code is complete.
*/

boolean bwc_tests_enabled = false
boolean bwc_tests_enabled = true
// place a PR link here when committing bwc changes:
String bwc_tests_disabled_issue = "https://github.com/elastic/elasticsearch/pull/72931"
String bwc_tests_disabled_issue = ""
/*
* FIPS 140-2 behavior was fixed in 7.11.0. Before that there is no way to run elasticsearch in a
* JVM that is properly configured to be in fips mode with BCFIPS. For now we need to disable
Expand Down
11 changes: 2 additions & 9 deletions server/src/main/java/org/elasticsearch/tasks/TaskInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

package org.elasticsearch.tasks;

import org.elasticsearch.Version;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
Expand Down Expand Up @@ -104,11 +103,7 @@ public TaskInfo(StreamInput in) throws IOException {
startTime = in.readLong();
runningTimeNanos = in.readLong();
cancellable = in.readBoolean();
if (in.getVersion().onOrAfter(Version.V_8_0_0)) {
cancelled = in.readBoolean();
} else {
cancelled = false; // older versions do not report when tasks are cancelled so we just assume they aren't
}
cancelled = in.readBoolean();
assert cancellable || cancelled == false : "uncancellable task cannot be cancelled";
parentTaskId = TaskId.readFromStream(in);
headers = in.readMap(StreamInput::readString, StreamInput::readString);
Expand All @@ -124,9 +119,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeLong(startTime);
out.writeLong(runningTimeNanos);
out.writeBoolean(cancellable);
if (out.getVersion().onOrAfter(Version.V_8_0_0)) {
out.writeBoolean(cancelled);
} // older versions do not report when tasks are cancelled anyway so it's ok just to drop this flag
out.writeBoolean(cancelled);
parentTaskId.writeTo(out);
out.writeMap(headers, StreamOutput::writeString, StreamOutput::writeString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ public void testToXContent() throws IOException {
+ ","
+ "\"cancellable\":"
+ executingPolicy.getTaskInfo().isCancellable()
+ (executingPolicy.getTaskInfo().isCancellable()
? ",\"cancelled\":" + executingPolicy.getTaskInfo().isCancellable()
: "")
+ (executingPolicy.getTaskInfo().isCancellable() ? ",\"cancelled\":" + executingPolicy.getTaskInfo().isCancelled() : "")
+ ","
+ header.map(entry -> String.format(Locale.ROOT, "\"headers\":{\"%s\":\"%s\"}", entry.getKey(), entry.getValue()))
.orElse("\"headers\":{}")
Expand Down

0 comments on commit 9061e59

Please sign in to comment.