Remove IndicesOptions bwc serialization layer (#29281)

On master we don't need to talk to pre-6.0 nodes anymore.
This commit is contained in:
Christoph Büscher 2018-03-28 16:19:45 +02:00 committed by GitHub
parent 245dd73156
commit 27e45fc552
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 16 deletions

View File

@ -19,7 +19,6 @@
package org.elasticsearch.action.support;
import org.elasticsearch.Version;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.rest.RestRequest;
@ -121,18 +120,10 @@ public class IndicesOptions {
}
public void writeIndicesOptions(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha2)) {
out.write(id);
} else {
// if we are talking to a node that doesn't support the newly added flag (ignoreAliases)
// flip to 0 all the bits starting from the 7th
out.write(id & 0x3f);
}
}
public static IndicesOptions readIndicesOptions(StreamInput in) throws IOException {
//if we read from a node that doesn't support the newly added flag (ignoreAliases)
//we just receive the old corresponding value with the new flag set to false (default)
byte id = in.readByte();
if (id >= VALUES.length) {
throw new IllegalArgumentException("No valid missing index type id: " + id);

View File

@ -51,11 +51,7 @@ public class IndicesOptionsTests extends ESTestCase {
assertThat(indicesOptions2.forbidClosedIndices(), equalTo(indicesOptions.forbidClosedIndices()));
assertThat(indicesOptions2.allowAliasesToMultipleIndices(), equalTo(indicesOptions.allowAliasesToMultipleIndices()));
if (output.getVersion().onOrAfter(Version.V_6_0_0_alpha2)) {
assertEquals(indicesOptions2.ignoreAliases(), indicesOptions.ignoreAliases());
} else {
assertFalse(indicesOptions2.ignoreAliases());
}
}
}