kotman12 commented on code in PR #3344:
URL: https://github.com/apache/solr/pull/3344#discussion_r2080351285
##########
solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java:
##########
@@ -2546,24 +2554,15 @@ public Explanation explain(Query query, int doc) throws
IOException {
*/
public IndexFingerprint getIndexFingerprint(long maxVersion) throws
IOException {
final SolrIndexSearcher searcher = this;
- final AtomicReference<IOException> exception = new AtomicReference<>();
- try {
- return searcher.getTopReaderContext().leaves().stream()
- .map(
- ctx -> {
- try {
- return searcher.getCore().getIndexFingerprint(searcher, ctx,
maxVersion);
- } catch (IOException e) {
- exception.set(e);
- return null;
- }
- })
- .filter(java.util.Objects::nonNull)
- .reduce(new IndexFingerprint(maxVersion), IndexFingerprint::reduce);
-
- } finally {
- if (exception.get() != null) throw exception.get();
- }
+ List<Callable<IndexFingerprint>> tasks =
+ searcher.getTopReaderContext().leaves().stream()
+ .map(
+ ctx ->
+ (Callable<IndexFingerprint>)
+ () -> searcher.getCore().getIndexFingerprint(searcher,
ctx, maxVersion))
+ .collect(Collectors.toList());
+ return
ExecutorUtil.submitAllAndAwaitAggregatingExceptions(fingerprintExecutor,
tasks).stream()
+ .reduce(new IndexFingerprint(maxVersion), IndexFingerprint::reduce);
Review Comment:
Makes sense. The reduce here is `O(segment_count)` .. in our testing it was
less than 1% of total execution time. Forking this process again could even
slow things down in some cases and any marginal benefit is certainly not worth
adding a fork join pool dependency.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]