From 6ca076bf7467f13d7807b089f549ac429b45e8fc Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Mon, 14 Jan 2019 13:13:15 +0100 Subject: [PATCH] Fix ClusterBlock serialization and Close Index API logic after backport to 6.x (#37360) This commit changes the versions in the serialization logic of ClusterBlock after the backport to 6.x of the Close Index API refactoring (#37359). --- .../java/org/elasticsearch/cluster/block/ClusterBlock.java | 4 ++-- .../cluster/metadata/MetaDataIndexStateService.java | 2 +- .../org/elasticsearch/cluster/block/ClusterBlockTests.java | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java b/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java index 5713462b9212f..497e296d9eeb6 100644 --- a/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java +++ b/server/src/main/java/org/elasticsearch/cluster/block/ClusterBlock.java @@ -138,7 +138,7 @@ public static ClusterBlock readClusterBlock(StreamInput in) throws IOException { @Override public void readFrom(StreamInput in) throws IOException { id = in.readVInt(); - if (in.getVersion().onOrAfter(Version.V_7_0_0)) { + if (in.getVersion().onOrAfter(Version.V_6_7_0)) { uuid = in.readOptionalString(); } else { uuid = null; @@ -159,7 +159,7 @@ public void readFrom(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { out.writeVInt(id); - if (out.getVersion().onOrAfter(Version.V_7_0_0)) { + if (out.getVersion().onOrAfter(Version.V_6_7_0)) { out.writeOptionalString(uuid); } out.writeString(description); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java index aa4434a0a74c6..0781cab1fe757 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataIndexStateService.java @@ -225,7 +225,7 @@ static ClusterState addIndexClosedBlocks(final Index[] indices, final Map levels = Arrays.asList(ClusterBlockLevel.values()); return new ClusterBlock(randomInt(), uuid, "cluster block #" + randomInt(), randomBoolean(), randomBoolean(), randomBoolean(), randomFrom(RestStatus.values()), copyOf(randomSubsetOf(randomIntBetween(1, levels.size()), levels)));