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/18 18:52:58 UTC
[lucene-solr] branch reference_impl_dev updated: @856 Quick cleanup
of last commit.
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 11fa2a6 @856 Quick cleanup of last commit.
11fa2a6 is described below
commit 11fa2a629bb01b1a3dd881f4867d8715e71e8828
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Fri Sep 18 13:51:25 2020 -0500
@856 Quick cleanup of last commit.
---
.../java/org/apache/solr/core/CoreContainer.java | 3 +-
.../src/java/org/apache/solr/core/SolrCore.java | 10 ++---
.../solr/handler/component/SearchHandler.java | 1 -
.../solr/spelling/suggest/SuggesterFSTTest.java | 2 -
.../solr/spelling/suggest/SuggesterTSTTest.java | 2 -
.../solr/spelling/suggest/SuggesterWFSTTest.java | 2 -
.../org/apache/solr/util/OrderedExecutorTest.java | 2 +-
.../src/java/org/apache/solr/common/ParWork.java | 4 +-
.../apache/solr/common/PerThreadExecService.java | 43 +++++++++++++---------
9 files changed, 35 insertions(+), 34 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/core/CoreContainer.java b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
index 3231d8d..db2c504 100644
--- a/solr/core/src/java/org/apache/solr/core/CoreContainer.java
+++ b/solr/core/src/java/org/apache/solr/core/CoreContainer.java
@@ -395,7 +395,8 @@ public class CoreContainer implements Closeable {
containerProperties.putAll(cfg.getSolrProperties());
- solrCoreLoadExecutor = new PerThreadExecService(ParWork.getRootSharedExecutor(), Math.max(12, Runtime.getRuntime().availableProcessors() / 2), true);
+ solrCoreLoadExecutor = new PerThreadExecService(ParWork.getRootSharedExecutor(), Math.max(12, Runtime.getRuntime().availableProcessors() / 2),
+ true, true);
// if (solrCoreLoadExecutor == null) {
// synchronized (CoreContainer.class) {
// if (solrCoreLoadExecutor == null) {
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 27d93d4..c7ee28d 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1048,7 +1048,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
// until after inform() has been called for all components.
// searchExecutor must be single-threaded for this to work
searcherExecutor.submit(() -> {
- searcherReadyLatch.await(10000, TimeUnit.MILLISECONDS);
+ searcherReadyLatch.await(15000, TimeUnit.MILLISECONDS);
return null;
});
@@ -1089,9 +1089,6 @@ public final class SolrCore implements SolrInfoBean, Closeable {
registerConfListener();
- resourceLoader.inform(this); // last call before the latch is released.
- searcherReadyLatch.countDown();
-
// register any SolrInfoMBeans SolrResourceLoader initialized
//
// this must happen after the latch is released, because a JMX server impl may
@@ -1101,6 +1098,9 @@ public final class SolrCore implements SolrInfoBean, Closeable {
resourceLoader.inform(infoRegistry);
+ resourceLoader.inform(this); // last call before the latch is released.
+ searcherReadyLatch.countDown();
+
// seed version buckets with max from index during core initialization ... requires a searcher!
if (!reload) {
seedVersionBuckets();
@@ -1912,7 +1912,7 @@ public final class SolrCore implements SolrInfoBean, Closeable {
private final LinkedList<RefCounted<SolrIndexSearcher>> _searchers = new LinkedList<>();
private final LinkedList<RefCounted<SolrIndexSearcher>> _realtimeSearchers = new LinkedList<>();
- final ExecutorService searcherExecutor = ParWork.getExecutorService(1, true);
+ final ExecutorService searcherExecutor = ParWork.getExecutorService(1, true, true);
private AtomicInteger onDeckSearchers = new AtomicInteger(); // number of searchers preparing
// Lock ordering: one can acquire the openSearcherLock and then the searcherLock, but not vice-versa.
private final Object searcherLock = new Object(); // the sync object for the searcher
diff --git a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
index e3815f7..55115ad 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
@@ -172,7 +172,6 @@ public class SearchHandler extends RequestHandlerBase implements SolrCoreAware,
@SuppressWarnings({"unchecked"})
private void initComponents() {
- assert core != null;
Object declaredComponents = initArgs.get(INIT_COMPONENTS);
List<String> first = (List<String>) initArgs.get(INIT_FIRST_COMPONENTS);
List<String> last = (List<String>) initArgs.get(INIT_LAST_COMPONENTS);
diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterFSTTest.java b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterFSTTest.java
index 1f9120e..ab489d5 100644
--- a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterFSTTest.java
+++ b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterFSTTest.java
@@ -17,9 +17,7 @@
package org.apache.solr.spelling.suggest;
import org.junit.BeforeClass;
-import org.junit.Ignore;
-@Ignore // nocommit flakey, can hit race where lookup gets hit before build, causing NPE: at org.apache.lucene.search.suggest.fst.FSTCompletionLookup.lookup(FSTCompletionLookup.java:271)
public class SuggesterFSTTest extends SuggesterTest {
@BeforeClass
public static void beforeSuggesterFSTTest() throws Exception {
diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTSTTest.java b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTSTTest.java
index 0a620ab..5ab9640 100644
--- a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTSTTest.java
+++ b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterTSTTest.java
@@ -17,9 +17,7 @@
package org.apache.solr.spelling.suggest;
import org.junit.BeforeClass;
-import org.junit.Ignore;
-@Ignore // nocommit flakey, can hit race where lookup gets hit before build, causing NPE: at org.apache.lucene.search.suggest.fst.FSTCompletionLookup.lookup(FSTCompletionLookup.java:271)
public class SuggesterTSTTest extends SuggesterTest {
@BeforeClass
public static void beforeSuggesterTSTTest() throws Exception {
diff --git a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterWFSTTest.java b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterWFSTTest.java
index a64bfee..fdb6acc 100644
--- a/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterWFSTTest.java
+++ b/solr/core/src/test/org/apache/solr/spelling/suggest/SuggesterWFSTTest.java
@@ -17,9 +17,7 @@
package org.apache.solr.spelling.suggest;
import org.junit.BeforeClass;
-import org.junit.Ignore;
-@Ignore // nocommit flakey, can hit race where lookup gets hit before build, causing NPE: at org.apache.lucene.search.suggest.fst.FSTCompletionLookup.lookup(FSTCompletionLookup.java:271)
public class SuggesterWFSTTest extends SuggesterTest {
@BeforeClass
diff --git a/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java b/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java
index 1f1dde6..389df5b 100644
--- a/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java
+++ b/solr/core/src/test/org/apache/solr/util/OrderedExecutorTest.java
@@ -213,7 +213,7 @@ public class OrderedExecutorTest extends SolrTestCase {
run.put(i, i);
}
OrderedExecutor orderedExecutor = new OrderedExecutor(TEST_NIGHTLY ? 10 : 3,
- ParWork.getExecutorService(TEST_NIGHTLY ? 10 : 3, true));
+ ParWork.getExecutorService(TEST_NIGHTLY ? 10 : 3, true, true));
try {
for (int i = 0; i < (TEST_NIGHTLY ? 1000 : 55); i++) {
int key = random().nextInt(N);
diff --git a/solr/solrj/src/java/org/apache/solr/common/ParWork.java b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
index da81dbe..18473d8 100644
--- a/solr/solrj/src/java/org/apache/solr/common/ParWork.java
+++ b/solr/solrj/src/java/org/apache/solr/common/ParWork.java
@@ -515,8 +515,8 @@ public class ParWork implements Closeable {
return new PerThreadExecService(getRootSharedExecutor(), maximumPoolSize);
}
- public static ExecutorService getExecutorService(int maximumPoolSize, boolean noCallerRuns) {
- return new PerThreadExecService(getRootSharedExecutor(), maximumPoolSize, noCallerRuns);
+ public static ExecutorService getExecutorService(int maximumPoolSize, boolean noCallerRunsAllowed, boolean noCallerRunsAvailableLimit) {
+ return new PerThreadExecService(getRootSharedExecutor(), maximumPoolSize, noCallerRunsAllowed, noCallerRunsAvailableLimit);
}
private void handleObject(AtomicReference<Throwable> exception, final TimeTracker workUnitTracker, ParObject ob) {
diff --git a/solr/solrj/src/java/org/apache/solr/common/PerThreadExecService.java b/solr/solrj/src/java/org/apache/solr/common/PerThreadExecService.java
index d2ea1e9..3df89ef 100644
--- a/solr/solrj/src/java/org/apache/solr/common/PerThreadExecService.java
+++ b/solr/solrj/src/java/org/apache/solr/common/PerThreadExecService.java
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.concurrent.AbstractExecutorService;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
import java.util.concurrent.FutureTask;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RunnableFuture;
@@ -19,7 +18,6 @@ import org.apache.solr.common.util.ObjectReleaseTracker;
import org.apache.solr.common.util.SysStats;
import org.apache.solr.common.util.TimeOut;
import org.apache.solr.common.util.TimeSource;
-import org.eclipse.jetty.util.BlockingArrayQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -32,7 +30,8 @@ public class PerThreadExecService extends AbstractExecutorService {
private final ExecutorService service;
private final int maxSize;
- private final boolean noCallerRuns;
+ private final boolean noCallerRunsAllowed;
+ private final boolean noCallerRunsAvailableLimit;
private volatile boolean terminated;
private volatile boolean shutdown;
@@ -113,13 +112,14 @@ public class PerThreadExecService extends AbstractExecutorService {
}
public PerThreadExecService(ExecutorService service, int maxSize) {
- this(service, maxSize, false);
+ this(service, maxSize, false, false);
}
- public PerThreadExecService(ExecutorService service, int maxSize, boolean noCallerRuns) {
+ public PerThreadExecService(ExecutorService service, int maxSize, boolean noCallerRunsAllowed, boolean noCallerRunsAvailableLimit) {
assert service != null;
assert (closeTracker = new CloseTracker()) != null;
- this.noCallerRuns = noCallerRuns;
+ this.noCallerRunsAllowed = noCallerRunsAllowed;
+ this.noCallerRunsAvailableLimit = noCallerRunsAvailableLimit;
//assert ObjectReleaseTracker.track(this);
if (maxSize == -1) {
this.maxSize = MAX_AVAILABLE;
@@ -131,7 +131,7 @@ public class PerThreadExecService extends AbstractExecutorService {
@Override
protected <T> RunnableFuture<T> newTaskFor(Runnable runnable, T value) {
- if (noCallerRuns) {
+ if (noCallerRunsAllowed) {
return (RunnableFuture) new ParWork.SolrFutureTask(runnable, value);
}
return new FutureTask(runnable, value);
@@ -140,7 +140,7 @@ public class PerThreadExecService extends AbstractExecutorService {
@Override
protected <T> RunnableFuture<T> newTaskFor(Callable<T> callable) {
- if (noCallerRuns || callable instanceof ParWork.NoLimitsCallable) {
+ if (noCallerRunsAllowed || callable instanceof ParWork.NoLimitsCallable) {
return (RunnableFuture) new ParWork.SolrFutureTask(callable);
}
return new FutureTask(callable);
@@ -226,19 +226,28 @@ public class PerThreadExecService extends AbstractExecutorService {
if (shutdown) {
throw new RejectedExecutionException(closeTracker.getCloseStack());
-// runIt(runnable, false, true, true);
-// return;
}
running.incrementAndGet();
if (runnable instanceof ParWork.SolrFutureTask) {
+ if (noCallerRunsAvailableLimit) {
+ try {
+ available.acquire();
+ } catch (InterruptedException e) {
+ throw new RejectedExecutionException("Interrupted");
+ }
+ }
try {
service.execute(new Runnable() {
@Override
public void run() {
- runIt(runnable, false, false, false);
+ runIt(runnable, noCallerRunsAvailableLimit, false);
+ if (noCallerRunsAvailableLimit) {
+ available.release();
+ }
}
});
} catch (Exception e) {
+ log.error("", e);
running.decrementAndGet();
synchronized (awaitTerminate) {
awaitTerminate.notifyAll();
@@ -247,26 +256,24 @@ public class PerThreadExecService extends AbstractExecutorService {
return;
}
- if (runnable instanceof ParWork.SolrFutureTask) {
- } else {
if (!checkLoad()) {
- runIt(runnable, false, true, false);
+ runIt(runnable, false, false);
return;
}
if (!available.tryAcquire()) {
- runIt(runnable, false, true, false);
+ runIt(runnable, false, false);
return;
}
- }
+
Runnable finalRunnable = runnable;
try {
service.execute(new Runnable() {
@Override
public void run() {
- runIt(finalRunnable, true, false, false);
+ runIt(finalRunnable, true, false);
}
});
} catch (Exception e) {
@@ -300,7 +307,7 @@ public class PerThreadExecService extends AbstractExecutorService {
// }
}
- private void runIt(Runnable runnable, boolean acquired, boolean callThreadRuns, boolean alreadyShutdown) {
+ private void runIt(Runnable runnable, boolean acquired, boolean alreadyShutdown) {
try {
runnable.run();
} finally {