mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-18 19:05:06 +00:00
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:
parent
245dd73156
commit
27e45fc552
@ -19,7 +19,6 @@
|
|||||||
package org.elasticsearch.action.support;
|
package org.elasticsearch.action.support;
|
||||||
|
|
||||||
|
|
||||||
import org.elasticsearch.Version;
|
|
||||||
import org.elasticsearch.common.io.stream.StreamInput;
|
import org.elasticsearch.common.io.stream.StreamInput;
|
||||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||||
import org.elasticsearch.rest.RestRequest;
|
import org.elasticsearch.rest.RestRequest;
|
||||||
@ -119,20 +118,12 @@ public class IndicesOptions {
|
|||||||
public boolean ignoreAliases() {
|
public boolean ignoreAliases() {
|
||||||
return (id & IGNORE_ALIASES) != 0;
|
return (id & IGNORE_ALIASES) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeIndicesOptions(StreamOutput out) throws IOException {
|
public void writeIndicesOptions(StreamOutput out) throws IOException {
|
||||||
if (out.getVersion().onOrAfter(Version.V_6_0_0_alpha2)) {
|
out.write(id);
|
||||||
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 {
|
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();
|
byte id = in.readByte();
|
||||||
if (id >= VALUES.length) {
|
if (id >= VALUES.length) {
|
||||||
throw new IllegalArgumentException("No valid missing index type id: " + id);
|
throw new IllegalArgumentException("No valid missing index type id: " + id);
|
||||||
|
@ -51,11 +51,7 @@ public class IndicesOptionsTests extends ESTestCase {
|
|||||||
assertThat(indicesOptions2.forbidClosedIndices(), equalTo(indicesOptions.forbidClosedIndices()));
|
assertThat(indicesOptions2.forbidClosedIndices(), equalTo(indicesOptions.forbidClosedIndices()));
|
||||||
assertThat(indicesOptions2.allowAliasesToMultipleIndices(), equalTo(indicesOptions.allowAliasesToMultipleIndices()));
|
assertThat(indicesOptions2.allowAliasesToMultipleIndices(), equalTo(indicesOptions.allowAliasesToMultipleIndices()));
|
||||||
|
|
||||||
if (output.getVersion().onOrAfter(Version.V_6_0_0_alpha2)) {
|
assertEquals(indicesOptions2.ignoreAliases(), indicesOptions.ignoreAliases());
|
||||||
assertEquals(indicesOptions2.ignoreAliases(), indicesOptions.ignoreAliases());
|
|
||||||
} else {
|
|
||||||
assertFalse(indicesOptions2.ignoreAliases());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user