mlbiscoc commented on code in PR #3344:
URL: https://github.com/apache/solr/pull/3344#discussion_r2080216509


##########
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:
   We are only going to parallelize the fingerprint calculation. The reduce is 
done sequentially still after.



##########
solr/core/src/java/org/apache/solr/core/SolrCore.java:
##########
@@ -2204,6 +2204,11 @@ public IndexFingerprint getIndexFingerprint(
     return f;
   }
 
+  /** Clear the per‐segment fingerprint cache. */
+  public void clearPerSegmentFingerprintCache() {
+    perSegmentFingerprintCache.clear();
+  }

Review Comment:
   I added this in for the test so the sequential calculation doesn't affect 
the next with its cached hash



-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to