Backport fail shard w/o marking as stale PR to v6.3

Relates #28054
This commit is contained in:
Nhat Nguyen 2018-02-03 11:59:54 -05:00
parent 965efa51cc
commit de6d31ebc2
2 changed files with 7 additions and 7 deletions

View File

@ -365,7 +365,7 @@ public class ShardStateAction extends AbstractComponent {
primaryTerm = in.readVLong();
message = in.readString();
failure = in.readException();
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
markAsStale = in.readBoolean();
} else {
markAsStale = true;
@ -397,7 +397,7 @@ public class ShardStateAction extends AbstractComponent {
out.writeVLong(primaryTerm);
out.writeString(message);
out.writeException(failure);
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
out.writeBoolean(markAsStale);
}
}
@ -523,12 +523,12 @@ public class ShardStateAction extends AbstractComponent {
super(in);
shardId = ShardId.readShardId(in);
allocationId = in.readString();
if (in.getVersion().before(Version.V_7_0_0_alpha1)) {
if (in.getVersion().before(Version.V_6_3_0)) {
final long primaryTerm = in.readVLong();
assert primaryTerm == 0L : "shard is only started by itself: primary term [" + primaryTerm + "]";
}
this.message = in.readString();
if (in.getVersion().before(Version.V_7_0_0_alpha1)) {
if (in.getVersion().before(Version.V_6_3_0)) {
final Exception ex = in.readException();
assert ex == null : "started shard must not have failure [" + ex + "]";
}
@ -545,11 +545,11 @@ public class ShardStateAction extends AbstractComponent {
super.writeTo(out);
shardId.writeTo(out);
out.writeString(allocationId);
if (out.getVersion().before(Version.V_7_0_0_alpha1)) {
if (out.getVersion().before(Version.V_6_3_0)) {
out.writeVLong(0L);
}
out.writeString(message);
if (out.getVersion().before(Version.V_7_0_0_alpha1)) {
if (out.getVersion().before(Version.V_6_3_0)) {
out.writeException(null);
}
}

View File

@ -423,7 +423,7 @@ public class ShardStateActionTests extends ESTestCase {
public void testShardEntryBWCSerialize() throws Exception {
final Version bwcVersion = randomValueOtherThanMany(
version -> version.onOrAfter(Version.V_7_0_0_alpha1), () -> VersionUtils.randomVersion(random()));
version -> version.onOrAfter(Version.V_6_3_0), () -> VersionUtils.randomVersion(random()));
final ShardId shardId = new ShardId(randomRealisticUnicodeOfLengthBetween(10, 100), UUID.randomUUID().toString(), between(0, 1000));
final String allocationId = randomRealisticUnicodeOfCodepointLengthBetween(10, 100);
final String reason = randomRealisticUnicodeOfCodepointLengthBetween(10, 100);