Skip to content

Commit 031fcaf

Browse files
committed
Backport fail shard w/o marking as stale PR to v6.3
Relates #28054
1 parent 61e6dca commit 031fcaf

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

server/src/main/java/org/elasticsearch/cluster/action/shard/ShardStateAction.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ public static class FailedShardEntry extends TransportRequest {
365365
primaryTerm = in.readVLong();
366366
message = in.readString();
367367
failure = in.readException();
368-
if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
368+
if (in.getVersion().onOrAfter(Version.V_6_3_0)) {
369369
markAsStale = in.readBoolean();
370370
} else {
371371
markAsStale = true;
@@ -397,7 +397,7 @@ public void writeTo(StreamOutput out) throws IOException {
397397
out.writeVLong(primaryTerm);
398398
out.writeString(message);
399399
out.writeException(failure);
400-
if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) {
400+
if (out.getVersion().onOrAfter(Version.V_6_3_0)) {
401401
out.writeBoolean(markAsStale);
402402
}
403403
}
@@ -523,12 +523,12 @@ public static class StartedShardEntry extends TransportRequest {
523523
super(in);
524524
shardId = ShardId.readShardId(in);
525525
allocationId = in.readString();
526-
if (in.getVersion().before(Version.V_7_0_0_alpha1)) {
526+
if (in.getVersion().before(Version.V_6_3_0)) {
527527
final long primaryTerm = in.readVLong();
528528
assert primaryTerm == 0L : "shard is only started by itself: primary term [" + primaryTerm + "]";
529529
}
530530
this.message = in.readString();
531-
if (in.getVersion().before(Version.V_7_0_0_alpha1)) {
531+
if (in.getVersion().before(Version.V_6_3_0)) {
532532
final Exception ex = in.readException();
533533
assert ex == null : "started shard must not have failure [" + ex + "]";
534534
}
@@ -545,11 +545,11 @@ public void writeTo(StreamOutput out) throws IOException {
545545
super.writeTo(out);
546546
shardId.writeTo(out);
547547
out.writeString(allocationId);
548-
if (out.getVersion().before(Version.V_7_0_0_alpha1)) {
548+
if (out.getVersion().before(Version.V_6_3_0)) {
549549
out.writeVLong(0L);
550550
}
551551
out.writeString(message);
552-
if (out.getVersion().before(Version.V_7_0_0_alpha1)) {
552+
if (out.getVersion().before(Version.V_6_3_0)) {
553553
out.writeException(null);
554554
}
555555
}

server/src/test/java/org/elasticsearch/cluster/action/shard/ShardStateActionTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ private Exception getSimulatedFailure() {
423423

424424
public void testShardEntryBWCSerialize() throws Exception {
425425
final Version bwcVersion = randomValueOtherThanMany(
426-
version -> version.onOrAfter(Version.V_7_0_0_alpha1), () -> VersionUtils.randomVersion(random()));
426+
version -> version.onOrAfter(Version.V_6_3_0), () -> VersionUtils.randomVersion(random()));
427427
final ShardId shardId = new ShardId(randomRealisticUnicodeOfLengthBetween(10, 100), UUID.randomUUID().toString(), between(0, 1000));
428428
final String allocationId = randomRealisticUnicodeOfCodepointLengthBetween(10, 100);
429429
final String reason = randomRealisticUnicodeOfCodepointLengthBetween(10, 100);

0 commit comments

Comments
 (0)