You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2014/10/09 07:33:11 UTC
svn commit: r1630286 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/CHANGES.txt solr/solrj/
solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
Author: shalin
Date: Thu Oct 9 05:33:11 2014
New Revision: 1630286
URL: http://svn.apache.org/r1630286
Log:
SOLR-6603: LBHttpSolrServer - lazily allocate skipped-zombie-servers list. (This closes #97)
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/solr/solrj/ (props changed)
lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1630286&r1=1630285&r2=1630286&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Thu Oct 9 05:33:11 2014
@@ -187,6 +187,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
----------------------
Modified: lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1630286&r1=1630285&r2=1630286&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Thu Oct 9 05:33:11 2014
@@ -286,7 +286,7 @@ public class LBHttpSolrServer extends So
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 So
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 So
}
// 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
+ }
}
}