Skip to content

Commit e951a81

Browse files
jaymodeSivagurunathanV
authored andcommitted
Remove unused IndicesOptions#fromByte method (elastic#50665)
This change removes a no longer used method, `fromByte`, in IndicesOptions. This method was necessary for backwards compatibility with versions prior to 6.4.0 and was used when talking to those versions. However, the minimum wire compatibility version has changed and we no longer use this code.
1 parent b1db9f4 commit e951a81

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

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

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -118,42 +118,6 @@ private IndicesOptions(Collection<Option> options, Collection<WildcardStates> ex
118118
expandWildcards.isEmpty() ? WildcardStates.NONE : EnumSet.copyOf(expandWildcards));
119119
}
120120

121-
// Package visible for testing
122-
static IndicesOptions fromByte(final byte id) {
123-
// IGNORE_UNAVAILABLE = 1;
124-
// ALLOW_NO_INDICES = 2;
125-
// EXPAND_WILDCARDS_OPEN = 4;
126-
// EXPAND_WILDCARDS_CLOSED = 8;
127-
// FORBID_ALIASES_TO_MULTIPLE_INDICES = 16;
128-
// FORBID_CLOSED_INDICES = 32;
129-
// IGNORE_ALIASES = 64;
130-
131-
Set<Option> opts = new HashSet<>();
132-
Set<WildcardStates> wildcards = new HashSet<>();
133-
if ((id & 1) != 0) {
134-
opts.add(Option.IGNORE_UNAVAILABLE);
135-
}
136-
if ((id & 2) != 0) {
137-
opts.add(Option.ALLOW_NO_INDICES);
138-
}
139-
if ((id & 4) != 0) {
140-
wildcards.add(WildcardStates.OPEN);
141-
}
142-
if ((id & 8) != 0) {
143-
wildcards.add(WildcardStates.CLOSED);
144-
}
145-
if ((id & 16) != 0) {
146-
opts.add(Option.FORBID_ALIASES_TO_MULTIPLE_INDICES);
147-
}
148-
if ((id & 32) != 0) {
149-
opts.add(Option.FORBID_CLOSED_INDICES);
150-
}
151-
if ((id & 64) != 0) {
152-
opts.add(Option.IGNORE_ALIASES);
153-
}
154-
return new IndicesOptions(opts, wildcards);
155-
}
156-
157121
/**
158122
* @return Whether specified concrete indices should be ignored when unavailable (missing or closed)
159123
*/

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -160,31 +160,6 @@ public void testFromParameters() {
160160
assertEquals(defaultOptions.ignoreAliases(), updatedOptions.ignoreAliases());
161161
}
162162

163-
public void testSimpleByteBWC() {
164-
Map<Byte, IndicesOptions> old = new HashMap<>();
165-
// These correspond to each individual option (bit) in the old byte-based IndicesOptions
166-
old.put((byte) 0, IndicesOptions.fromOptions(false, false, false, false, true, false, false, false));
167-
old.put((byte) 1, IndicesOptions.fromOptions(true, false, false, false, true, false, false, false));
168-
old.put((byte) 2, IndicesOptions.fromOptions(false, true, false, false, true, false, false, false));
169-
old.put((byte) 4, IndicesOptions.fromOptions(false, false, true, false, true, false, false, false));
170-
old.put((byte) 8, IndicesOptions.fromOptions(false, false, false, true, true, false, false, false));
171-
old.put((byte) 16, IndicesOptions.fromOptions(false, false, false, false, false, false, false, false));
172-
old.put((byte) 32, IndicesOptions.fromOptions(false, false, false, false, true, true, false, false));
173-
old.put((byte) 64, IndicesOptions.fromOptions(false, false, false, false, true, false, true, false));
174-
// Test a few multi-selected options
175-
old.put((byte) 13, IndicesOptions.fromOptions(true, false, true, true, true, false, false, false));
176-
old.put((byte) 19, IndicesOptions.fromOptions(true, true, false, false, false, false, false, false));
177-
old.put((byte) 24, IndicesOptions.fromOptions(false, false, false, true, false, false, false, false));
178-
old.put((byte) 123, IndicesOptions.fromOptions(true, true, false, true, false, true, true, false));
179-
180-
for (Map.Entry<Byte, IndicesOptions> entry : old.entrySet()) {
181-
IndicesOptions indicesOptions2 = IndicesOptions.fromByte(entry.getKey());
182-
logger.info("--> 1 {}", entry.getValue().toString());
183-
logger.info("--> 2 {}", indicesOptions2.toString());
184-
assertThat("IndicesOptions for byte " + entry.getKey() + " differ for conversion",indicesOptions2, equalTo(entry.getValue()));
185-
}
186-
}
187-
188163
public void testEqualityAndHashCode() {
189164
IndicesOptions indicesOptions = IndicesOptions.fromOptions(
190165
randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(),

0 commit comments

Comments
 (0)