Skip to content

Commit

Permalink
Serialize ignore_throttled also to 6.6 after backport
Browse files Browse the repository at this point in the history
  • Loading branch information
s1monw committed Nov 6, 2018
1 parent 366f79c commit 6e58284
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ public boolean ignoreThrottled() {

public void writeIndicesOptions(StreamOutput out) throws IOException {
EnumSet<Option> options = this.options;
// never write this out to a pre7.0 version
if (out.getVersion().before(Version.V_7_0_0_alpha1) && options.contains(Option.IGNORE_THROTTLED)) {
// never write this out to a pre 6.6 version
if (out.getVersion().before(Version.V_6_6_0) && options.contains(Option.IGNORE_THROTTLED)) {
options = EnumSet.copyOf(options);
options.remove(Option.IGNORE_THROTTLED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void testSerialization() throws Exception {
public void testSerializationPre70() throws Exception {
int iterations = randomIntBetween(5, 20);
for (int i = 0; i < iterations; i++) {
Version version = randomVersionBetween(random(), null, Version.V_6_4_0);
Version version = randomVersionBetween(random(), null, Version.V_6_6_0);
IndicesOptions indicesOptions = IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),
randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean());

Expand All @@ -100,7 +100,12 @@ public void testSerializationPre70() throws Exception {
assertThat(indicesOptions2.allowAliasesToMultipleIndices(), equalTo(indicesOptions.allowAliasesToMultipleIndices()));

assertEquals(indicesOptions2.ignoreAliases(), indicesOptions.ignoreAliases());
assertFalse(indicesOptions2.ignoreThrottled()); // make sure we never write this option to pre 7.0
if (output.getVersion().onOrAfter(Version.V_6_6_0)) {
assertEquals(indicesOptions2.ignoreThrottled(), indicesOptions.ignoreThrottled());
} else {
assertFalse(indicesOptions2.ignoreThrottled()); // make sure we never write this option to pre 6.6
}

}
}

Expand Down

0 comments on commit 6e58284

Please sign in to comment.