-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Metadata Immutability] Change different indices lookup objects from array type to lists #14723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -706,7 +706,7 @@ | |||
if (routing != null) { | ||||
Set<String> r = Sets.newHashSet(Strings.splitStringByCommaToArray(routing)); | ||||
Map<String, Set<String>> routings = new HashMap<>(); | ||||
String[] concreteIndices = metadata.getConcreteAllIndices(); | ||||
Set<String> concreteIndices = metadata.getConcreteAllIndices(); | ||||
Check warning on line 709 in server/src/main/java/org/opensearch/cluster/metadata/IndexNameExpressionResolver.java
|
||||
for (String index : concreteIndices) { | ||||
routings.put(index, r); | ||||
} | ||||
|
@@ -746,7 +746,7 @@ | |||
*/ | ||||
boolean isPatternMatchingAllIndices(Metadata metadata, String[] indicesOrAliases, String[] concreteIndices) { | ||||
// if we end up matching on all indices, check, if its a wildcard parameter, or a "-something" structure | ||||
if (concreteIndices.length == metadata.getConcreteAllIndices().length && indicesOrAliases.length > 0) { | ||||
if (concreteIndices.length == metadata.getConcreteAllIndices().size() && indicesOrAliases.length > 0) { | ||||
|
||||
// we might have something like /-test1,+test1 that would identify all indices | ||||
// or something like /-test1 with test1 index missing and IndicesOptions.lenient() | ||||
|
@@ -1182,17 +1182,17 @@ | |||
|
||||
private static List<String> resolveEmptyOrTrivialWildcard(IndicesOptions options, Metadata metadata) { | ||||
if (options.expandWildcardsOpen() && options.expandWildcardsClosed() && options.expandWildcardsHidden()) { | ||||
return Arrays.asList(metadata.getConcreteAllIndices()); | ||||
return List.copyOf(metadata.getConcreteAllIndices()); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be expensive operation to copy the set to a list every time for index resolution. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here ConcreteAllIndices(allIndices) are unmodifiableSet, so List.copyOf() will not really create a copy . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you are doing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, you are correct. So what do you suggest here?
That's why I kept only concrete indices as Set and all other indices as List. If we keep concrete indices also as List, then this conversion won't be required. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes right, lets check the usage in the code if it has to be Set, else i agree keeping it as list would be better. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ran performance test by crating indices using a script, which ran for 2 hours and 3 minutes. On comparing with changes and without changes, with changes I am consistently able to create ~30 more indices. So it is clearly a performance improvement. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @akolarkunnu : Thanks for benchmarking the creation times. Can you please benchmark There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @shwetathareja A quick clarification - so if If yes, please checkout the comparison results - #14723 (comment) - I do see a good improvement in reduction of search and indexing latencies, increase in majority of indexing/search throughputs. One catch I see is that the indices+aliases size is relatively low in the OSB benchmark, but I guess the slight increase in performance we see can be accounted for the reduction in conversions back and forth to arrays/lists. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OSB benchmark may not show impact as it would run with handful indices. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also how are you searching? you need to search with * pattern or _all so that this
i thought conversion was happening in cluster state updates, not during search/ indexing? Are you sure, improvement is due to that? |
||||
} else if (options.expandWildcardsOpen() && options.expandWildcardsClosed()) { | ||||
return Arrays.asList(metadata.getConcreteVisibleIndices()); | ||||
return metadata.getConcreteVisibleIndices(); | ||||
} else if (options.expandWildcardsOpen() && options.expandWildcardsHidden()) { | ||||
return Arrays.asList(metadata.getConcreteAllOpenIndices()); | ||||
return metadata.getConcreteAllOpenIndices(); | ||||
} else if (options.expandWildcardsOpen()) { | ||||
return Arrays.asList(metadata.getConcreteVisibleOpenIndices()); | ||||
return metadata.getConcreteVisibleOpenIndices(); | ||||
} else if (options.expandWildcardsClosed() && options.expandWildcardsHidden()) { | ||||
return Arrays.asList(metadata.getConcreteAllClosedIndices()); | ||||
return metadata.getConcreteAllClosedIndices(); | ||||
} else if (options.expandWildcardsClosed()) { | ||||
return Arrays.asList(metadata.getConcreteVisibleClosedIndices()); | ||||
return metadata.getConcreteVisibleClosedIndices(); | ||||
} else { | ||||
return Collections.emptyList(); | ||||
} | ||||
|
Uh oh!
There was an error while loading. Please reload this page.