Serialize ignore_throttled also to 6.6 after backport

This commit is contained in:
Simon Willnauer 2018-11-06 13:49:42 +01:00
parent 366f79cef2
commit 6e58284683
2 changed files with 9 additions and 4 deletions

View File

@ -256,8 +256,8 @@ public class IndicesOptions implements ToXContentFragment {
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);
}

View File

@ -79,7 +79,7 @@ public class IndicesOptionsTests extends ESTestCase {
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());
@ -100,7 +100,12 @@ public class IndicesOptionsTests extends ESTestCase {
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
}
}
}