mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 12:56:53 +00:00
Fix communication with 5.3.0 nodes
This commit fixes communication with 5.3.0 nodes to send XContentType to these nodes since #22691 was backported to the 5.3 branch.
This commit is contained in:
parent
214a3536aa
commit
d8d03f45c2
@ -137,7 +137,7 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
|
||||
|
||||
id = in.readOptionalString();
|
||||
content = in.readBytesReference();
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType = XContentType.readFrom(in);
|
||||
} else {
|
||||
xContentType = XContentFactory.xContentType(content);
|
||||
@ -151,7 +151,7 @@ public class PutStoredScriptRequest extends AcknowledgedRequest<PutStoredScriptR
|
||||
out.writeString(lang == null ? "" : lang);
|
||||
out.writeOptionalString(id);
|
||||
out.writeBytesReference(content);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
|
||||
pipeline = in.readOptionalString();
|
||||
isRetry = in.readBoolean();
|
||||
autoGeneratedTimestamp = in.readLong();
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
contentType = in.readOptionalWriteable(XContentType::readFrom);
|
||||
} else {
|
||||
contentType = XContentFactory.xContentType(source);
|
||||
@ -606,7 +606,7 @@ public class IndexRequest extends ReplicatedWriteRequest<IndexRequest> implement
|
||||
out.writeOptionalString(pipeline);
|
||||
out.writeBoolean(isRetry);
|
||||
out.writeLong(autoGeneratedTimestamp);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
out.writeOptionalWriteable(contentType);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ public class PutPipelineRequest extends AcknowledgedRequest<PutPipelineRequest>
|
||||
super.readFrom(in);
|
||||
id = in.readString();
|
||||
source = in.readBytesReference();
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType = XContentType.readFrom(in);
|
||||
} else {
|
||||
xContentType = XContentFactory.xContentType(source);
|
||||
@ -92,7 +92,7 @@ public class PutPipelineRequest extends AcknowledgedRequest<PutPipelineRequest>
|
||||
super.writeTo(out);
|
||||
out.writeString(id);
|
||||
out.writeBytesReference(source);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public class SimulatePipelineRequest extends ActionRequest {
|
||||
id = in.readOptionalString();
|
||||
verbose = in.readBoolean();
|
||||
source = in.readBytesReference();
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType = XContentType.readFrom(in);
|
||||
} else {
|
||||
xContentType = XContentFactory.xContentType(source);
|
||||
@ -116,7 +116,7 @@ public class SimulatePipelineRequest extends ActionRequest {
|
||||
out.writeOptionalString(id);
|
||||
out.writeBoolean(verbose);
|
||||
out.writeBytesReference(source);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
|
||||
|
||||
if (in.readBoolean()) {
|
||||
doc = in.readBytesReference();
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType = XContentType.readFrom(in);
|
||||
} else {
|
||||
xContentType = XContentFactory.xContentType(doc);
|
||||
@ -544,7 +544,7 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
|
||||
out.writeBoolean(doc != null);
|
||||
if (doc != null) {
|
||||
out.writeBytesReference(doc);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQ
|
||||
type = in.readOptionalString();
|
||||
if (in.readBoolean()) {
|
||||
doc = (BytesReference) in.readGenericValue();
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType = XContentType.readFrom(in);
|
||||
} else {
|
||||
xContentType = XContentFactory.xContentType(doc);
|
||||
@ -250,7 +250,7 @@ public class MoreLikeThisQueryBuilder extends AbstractQueryBuilder<MoreLikeThisQ
|
||||
out.writeBoolean(doc != null);
|
||||
if (doc != null) {
|
||||
out.writeGenericValue(doc);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType.writeTo(out);
|
||||
}
|
||||
} else {
|
||||
|
@ -118,7 +118,7 @@ public final class PipelineConfiguration extends AbstractDiffable<PipelineConfig
|
||||
}
|
||||
|
||||
public static PipelineConfiguration readFrom(StreamInput in) throws IOException {
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
return new PipelineConfiguration(in.readString(), in.readBytesReference(), XContentType.readFrom(in));
|
||||
} else {
|
||||
final String id = in.readString();
|
||||
@ -135,7 +135,7 @@ public final class PipelineConfiguration extends AbstractDiffable<PipelineConfig
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeString(id);
|
||||
out.writeBytesReference(config);
|
||||
if (out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
xContentType.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
|
||||
}
|
||||
document = in.readOptionalBytesReference();
|
||||
if (document != null) {
|
||||
if (in.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (in.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
documentXContentType = XContentType.readFrom(in);
|
||||
} else {
|
||||
documentXContentType = XContentFactory.xContentType(document);
|
||||
@ -210,7 +210,7 @@ public class PercolateQueryBuilder extends AbstractQueryBuilder<PercolateQueryBu
|
||||
out.writeBoolean(false);
|
||||
}
|
||||
out.writeOptionalBytesReference(document);
|
||||
if (document != null && out.getVersion().after(Version.V_5_3_0_UNRELEASED)) { // TODO update to onOrAfter after backporting
|
||||
if (document != null && out.getVersion().onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
documentXContentType.writeTo(out);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ integTest {
|
||||
cluster {
|
||||
numNodes = 4
|
||||
numBwcNodes = 2
|
||||
bwcVersion = "5.4.0-SNAPSHOT"
|
||||
bwcVersion = "5.3.0-SNAPSHOT"
|
||||
setting 'logger.org.elasticsearch', 'DEBUG'
|
||||
}
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ public class ClientYamlTestClient {
|
||||
if (supportedMethods.contains("GET") && RandomizedTest.rarely()) {
|
||||
logger.debug("sending the request body as source param with GET method");
|
||||
queryStringParams.put("source", body);
|
||||
if (esVersion.after(Version.V_5_3_0_UNRELEASED)) { // TODO make onOrAfter with backport
|
||||
if (esVersion.onOrAfter(Version.V_5_3_0_UNRELEASED)) {
|
||||
queryStringParams.put("source_content_type", ContentType.APPLICATION_JSON.toString());
|
||||
}
|
||||
requestMethod = "GET";
|
||||
|
@ -83,7 +83,7 @@ public class ClientYamlTestResponse {
|
||||
List<String> warningHeaders = new ArrayList<>();
|
||||
for (Header header : response.getHeaders()) {
|
||||
if (header.getName().equals("Warning")) {
|
||||
if (nodeVersion.after(Version.V_5_3_0_UNRELEASED) && response.getRequestLine().getMethod().equals("GET")
|
||||
if (nodeVersion.onOrAfter(Version.V_5_3_0_UNRELEASED) && response.getRequestLine().getMethod().equals("GET")
|
||||
&& response.getRequestLine().getUri().contains("source")
|
||||
&& response.getRequestLine().getUri().contains("source_content_type") == false && header.getValue().startsWith(
|
||||
"Deprecated use of the [source] parameter without the [source_content_type] parameter.")) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user