mirror of https://github.com/apache/lucene.git
SOLR-6603: LBHttpSolrServer - lazily allocate skipped-zombie-servers list. (This closes #97)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1630285 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d51eef911f
commit
d5191d5674
|
@ -214,6 +214,12 @@ Bug Fixes
|
|||
* SOLR-6545: Query field list with wild card on dynamic field fails.
|
||||
(Burke Webster, Xu Zhang, shalin)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
* SOLR-6603: LBHttpSolrServer - lazily allocate skipped-zombie-servers list.
|
||||
(Christine Poerschke via shalin)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ public class LBHttpSolrServer extends SolrServer {
|
|||
Rsp rsp = new Rsp();
|
||||
Exception ex = null;
|
||||
boolean isUpdate = req.request instanceof IsUpdateRequest;
|
||||
List<ServerWrapper> skipped = new ArrayList<>(req.getNumDeadServersToTry());
|
||||
List<ServerWrapper> skipped = null;
|
||||
|
||||
for (String serverStr : req.getServers()) {
|
||||
serverStr = normalize(serverStr);
|
||||
|
@ -294,8 +294,16 @@ public class LBHttpSolrServer extends SolrServer {
|
|||
ServerWrapper wrapper = zombieServers.get(serverStr);
|
||||
if (wrapper != null) {
|
||||
// System.out.println("ZOMBIE SERVER QUERIED: " + serverStr);
|
||||
if (skipped.size() < req.getNumDeadServersToTry())
|
||||
skipped.add(wrapper);
|
||||
final int numDeadServersToTry = req.getNumDeadServersToTry();
|
||||
if (numDeadServersToTry > 0) {
|
||||
if (skipped == null) {
|
||||
skipped = new ArrayList<>(numDeadServersToTry);
|
||||
skipped.add(wrapper);
|
||||
}
|
||||
else if (skipped.size() < numDeadServersToTry) {
|
||||
skipped.add(wrapper);
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
rsp.server = serverStr;
|
||||
|
@ -308,10 +316,12 @@ public class LBHttpSolrServer extends SolrServer {
|
|||
}
|
||||
|
||||
// try the servers we previously skipped
|
||||
for (ServerWrapper wrapper : skipped) {
|
||||
ex = doRequest(wrapper.solrServer, req, rsp, isUpdate, true, wrapper.getKey());
|
||||
if (ex == null) {
|
||||
return rsp; // SUCCESS
|
||||
if (skipped != null) {
|
||||
for (ServerWrapper wrapper : skipped) {
|
||||
ex = doRequest(wrapper.solrServer, req, rsp, isUpdate, true, wrapper.getKey());
|
||||
if (ex == null) {
|
||||
return rsp; // SUCCESS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue