SOLR-5943: SolrCmdDistributor does not distribute the openSearcher parameter

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1584083 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2014-04-02 16:31:47 +00:00
parent 3fd2922341
commit a9e04127df
4 changed files with 33 additions and 2 deletions

View File

@ -183,6 +183,9 @@ Bug Fixes
* SOLR-5915: Attempts to specify the parserImpl for
solr.PreAnalyzedField fieldtype failed. (Mike McCandless)
* SOLR-5943: SolrCmdDistributor does not distribute the openSearcher parameter.
(ludovic Boutros via shalin)
Optimizations
----------------------
* SOLR-1880: Distributed Search skips GET_FIELDS stage if EXECUTE_QUERY

View File

@ -21,7 +21,6 @@ import java.io.IOException;
import java.net.ConnectException;
import java.util.ArrayList;
import java.util.List;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
@ -206,7 +205,7 @@ public class SolrCmdDistributor {
void addCommit(UpdateRequest ureq, CommitUpdateCommand cmd) {
if (cmd == null) return;
ureq.setAction(cmd.optimize ? AbstractUpdateRequest.ACTION.OPTIMIZE
: AbstractUpdateRequest.ACTION.COMMIT, false, cmd.waitSearcher, cmd.maxOptimizeSegments, cmd.softCommit, cmd.expungeDeletes);
: AbstractUpdateRequest.ACTION.COMMIT, false, cmd.waitSearcher, cmd.maxOptimizeSegments, cmd.softCommit, cmd.expungeDeletes, cmd.openSearcher);
}
private void submit(Req req) {

View File

@ -25,11 +25,13 @@ import org.apache.solr.client.solrj.SolrServerException;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.HttpSolrServer;
import org.apache.solr.client.solrj.request.LukeRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrDocumentList;
import org.apache.solr.common.cloud.ZkCoreNodeProps;
import org.apache.solr.common.cloud.ZkNodeProps;
import org.apache.solr.common.cloud.ZkStateReader;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.UpdateParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.core.ConfigSolr;
import org.apache.solr.core.CoreContainer;
@ -321,6 +323,8 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
testOneRetry();
testRetryNodeAgainstBadAddress();
testRetryNodeWontRetrySocketError();
testDistribOpenSearcher();
}
private void testMaxRetries() throws IOException {
@ -511,4 +515,23 @@ public class SolrCmdDistributorTest extends BaseDistributedSearchTestCase {
updateShardHandler.close();
super.tearDown();
}
private void testDistribOpenSearcher() {
SolrCmdDistributor cmdDistrib = new SolrCmdDistributor(updateShardHandler);
UpdateRequest updateRequest = new UpdateRequest();
CommitUpdateCommand ccmd = new CommitUpdateCommand(null, false);
//test default value (should be true)
cmdDistrib.addCommit(updateRequest, ccmd);
boolean openSearcher = updateRequest.getParams().getBool(UpdateParams.OPEN_SEARCHER,false);
assertTrue(openSearcher);
//test openSearcher = false
ccmd.openSearcher = false;
cmdDistrib.addCommit(updateRequest, ccmd);
openSearcher = updateRequest.getParams().getBool(UpdateParams.OPEN_SEARCHER,true);
assertFalse(openSearcher);
}
}

View File

@ -83,6 +83,12 @@ public abstract class AbstractUpdateRequest extends SolrRequest implements IsUpd
return setAction(action, waitFlush, waitSearcher,maxSegments,false,expungeDeletes);
}
public AbstractUpdateRequest setAction(ACTION action, boolean waitFlush, boolean waitSearcher, int maxSegments, boolean softCommit, boolean expungeDeletes, boolean openSearcher) {
setAction(action, waitFlush, waitSearcher, maxSegments, softCommit, expungeDeletes);
params.set(UpdateParams.OPEN_SEARCHER, String.valueOf(openSearcher));
return this;
}
/**
* @since Solr 1.4
*/