BryceKan3 commented on code in PR #15428:
URL: https://github.com/apache/lucene/pull/15428#discussion_r2536353052


##########
lucene/core/src/java/org/apache/lucene/index/StandardDirectoryReader.java:
##########
@@ -88,10 +95,37 @@ protected DirectoryReader doBody(String segmentFileName) 
throws IOException {
             SegmentInfos.readCommit(directory, segmentFileName, 
minSupportedMajorVersion);
         final SegmentReader[] readers = new SegmentReader[sis.size()];
         try {
-          for (int i = sis.size() - 1; i >= 0; i--) {
-            readers[i] =
-                new SegmentReader(
-                    sis.info(i), sis.getIndexCreatedVersionMajor(), 
IOContext.DEFAULT);
+          if (executor != null) {
+            List<Future<SegmentReader>> futures = new ArrayList<>();
+            for (int i = sis.size() - 1; i >= 0; i--) {
+              final int index = i;
+              // parallelize segment reader initialization
+              futures.add(
+                  (executor)
+                      .submit(

Review Comment:
   Hey yeah I took a look at this, I went with an ExecutorService here directly 
to ensure we could gracefully close out the readers in the event of an 
exception. With the TaskExecutor we would get the exception bubbled up and we 
would not be able to close the SegmentReaders. 



-- 
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]

Reply via email to