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/trunk@1721142 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Noble Paul 2015-12-21 12:37:27 +00:00
parent 7c55b295c3
commit 0afacabbcd
3 changed files with 13 additions and 1 deletions

View File

@ -286,6 +286,9 @@ Bug Fixes
* SOLR-8015: HdfsLock may fail to close a FileSystem instance if it cannot immediately
obtain an index lock. (Mark Miller)
* SOLR-8422: When authentication enabled, requests fail if sent to a node that doesn't host
the collection (noble)
Other Changes
----------------------

View File

@ -219,8 +219,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) {
@ -236,6 +237,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
}
} finally {
call.destroy();
ExecutorUtil.setServerThreadFlag(null);
}
}

View File

@ -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);
}
}