mirror of https://github.com/apache/lucene.git
SOLR-5118: more testing of edge case and some error conditions
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1518352 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2dc5b2a02c
commit
5e70c629a4
|
@ -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>
|
||||||
|
|
||||||
|
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
|
||||||
|
<indexConfig>
|
||||||
|
<mergedSegmentWarmer class="org.apache.lucene.index.SimpleMergedSegmentWarmer"/>
|
||||||
|
<reopenReaders>false</reopenReaders> <!-- BAD -->
|
||||||
|
</indexConfig>
|
||||||
|
</config>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?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>
|
||||||
|
<luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
|
||||||
|
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
|
||||||
|
|
||||||
|
<indexConfig>
|
||||||
|
<!-- set some values to -1 to force the use of internal lucene defaults -->
|
||||||
|
<maxBufferedDocs>-1</maxBufferedDocs>
|
||||||
|
<ramBufferSizeMB>-1</ramBufferSizeMB>
|
||||||
|
<maxIndexingThreads>-1</maxIndexingThreads>
|
||||||
|
|
||||||
|
<mergeFactor>11</mergeFactor>
|
||||||
|
<maxMergeDocs>456</maxMergeDocs>
|
||||||
|
<mergePolicy class="${solr.test.log.merge.policy}" />
|
||||||
|
</indexConfig>
|
||||||
|
|
||||||
|
<requestHandler name="standard" class="solr.StandardRequestHandler"></requestHandler>
|
||||||
|
|
||||||
|
</config>
|
|
@ -27,6 +27,10 @@ public class TestBadConfig extends AbstractBadConfigTestBase {
|
||||||
assertConfigs("bad_solrconfig.xml","schema.xml","unset.sys.property");
|
assertConfigs("bad_solrconfig.xml","schema.xml","unset.sys.property");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testSegmentMergerWithoutReopen() throws Exception {
|
||||||
|
assertConfigs("bad-solrconfig-warmer-no-reopen.xml", "schema12.xml",
|
||||||
|
"mergedSegmentWarmer");
|
||||||
|
}
|
||||||
public void testMultipleDirectoryFactories() throws Exception {
|
public void testMultipleDirectoryFactories() throws Exception {
|
||||||
assertConfigs("bad-solrconfig-multiple-dirfactory.xml", "schema12.xml",
|
assertConfigs("bad-solrconfig-multiple-dirfactory.xml", "schema12.xml",
|
||||||
"directoryFactory");
|
"directoryFactory");
|
||||||
|
|
|
@ -27,6 +27,9 @@ import org.apache.lucene.index.SegmentInfo;
|
||||||
import org.apache.lucene.index.IndexWriterConfig;
|
import org.apache.lucene.index.IndexWriterConfig;
|
||||||
import org.apache.lucene.index.MergePolicy;
|
import org.apache.lucene.index.MergePolicy;
|
||||||
import org.apache.lucene.index.TieredMergePolicy;
|
import org.apache.lucene.index.TieredMergePolicy;
|
||||||
|
import org.apache.lucene.index.LogMergePolicy;
|
||||||
|
import org.apache.lucene.index.LogByteSizeMergePolicy;
|
||||||
|
import org.apache.lucene.index.LogDocMergePolicy;
|
||||||
import org.apache.lucene.index.ConcurrentMergeScheduler;
|
import org.apache.lucene.index.ConcurrentMergeScheduler;
|
||||||
import org.apache.solr.core.SolrCore;
|
import org.apache.solr.core.SolrCore;
|
||||||
import org.apache.solr.util.RefCounted;
|
import org.apache.solr.util.RefCounted;
|
||||||
|
@ -82,7 +85,7 @@ public class TestMergePolicyConfig extends SolrTestCaseJ4 {
|
||||||
final boolean expectCFS
|
final boolean expectCFS
|
||||||
= Boolean.parseBoolean(System.getProperty("useCompoundFile"));
|
= Boolean.parseBoolean(System.getProperty("useCompoundFile"));
|
||||||
|
|
||||||
initCore("solrconfig-mergepolicy.xml","schema-minimal.xml");
|
initCore("solrconfig-tieredmergepolicy.xml","schema-minimal.xml");
|
||||||
IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
|
IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
|
||||||
assertEquals(expectCFS, iwc.getUseCompoundFile());
|
assertEquals(expectCFS, iwc.getUseCompoundFile());
|
||||||
|
|
||||||
|
@ -116,6 +119,37 @@ public class TestMergePolicyConfig extends SolrTestCaseJ4 {
|
||||||
assertCompoundSegments(h.getCore(), false);
|
assertCompoundSegments(h.getCore(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLogMergePolicyConfig() throws Exception {
|
||||||
|
|
||||||
|
final Class<? extends LogMergePolicy> mpClass = random().nextBoolean()
|
||||||
|
? LogByteSizeMergePolicy.class : LogDocMergePolicy.class;
|
||||||
|
|
||||||
|
System.setProperty("solr.test.log.merge.policy", mpClass.getName());
|
||||||
|
|
||||||
|
initCore("solrconfig-logmergepolicy.xml","schema-minimal.xml");
|
||||||
|
IndexWriterConfig iwc = solrConfig.indexConfig.toIndexWriterConfig(h.getCore().getLatestSchema());
|
||||||
|
|
||||||
|
// verify some props set to -1 get lucene internal defaults
|
||||||
|
assertEquals(-1, solrConfig.indexConfig.maxBufferedDocs);
|
||||||
|
assertEquals(IndexWriterConfig.DISABLE_AUTO_FLUSH,
|
||||||
|
iwc.getMaxBufferedDocs());
|
||||||
|
assertEquals(-1, solrConfig.indexConfig.maxIndexingThreads);
|
||||||
|
assertEquals(IndexWriterConfig.DEFAULT_MAX_THREAD_STATES,
|
||||||
|
iwc.getMaxThreadStates());
|
||||||
|
assertEquals(-1, solrConfig.indexConfig.ramBufferSizeMB, 0.0D);
|
||||||
|
assertEquals(IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB,
|
||||||
|
iwc.getRAMBufferSizeMB(), 0.0D);
|
||||||
|
|
||||||
|
|
||||||
|
LogMergePolicy logMP = assertAndCast(mpClass, iwc.getMergePolicy());
|
||||||
|
|
||||||
|
// set by legacy <mergeFactor> setting
|
||||||
|
assertEquals(11, logMP.getMergeFactor());
|
||||||
|
// set by legacy <maxMergeDocs> setting
|
||||||
|
assertEquals(456, logMP.getMaxMergeDocs());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a Type and an object asserts that the object is non-null and an
|
* Given a Type and an object asserts that the object is non-null and an
|
||||||
* instance of the specified Type. The object is then cast to that type and
|
* instance of the specified Type. The object is then cast to that type and
|
||||||
|
|
|
@ -54,7 +54,7 @@ public class SolrIndexConfigTest extends SolrTestCaseJ4 {
|
||||||
@Test
|
@Test
|
||||||
public void testTieredMPSolrIndexConfigCreation() throws Exception {
|
public void testTieredMPSolrIndexConfigCreation() throws Exception {
|
||||||
SolrConfig solrConfig = new SolrConfig("solr" + File.separator
|
SolrConfig solrConfig = new SolrConfig("solr" + File.separator
|
||||||
+ "collection1", "solrconfig-mergepolicy.xml", null);
|
+ "collection1", "solrconfig-tieredmergepolicy.xml", null);
|
||||||
SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null,
|
SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null,
|
||||||
null);
|
null);
|
||||||
assertNotNull(solrIndexConfig);
|
assertNotNull(solrIndexConfig);
|
||||||
|
|
Loading…
Reference in New Issue