lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctarg...@apache.org
Subject [05/50] [abbrv] lucene-solr:jira/solr-10290: SOLR-10615: latching SDF.doFilter() on init(); respond 404 instead of 500 in case of init failures or corecontainer shutdown.
Date Wed, 10 May 2017 12:34:52 GMT
SOLR-10615: latching SDF.doFilter() on init(); respond 404 instead of 500 in case of init failures
or corecontainer shutdown.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/93962273
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/93962273
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/93962273

Branch: refs/heads/jira/solr-10290
Commit: 93962273a9fa79c9714edeb45df9cdb0f7e744e6
Parents: d22431b
Author: Mikhail Khludnev <mkhl@apache.org>
Authored: Sat May 6 00:36:00 2017 +0300
Committer: Cassandra Targett <cassandra.targett@lucidworks.com>
Committed: Wed May 10 07:30:32 2017 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                    |  4 ++++
 .../org/apache/solr/servlet/SolrDispatchFilter.java | 16 +++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/93962273/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 3fbfc96..38aac79 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -302,6 +302,10 @@ Bug Fixes
 
 * SOLR-10549: The new 'large' attribute had been forgotten in /schema/fieldtypes?showDefaults=true
(David Smiley)
 
+* SOLR-10615: requests are suspended until SolrDispatchFilter initialization is completed.

+  After core container shutdown or severe initialization problem Solr responds with 
+  http stauts 404 Not Found instead of 500 as it was before (Mikhail Khludnev) 
+
 Other Changes
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/93962273/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
index a4c9504..24440e7 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -29,6 +29,7 @@ import java.util.Arrays;
 import java.util.Locale;
 import java.util.Properties;
 import java.util.Set;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.regex.Matcher;
@@ -41,6 +42,7 @@ import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
+import javax.servlet.UnavailableException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequestWrapper;
 import javax.servlet.http.HttpServletResponse;
@@ -88,6 +90,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
   protected volatile CoreContainer cores;
+  protected final CountDownLatch init = new CountDownLatch(1);
 
   protected String abortErrorMessage = null;
   protected HttpClient httpClient;
@@ -187,6 +190,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
     }finally{
       log.trace("SolrDispatchFilter.init() done");
       this.cores = coresInit; // crucially final assignment 
+      init.countDown();
     }
   }
 
@@ -318,9 +322,15 @@ public class SolrDispatchFilter extends BaseSolrFilter {
     try {
 
       if (cores == null || cores.isShutDown()) {
-        log.error("Error processing the request. CoreContainer is either not initialized
or shutting down.");
-        throw new SolrException(ErrorCode.SERVICE_UNAVAILABLE,
-            "Error processing the request. CoreContainer is either not initialized or shutting
down.");
+        try {
+          init.await();
+        } catch (InterruptedException e) { //well, no wait then
+        }
+        final String msg = "Error processing the request. CoreContainer is either not initialized
or shutting down.";
+        if (cores == null || cores.isShutDown()) {
+          log.error(msg);
+          throw new UnavailableException(msg);
+        }
       }
 
       AtomicReference<ServletRequest> wrappedRequest = new AtomicReference<>();


Mime
View raw message