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

[40/50] [abbrv] lucene-solr git commit: SOLR-8422: When authentication enabled, requests fail if sent to a node that doesn't host the collection.

SOLR-8422: When authentication enabled, requests fail if sent to a node that doesn't host the collection.


git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene_solr_5_4@1724193 13f79535-47bb-0310-9956-ffa450edef68


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

Branch: refs/heads/branch_5_4
Commit: e3c5b6de1cf4607129dde621f6b3ec57717eeda1
Parents: b4bbd02
Author: Adrien Grand <jp...@apache.org>
Authored: Tue Jan 12 10:08:56 2016 +0000
Committer: Adrien Grand <jp...@apache.org>
Committed: Tue Jan 12 10:08:56 2016 +0000

----------------------------------------------------------------------
 solr/CHANGES.txt                                              | 3 +++
 .../src/java/org/apache/solr/servlet/SolrDispatchFilter.java  | 4 +++-
 .../src/java/org/apache/solr/common/util/ExecutorUtil.java    | 7 +++++++
 3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e3c5b6de/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 2b64fd7..5c32710 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -483,6 +483,9 @@ Bug Fixes
 
 * SOLR-8269: Upgrade commons-collections to 3.2.2. This fixes a known serialization vulnerability (janhoy)
 
+* SOLR-8422: When authentication enabled, requests fail if sent to a node that doesn't host
+  the collection (noble)
+
 ==================  5.3.1 ==================
 
 Bug Fixes

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e3c5b6de/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 fa2cb4c..13b9d9e 100644
--- a/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
+++ b/solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
@@ -216,8 +216,9 @@ public class SolrDispatchFilter extends BaseSolrFilter {
         }
       }
     }
-    
+
     HttpSolrCall call = getHttpSolrCall((HttpServletRequest) request, (HttpServletResponse) response, retry);
+    ExecutorUtil.setServerThreadFlag(Boolean.TRUE);
     try {
       Action result = call.call();
       switch (result) {
@@ -233,6 +234,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
       }  
     } finally {
       call.destroy();
+      ExecutorUtil.setServerThreadFlag(null);
     }
   }
   

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/e3c5b6de/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
index a7b7579..66b7979 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/ExecutorUtil.java
@@ -255,8 +255,15 @@ public class ExecutorUtil {
 
   private static final ThreadLocal<Boolean> isServerPool = new ThreadLocal<>();
 
+  /// this tells whether a thread is owned/run by solr or not.
   public static boolean isSolrServerThread() {
     return Boolean.TRUE.equals(isServerPool.get());
   }
 
+  public static void setServerThreadFlag(Boolean flag) {
+    if (flag == null) isServerPool.remove();
+    else isServerPool.set(flag);
+
+  }
+
 }