The queue size for ConcurrentUpdateSolrClient should default to 10 instead of throwing an IllegalArgumentException

This commit is contained in:
Anshum Gupta 2017-12-01 14:24:15 -08:00
parent f2dd3c5f85
commit 8c855fa287
3 changed files with 13 additions and 2 deletions

View File

@ -153,6 +153,9 @@ Bug Fixes
* SOLR-11608: Correctly parse the new core-name in the V2 core rename API. * SOLR-11608: Correctly parse the new core-name in the V2 core rename API.
(Jason Gerlowski via Anshum Gupta) (Jason Gerlowski via Anshum Gupta)
* SOLR-11256: The queue size for ConcurrentUpdateSolrClient should default to 10 instead of throwing an
IllegalArgumentException. (Jason Gerlowski, Anshum Gupta)
Optimizations Optimizations
---------------------- ----------------------
* SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr * SOLR-11285: Refactor autoscaling framework to avoid direct references to Zookeeper and Solr

View File

@ -772,7 +772,7 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
*/ */
public static class Builder extends SolrClientBuilder<Builder> { public static class Builder extends SolrClientBuilder<Builder> {
protected String baseSolrUrl; protected String baseSolrUrl;
protected int queueSize; protected int queueSize = 10;
protected int threadCount; protected int threadCount;
protected ExecutorService executorService; protected ExecutorService executorService;
protected boolean streamDeletes; protected boolean streamDeletes;
@ -803,7 +803,7 @@ public class ConcurrentUpdateSolrClient extends SolrClient {
} }
/** /**
* The number of documents to batch together before sending to Solr. * The number of documents to batch together before sending to Solr. If not set, this defaults to 10.
*/ */
public Builder withQueueSize(int queueSize) { public Builder withQueueSize(int queueSize) {
if (queueSize <= 0) { if (queueSize <= 0) {

View File

@ -30,4 +30,12 @@ public class ConcurrentUpdateSolrClientBuilderTest extends LuceneTestCase {
public void testRejectsMissingBaseSolrUrl() { public void testRejectsMissingBaseSolrUrl() {
new Builder(null).build(); new Builder(null).build();
} }
@Test
public void testMissingQueueSize() {
try (ConcurrentUpdateSolrClient client = new Builder("someurl").build()){
// Do nothing as we just need to test that the only mandatory parameter for building the client
// is the baseSolrUrl
}
}
} }