You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/09/01 16:29:42 UTC
[lucene-solr] branch reference_impl_dev updated: @671 Fix up this
test.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/reference_impl_dev by this push:
new 99a4a14 @671 Fix up this test.
99a4a14 is described below
commit 99a4a1492d0cb8a7ecc0a1309f6691a50abf9ae1
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Sep 1 11:29:24 2020 -0500
@671 Fix up this test.
---
.../src/test/org/apache/solr/search/TestStressLucene.java | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java b/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
index 7bc4667..ee14d9a 100644
--- a/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
+++ b/solr/core/src/test/org/apache/solr/search/TestStressLucene.java
@@ -22,6 +22,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.Lock;
@@ -38,6 +40,7 @@ import org.apache.lucene.index.RandomIndexWriter;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.store.Directory;
+import org.apache.solr.common.ParWork;
import org.junit.Test;
import static org.apache.solr.core.SolrCore.verbose;
@@ -49,7 +52,7 @@ public class TestStressLucene extends TestRTGBase {
@Test
public void testStressLuceneNRT() throws Exception {
final int commitPercent = 5 + random().nextInt(20);
- final int softCommitPercent = 30+random().nextInt(75); // what percent of the commits are soft
+ final int softCommitPercent = 30+random().nextInt(30); // what percent of the commits are soft
final int deletePercent = 4+random().nextInt(25);
final int deleteByQueryPercent = 1+random().nextInt(5);
final int ndocs = 5 + (random().nextBoolean() ? random().nextInt(25) : random().nextInt(200));
@@ -79,7 +82,7 @@ public class TestStressLucene extends TestRTGBase {
final AtomicInteger numCommitting = new AtomicInteger();
List<Thread> threads = new ArrayList<>();
-
+ List<Future> futures = new ArrayList<>();
final FieldType idFt = new FieldType();
idFt.setStored(true);
@@ -118,7 +121,7 @@ public class TestStressLucene extends TestRTGBase {
@Override
public void run() {
try {
- while (operations.get() > 0) {
+ while (operations.decrementAndGet() > 0) {
int oper = rand.nextInt(100);
if (oper < commitPercent) {
@@ -358,11 +361,11 @@ public class TestStressLucene extends TestRTGBase {
for (Thread thread : threads) {
- thread.start();
+ futures.add(ParWork.getRootSharedExecutor().submit(thread));
}
- for (Thread thread : threads) {
- thread.join();
+ for (Future future : futures) {
+ future.get(10, TimeUnit.SECONDS);
}
writer.close();