Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -19,9 +19,7 @@

package org.elasticsearch.action.bulk;

import org.elasticsearch.Version;
import org.elasticsearch.action.DocWriteRequest;
import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
Expand Down Expand Up @@ -78,37 +76,12 @@ public void readFrom(StreamInput in) throws IOException {
if (in.readBoolean()) {
primaryResponse = BulkItemResponse.readBulkItem(in);
}
if (in.getVersion().before(Version.V_6_0_0_alpha1)) { // TODO remove once backported
boolean ignoreOnReplica = in.readBoolean();
if (ignoreOnReplica == false && primaryResponse != null) {
assert primaryResponse.isFailed() == false : "expected no failure on the primary response";
}
}
}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeVInt(id);
if (out.getVersion().before(Version.V_6_0_0_alpha1)) { // TODO remove once backported
// old nodes expect updated version and version type on the request
if (primaryResponse != null) {
request.version(primaryResponse.getVersion());
request.versionType(request.versionType().versionTypeForReplicationAndRecovery());
DocWriteRequest.writeDocumentRequest(out, request);
} else {
DocWriteRequest.writeDocumentRequest(out, request);
}
} else {
DocWriteRequest.writeDocumentRequest(out, request);
}
DocWriteRequest.writeDocumentRequest(out, request);
out.writeOptionalStreamable(primaryResponse);
if (out.getVersion().before(Version.V_6_0_0_alpha1)) { // TODO remove once backported
if (primaryResponse != null) {
out.writeBoolean(primaryResponse.isFailed()
|| primaryResponse.getResponse().getResult() == DocWriteResponse.Result.NOOP);
} else {
out.writeBoolean(false);
}
}
}
}
17 changes: 13 additions & 4 deletions distribution/bwc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ if (enabled) {
File checkoutDir = file("${buildDir}/bwc/checkout-${bwcBranch}")

task createClone(type: LoggedExec) {
onlyIf { checkoutDir.exists() == false }
commandLine = ['git', 'clone', rootDir, checkoutDir]
if (checkoutDir.exists() == false) {
commandLine = ['git', 'clone', rootDir, checkoutDir]
} else {
commandLine = ['git', 'fetch', 'origin']
workingDir = checkoutDir
}
}

// we use regular Exec here to ensure we always get output, regardless of logging level
Expand Down Expand Up @@ -106,9 +110,14 @@ if (enabled) {

// this is an Exec task so that the SHA that is checked out is logged
task checkoutBwcBranch(type: Exec) {
dependsOn fetchLatest
def String branch = System.getProperty("tests.bwc.branch", "upstream/${bwcBranch}")
if (branch.startsWith('upstream')) {
dependsOn fetchLatest
} else {
dependsOn createClone
}
workingDir = checkoutDir
commandLine = ['git', 'checkout', "upstream/${bwcBranch}"]
commandLine = ['git', 'checkout', branch]
}

File bwcDeb = file("${checkoutDir}/distribution/deb/build/distributions/elasticsearch-${bwcVersion}.deb")
Expand Down