zacharymorn commented on a change in pull request #128:
URL: https://github.com/apache/lucene/pull/128#discussion_r696246368



##########
File path: lucene/test-framework/src/java/org/apache/lucene/util/TestUtil.java
##########
@@ -321,6 +326,11 @@ public static void syncConcurrentMerges(MergeScheduler ms) 
{
       checker.setDoSlowChecks(doSlowChecks);
       checker.setFailFast(failFast);
       checker.setInfoStream(new PrintStream(output, false, IOUtils.UTF_8), 
false);
+      if (concurrent) {
+        checker.setThreadCount(RandomizedTest.randomIntBetween(1, 5));
+      } else {
+        checker.setThreadCount(0);

Review comment:
       Currently in the code, it is using `0` to signal turning off concurrent 
checking (using the main thread to check index), and it is also used as default 
when users don't explicitly pass in `-threadCount` flag.
   
   In `CheckIndex#doCheck(Options)`, here's the logic to overwrite default 
thread count with user provided value (`0` when not specified)
   ```
   // when threadCount was not provided via command line, override it with 0 to 
turn of concurrent
   // check
   setThreadCount(opts.threadCount);
   ```
   
   and later in `CheckIndex#checkIndex(List)`, it is used as such
   
   ```
   public Status checkIndex(List<String> onlySegments) throws IOException {
       ExecutorService executorService = null;
   
       if (threadCount > 0) {
         executorService =
             Executors.newFixedThreadPool(threadCount, new 
NamedThreadFactory("async-check-index"));
       }
   
       try {
         return checkIndex(onlySegments, executorService);
       } finally {
         ...
       }
   }
   ```
   
   ---
   
   If we were to use `1`  to signal checking sequentially / turning off 
concurrency, then I would imagine users will need to use `-threadCount 2` when 
they meant "create 1 more thread in addition to main thread to check index", 
and in general N+1 when they were thinking about creating N additional threads 
right? I feel this might be a bit unintuitive? 
   




-- 
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...@lucene.apache.org

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



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

Reply via email to