Skip to content

Commit 03218ed

Browse files
authored
Update BWC version for hidden indices (#51174)
This commit updates the BWC version we use in wire serialization for the hidden indices to V_7_7_0 after the backport of the feature to the 7.x branch. Relates #50452
1 parent 16994c8 commit 03218ed

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

server/src/main/java/org/elasticsearch/action/support/IndicesOptions.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ public EnumSet<WildcardStates> getExpandWildcards() {
223223

224224
public void writeIndicesOptions(StreamOutput out) throws IOException {
225225
out.writeEnumSet(options);
226-
if (out.getVersion().before(Version.V_8_0_0) && expandWildcards.contains(WildcardStates.HIDDEN)) {
226+
if (out.getVersion().before(Version.V_7_7_0) && expandWildcards.contains(WildcardStates.HIDDEN)) {
227227
final EnumSet<WildcardStates> states = EnumSet.copyOf(expandWildcards);
228228
states.remove(WildcardStates.HIDDEN);
229229
out.writeEnumSet(states);
@@ -235,7 +235,7 @@ public void writeIndicesOptions(StreamOutput out) throws IOException {
235235
public static IndicesOptions readIndicesOptions(StreamInput in) throws IOException {
236236
EnumSet<Option> options = in.readEnumSet(Option.class);
237237
EnumSet<WildcardStates> states = in.readEnumSet(WildcardStates.class);
238-
if (in.getVersion().before(Version.V_8_0_0)) {
238+
if (in.getVersion().before(Version.V_7_7_0)) {
239239
states.add(WildcardStates.HIDDEN);
240240
}
241241
return new IndicesOptions(options, states);

server/src/test/java/org/elasticsearch/action/OriginalIndicesTests.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ public void testOriginalIndicesSerialization() throws IOException {
5353
// indices options are not equivalent when sent to an older version and re-read due
5454
// to the addition of hidden indices as expand to hidden indices is always true when
5555
// read from a prior version
56-
// TODO update version on backport!
57-
if (out.getVersion().onOrAfter(Version.V_8_0_0) || originalIndices.indicesOptions().expandWildcardsHidden()) {
56+
if (out.getVersion().onOrAfter(Version.V_7_7_0) || originalIndices.indicesOptions().expandWildcardsHidden()) {
5857
assertThat(originalIndices2.indicesOptions(), equalTo(originalIndices.indicesOptions()));
5958
} else if (originalIndices.indicesOptions().expandWildcardsHidden()) {
6059
assertThat(originalIndices2.indicesOptions(), equalTo(originalIndices.indicesOptions()));

server/src/test/java/org/elasticsearch/action/admin/cluster/shards/ClusterSearchShardsRequestTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void testSerialization() throws Exception {
6565
// indices options are not equivalent when sent to an older version and re-read due
6666
// to the addition of hidden indices as expand to hidden indices is always true when
6767
// read from a prior version
68-
if (version.onOrAfter(Version.V_8_0_0) || request.indicesOptions().expandWildcardsHidden()) { // TODO change on backport!
68+
if (version.onOrAfter(Version.V_7_7_0) || request.indicesOptions().expandWildcardsHidden()) {
6969
assertEquals(request.indicesOptions(), deserialized.indicesOptions());
7070
}
7171
assertEquals(request.routing(), deserialized.routing());

server/src/test/java/org/elasticsearch/action/admin/indices/close/CloseIndexRequestTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void testBwcSerialization() throws Exception {
6666
// to the addition of hidden indices as expand to hidden indices is always true when
6767
// read from a prior version
6868
// TODO update version on backport!
69-
if (out.getVersion().onOrAfter(Version.V_8_0_0) || request.indicesOptions().expandWildcardsHidden()) {
69+
if (out.getVersion().onOrAfter(Version.V_7_7_0) || request.indicesOptions().expandWildcardsHidden()) {
7070
assertEquals(request.indicesOptions(), indicesOptions);
7171
}
7272
if (in.getVersion().onOrAfter(Version.V_7_2_0)) {
@@ -104,7 +104,7 @@ public void testBwcSerialization() throws Exception {
104104
// to the addition of hidden indices as expand to hidden indices is always true when
105105
// read from a prior version
106106
// TODO change version on backport
107-
if (out.getVersion().onOrAfter(Version.V_8_0_0) || sample.indicesOptions().expandWildcardsHidden()) {
107+
if (out.getVersion().onOrAfter(Version.V_7_7_0) || sample.indicesOptions().expandWildcardsHidden()) {
108108
assertEquals(sample.indicesOptions(), deserializedRequest.indicesOptions());
109109
}
110110
if (out.getVersion().onOrAfter(Version.V_7_2_0)) {

server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void testSerialization() throws Exception {
7070
assertThat(indicesOptions2.allowNoIndices(), equalTo(indicesOptions.allowNoIndices()));
7171
assertThat(indicesOptions2.expandWildcardsOpen(), equalTo(indicesOptions.expandWildcardsOpen()));
7272
assertThat(indicesOptions2.expandWildcardsClosed(), equalTo(indicesOptions.expandWildcardsClosed()));
73-
if (version.before(Version.V_8_0_0)) {
73+
if (version.before(Version.V_7_7_0)) {
7474
assertThat(indicesOptions2.expandWildcardsHidden(), is(true));
7575
} else {
7676
assertThat(indicesOptions2.expandWildcardsHidden(), equalTo(indicesOptions.expandWildcardsHidden()));

0 commit comments

Comments
 (0)