You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2014/09/13 10:51:39 UTC
svn commit: r1624717 - in
/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl:
CloudSolrServer.java LBHttpSolrServer.java
Author: noble
Date: Sat Sep 13 08:51:39 2014
New Revision: 1624717
URL: http://svn.apache.org/r1624717
Log:
SOLR-6514
Modified:
lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1624717&r1=1624716&r2=1624717&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Sat Sep 13 08:51:39 2014
@@ -182,7 +182,7 @@ public class CloudSolrServer extends Sol
this.lbServer.setParser(new BinaryResponseParser());
this.updatesToLeaders = true;
shutdownLBHttpSolrServer = true;
- setupStateVerParamOnQueryString(lbServer);
+ lbServer.addQueryParams(STATE_VERSION);
}
@@ -201,7 +201,7 @@ public class CloudSolrServer extends Sol
this.lbServer.setParser(new BinaryResponseParser());
this.updatesToLeaders = updatesToLeaders;
shutdownLBHttpSolrServer = true;
- setupStateVerParamOnQueryString(lbServer);
+ lbServer.addQueryParams(STATE_VERSION);
}
/**Sets the cache ttl for DocCollection Objects cached . This is only applicable for collections which are persisted outside of clusterstate.json
@@ -237,24 +237,10 @@ public class CloudSolrServer extends Sol
this.lbServer = lbServer;
this.updatesToLeaders = updatesToLeaders;
shutdownLBHttpSolrServer = false;
- setupStateVerParamOnQueryString(lbServer);
+ lbServer.addQueryParams(STATE_VERSION);
}
- /**
- * Used internally to setup the _stateVer_ param to be sent in the query string of requests
- * coming from this instance.
- */
- protected void setupStateVerParamOnQueryString(LBHttpSolrServer lbServer) {
- // setup the stateVer param to be passed in the query string of every request
- Set<String> queryStringParams = lbServer.getQueryParams();
- if (queryStringParams == null) {
- queryStringParams = new HashSet<String>(2);
- lbServer.setQueryParams(queryStringParams);
- }
- queryStringParams.add(STATE_VERSION);
- }
-
public ResponseParser getParser() {
return lbServer.getParser();
}
@@ -701,6 +687,7 @@ public class CloudSolrServer extends Sol
boolean stateWasStale = false;
if (retryCount < MAX_STALE_RETRIES &&
+ requestedCollections != null &&
!requestedCollections.isEmpty() &&
SolrException.ErrorCode.getErrorCode(errorCode) == SolrException.ErrorCode.INVALID_STATE)
{
@@ -883,9 +870,6 @@ public class CloudSolrServer extends Sol
}
- // System.out.println("########################## MAKING REQUEST TO " +
- // theUrlList);
-
LBHttpSolrServer.Req req = new LBHttpSolrServer.Req(request, theUrlList);
LBHttpSolrServer.Rsp rsp = lbServer.request(req);
return rsp.getResponse();
@@ -902,16 +886,13 @@ public class CloudSolrServer extends Sol
Aliases aliases = zkStateReader.getAliases();
String alias = aliases.getCollectionAlias(collectionName);
if (alias != null) {
- List<String> aliasList = StrUtils.splitSmart(alias, ",", true);
+ List<String> aliasList = StrUtils.splitSmart(alias, ",", true);
collectionsList.addAll(aliasList);
continue;
}
- DocCollection docCollection = getDocCollection(clusterState, collection);
- if (docCollection == null) {
throw new SolrException(ErrorCode.BAD_REQUEST, "Collection not found: " + collectionName);
}
- }
collectionsList.add(collectionName);
}
@@ -957,7 +938,7 @@ public class CloudSolrServer extends Sol
DocCollection col = clusterState.getCollectionOrNull(collection);
if(col == null ) return null;
- collectionStateCache.put(collection, new ExpiringCachedDocCollection(col));
+ if(col.getStateFormat() >1) collectionStateCache.put(collection, new ExpiringCachedDocCollection(col));
return col;
}
Modified: lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1624717&r1=1624716&r2=1624717&view=diff
==============================================================================
--- lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/trunk/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Sat Sep 13 08:51:39 2014
@@ -106,7 +106,7 @@ public class LBHttpSolrServer extends So
private volatile ResponseParser parser;
private volatile RequestWriter requestWriter;
- private Set<String> queryParams;
+ private Set<String> queryParams = new HashSet<>();
static {
solrQuery.setRows(0);
@@ -244,6 +244,9 @@ public class LBHttpSolrServer extends So
public void setQueryParams(Set<String> queryParams) {
this.queryParams = queryParams;
}
+ public void addQueryParams(String queryOnlyParam) {
+ this.queryParams.add(queryOnlyParam) ;
+ }
public static String normalize(String server) {
if (server.endsWith("/"))