You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/08/23 14:36:38 UTC

[lucene] branch main updated: LUCENE-10058: fix gradle lucene:benchmark:run error (#253)

This is an automated email from the ASF dual-hosted git repository.

mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 191ee3a  LUCENE-10058: fix gradle lucene:benchmark:run error (#253)
191ee3a is described below

commit 191ee3ad3e44ac76d7ba42c5a30740f9bc838de7
Author: 51search <xi...@gmail.com>
AuthorDate: Mon Aug 23 22:36:33 2021 +0800

    LUCENE-10058: fix gradle lucene:benchmark:run error (#253)
---
 .../benchmark/byTask/feeds/ReutersContentSource.java   | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java
index 8e040b7..fa21216 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/ReutersContentSource.java
@@ -107,14 +107,16 @@ public class ReutersContentSource extends ContentSource {
 
     int threadIndexSize = Thread.currentThread().getName().length();
     int parallelTaskThreadSize = Constants.PARALLEL_TASK_THREAD_NAME_PREFIX.length();
-
-    // Extract ThreadIndex from unique ThreadName which is set with '"ParallelTaskThread-"+index',
-    // in TaskSequence.java's doParallelTasks()
-    int threadIndex =
-        Integer.parseInt(
-            Thread.currentThread()
-                .getName()
-                .substring(parallelTaskThreadSize + 1, threadIndexSize));
+    int threadIndex = 0;
+    if (docCountArr.length > 1) {
+      // Extract ThreadIndex from unique ThreadName which is set with '"ParallelTaskThread-"+index',
+      // in TaskSequence.java's doParallelTasks()
+      threadIndex =
+          Integer.parseInt(
+              Thread.currentThread()
+                  .getName()
+                  .substring(parallelTaskThreadSize + 1, threadIndexSize));
+    }
 
     assert (threadIndex >= 0 && threadIndex < docCountArr.length)
         : "Please check threadIndex or docCountArr length";