You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ds...@apache.org on 2017/06/29 03:44:11 UTC
lucene-solr:master: SOLR-6807: fix _stateVer_ param check to not
depend on handleSelect setting
Repository: lucene-solr
Updated Branches:
refs/heads/master d0c86d078 -> 811621c6e
SOLR-6807: fix _stateVer_ param check to not depend on handleSelect setting
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/811621c6
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/811621c6
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/811621c6
Branch: refs/heads/master
Commit: 811621c6ea63318fb593a08970e8652b2501af25
Parents: d0c86d0
Author: David Smiley <ds...@apache.org>
Authored: Wed Jun 28 23:44:03 2017 -0400
Committer: David Smiley <ds...@apache.org>
Committed: Wed Jun 28 23:44:03 2017 -0400
----------------------------------------------------------------------
solr/CHANGES.txt | 3 +++
.../src/java/org/apache/solr/servlet/HttpSolrCall.java | 13 ++++++-------
2 files changed, 9 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/811621c6/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 214b82e..39fc14c 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -229,6 +229,9 @@ Bug Fixes
* SOLR-10506: Fix memory leak (upon collection reload or ZooKeeper session expiry) in ZkIndexSchemaReader.
(Torsten Bøgh Köster, Christine Poerschke, Jörg Rathlev, Mike Drob)
+* SOLR-6807: CloudSolrClient's ZK state version check with the server was ignored when handleSelect=false
+ (David Smiley)
+
Optimizations
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/811621c6/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 5542d4c..a548c05 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -327,6 +327,8 @@ public class HttpSolrCall {
solrReq = parser.parse(core, path, req);
}
+ invalidStates = checkStateVersionsAreValid(solrReq.getParams().get(CloudSolrClient.STATE_VERSION));
+
if (usingAliases) {
processAliases(aliases, collectionsList);
}
@@ -388,8 +390,6 @@ public class HttpSolrCall {
/**
* Extract handler from the URL path if not set.
- * This returns true if the action is set.
- *
*/
protected void extractHandlerFromURLPath(SolrRequestParsers parser) throws Exception {
if (handler == null && path.length() > 1) { // don't match "" or "/" as valid path
@@ -411,14 +411,12 @@ public class HttpSolrCall {
return;
}
}
-
}
- // no handler yet but allowed to handle select; let's check
+ // no handler yet but <requestDispatcher> allows us to handle /select with a 'qt' param
if (handler == null && parser.isHandleSelect()) {
if ("/select".equals(path) || "/select/".equals(path)) {
solrReq = parser.parse(core, path, req);
- invalidStates = checkStateIsValid(solrReq.getParams().get(CloudSolrClient.STATE_VERSION));
String qt = solrReq.getParams().get(CommonParams.QT);
handler = core.getRequestHandler(qt);
if (handler == null) {
@@ -438,7 +436,7 @@ public class HttpSolrCall {
if (core == null && idx > 0) {
coreUrl = getRemotCoreUrl(corename, origCorename);
// don't proxy for internal update requests
- invalidStates = checkStateIsValid(queryParams.get(CloudSolrClient.STATE_VERSION));
+ invalidStates = checkStateVersionsAreValid(queryParams.get(CloudSolrClient.STATE_VERSION));
if (coreUrl != null
&& queryParams
.get(DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM) == null) {
@@ -813,7 +811,8 @@ public class HttpSolrCall {
}
}
- private Map<String, Integer> checkStateIsValid(String stateVer) {
+ /** Returns null if the state ({@link CloudSolrClient#STATE_VERSION}) is good; otherwise returns state problems. */
+ private Map<String, Integer> checkStateVersionsAreValid(String stateVer) {
Map<String, Integer> result = null;
String[] pairs;
if (stateVer != null && !stateVer.isEmpty() && cores.isZooKeeperAware()) {