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 2021/02/25 18:01:43 UTC
[lucene-solr] branch reference_impl_dev updated: @1399 Some test
improvements.
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 d0e7484 @1399 Some test improvements.
d0e7484 is described below
commit d0e7484cfd74641070e905e956fe3d3139472ab6
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Feb 25 12:01:16 2021 -0600
@1399 Some test improvements.
Took 16 minutes
---
.../src/java/org/apache/solr/cloud/RecoveryStrategy.java | 5 +++++
.../src/test/org/apache/solr/cloud/CleanupOldIndexTest.java | 2 --
.../solr/handler/component/TermVectorComponentTest.java | 8 +++++++-
.../src/java/org/apache/solr/common/SolrException.java | 13 +++++++++++++
4 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
index 1a66fd8..6f2eaf4 100644
--- a/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
+++ b/solr/core/src/java/org/apache/solr/cloud/RecoveryStrategy.java
@@ -64,6 +64,7 @@ import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
@@ -234,6 +235,10 @@ public class RecoveryStrategy implements Runnable, Closeable {
leaderUrl = leader.getCoreUrl();
commitOnLeader(leaderUrl);
} catch (Exception e) {
+ if (e instanceof SolrException && ((SolrException) e).getRootCause() instanceof RejectedExecutionException) {
+ throw new AlreadyClosedException("An executor is shutdown already");
+ }
+
log.error("Commit on leader failed", e);
throw new SolrException(ErrorCode.SERVER_ERROR, e);
}
diff --git a/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java b/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
index 581159e..5052f83 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
@@ -134,8 +134,6 @@ public class CleanupOldIndexTest extends SolrCloudTestCase {
TimeOut timeout2 = new TimeOut(500, TimeUnit.MILLISECONDS, TimeSource.NANO_TIME);
timeout2.waitFor("", () -> !oldIndexDir2.exists());
-
- jetty.stop();
}
diff --git a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java
index d18728b..afb8325 100644
--- a/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java
+++ b/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentTest.java
@@ -22,6 +22,7 @@ import java.util.List;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.params.TermVectorParams;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -34,7 +35,7 @@ public class TermVectorComponentTest extends SolrTestCaseJ4 {
// ensure that we operate correctly with all valid combinations of the uniqueKey being
// stored and/or in docValues.
@BeforeClass
- public static void beforeClass() throws Exception {
+ public static void beforeTermVectorComponentTest() throws Exception {
switch (random().nextInt(3)) {
case 0:
System.setProperty("solr.tests.id.stored", "true");
@@ -55,6 +56,11 @@ public class TermVectorComponentTest extends SolrTestCaseJ4 {
initCore("solrconfig.xml", "schema.xml");
}
+ @AfterClass
+ public static void afterTermVectorComponentTest() throws Exception {
+ deleteCore();
+ }
+
static String tv = "/tvrh";
@Test
diff --git a/solr/solrj/src/java/org/apache/solr/common/SolrException.java b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
index 37da861..a14d35e 100644
--- a/solr/solrj/src/java/org/apache/solr/common/SolrException.java
+++ b/solr/solrj/src/java/org/apache/solr/common/SolrException.java
@@ -256,4 +256,17 @@ public class SolrException extends RuntimeException {
}
}
+ public Throwable getRootCause() {
+ Throwable t = this;
+ while (true) {
+ Throwable cause = t.getCause();
+ if (cause!=null) {
+ t = cause;
+ } else {
+ break;
+ }
+ }
+ return t;
+ }
+
}