mirror of https://github.com/apache/lucene.git
SOLR-3929: support configuring IndexWriter max thread count in solrconfig
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1397589 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6dae6204f7
commit
1cadf9c5bb
|
@ -42,6 +42,10 @@ New Features
|
|||
values of a multiValued field in their original order when highlighting.
|
||||
(Joel Bernstein via yonik)
|
||||
|
||||
* SOLR-3929
|
||||
support configuring IndexWriter max thread count in solrconfig
|
||||
|
||||
(phunt via Mark Miller)
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
|
|
@ -44,6 +44,7 @@ public class SolrIndexConfig {
|
|||
public final boolean useCompoundFile;
|
||||
public final int maxBufferedDocs;
|
||||
public final int maxMergeDocs;
|
||||
public final int maxIndexingThreads;
|
||||
public final int mergeFactor;
|
||||
|
||||
public final double ramBufferSizeMB;
|
||||
|
@ -71,6 +72,7 @@ public class SolrIndexConfig {
|
|||
useCompoundFile = false;
|
||||
maxBufferedDocs = -1;
|
||||
maxMergeDocs = -1;
|
||||
maxIndexingThreads = IndexWriterConfig.DEFAULT_MAX_THREAD_STATES;
|
||||
mergeFactor = -1;
|
||||
ramBufferSizeMB = 32;
|
||||
writeLockTimeout = -1;
|
||||
|
@ -116,6 +118,7 @@ public class SolrIndexConfig {
|
|||
useCompoundFile=solrConfig.getBool(prefix+"/useCompoundFile", def.useCompoundFile);
|
||||
maxBufferedDocs=solrConfig.getInt(prefix+"/maxBufferedDocs",def.maxBufferedDocs);
|
||||
maxMergeDocs=solrConfig.getInt(prefix+"/maxMergeDocs",def.maxMergeDocs);
|
||||
maxIndexingThreads=solrConfig.getInt(prefix+"/maxIndexingThreads",def.maxIndexingThreads);
|
||||
mergeFactor=solrConfig.getInt(prefix+"/mergeFactor",def.mergeFactor);
|
||||
ramBufferSizeMB = solrConfig.getDouble(prefix+"/ramBufferSizeMB", def.ramBufferSizeMB);
|
||||
|
||||
|
@ -176,6 +179,10 @@ public class SolrIndexConfig {
|
|||
iwc.setMergePolicy(buildMergePolicy(schema));
|
||||
iwc.setMergeScheduler(buildMergeScheduler(schema));
|
||||
|
||||
if (maxIndexingThreads != -1) {
|
||||
iwc.setMaxThreadStates(maxIndexingThreads);
|
||||
}
|
||||
|
||||
return iwc;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
(the "License"); you may not use this file except in compliance with
|
||||
the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<config>
|
||||
<dataDir>${solr.data.dir:}</dataDir>
|
||||
|
||||
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
|
||||
|
||||
<indexConfig>
|
||||
<maxIndexingThreads>123</maxIndexingThreads>
|
||||
</indexConfig>
|
||||
</config>
|
|
@ -0,0 +1,36 @@
|
|||
package org.apache.solr.core;
|
||||
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
public class TestSolrIndexConfig extends SolrTestCaseJ4 {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
initCore("solrconfig-indexconfig.xml","schema.xml");
|
||||
}
|
||||
|
||||
public void testIndexConfig() throws Exception {
|
||||
IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getSchema());
|
||||
|
||||
assertEquals(123, iwc.getMaxThreadStates());
|
||||
}
|
||||
}
|
|
@ -136,6 +136,12 @@
|
|||
<!-- Maximum time to wait for a write lock (ms) for an IndexWriter. Default: 1000 -->
|
||||
<!-- <writeLockTimeout>1000</writeLockTimeout> -->
|
||||
|
||||
<!-- The maximum number of simultaneous threads that may be
|
||||
indexing documents at once in IndexWriter; if more than this
|
||||
many threads arrive they will wait for others to finish.
|
||||
Default in Solr/Lucene is 8. -->
|
||||
<!-- <maxIndexingThreads>8</maxIndexingThreads> -->
|
||||
|
||||
<!-- Expert: Enabling compound file will use less files for the index,
|
||||
using fewer file descriptors on the expense of performance decrease.
|
||||
Default in Lucene is "true". Default in Solr is "false" (since 3.6) -->
|
||||
|
|
Loading…
Reference in New Issue