You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2013/08/28 22:18:51 UTC
svn commit: r1518352 - in /lucene/dev/trunk/solr/core/src:
test-files/solr/collection1/conf/ test/org/apache/solr/core/
test/org/apache/solr/update/
Author: hossman
Date: Wed Aug 28 20:18:51 2013
New Revision: 1518352
URL: http://svn.apache.org/r1518352
Log:
SOLR-5118: more testing of edge case and some error conditions
Added:
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-warmer-no-reopen.xml (with props)
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-logmergepolicy.xml (with props)
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-tieredmergepolicy.xml
- copied unchanged from r1518321, lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-mergepolicy.xml
Removed:
lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-mergepolicy.xml
Modified:
lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestBadConfig.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java
lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
Added: lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-warmer-no-reopen.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-warmer-no-reopen.xml?rev=1518352&view=auto
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-warmer-no-reopen.xml (added)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/bad-solrconfig-warmer-no-reopen.xml Wed Aug 28 20:18:51 2013
@@ -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>
Added: lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-logmergepolicy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-logmergepolicy.xml?rev=1518352&view=auto
==============================================================================
--- lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-logmergepolicy.xml (added)
+++ lucene/dev/trunk/solr/core/src/test-files/solr/collection1/conf/solrconfig-logmergepolicy.xml Wed Aug 28 20:18:51 2013
@@ -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>
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestBadConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestBadConfig.java?rev=1518352&r1=1518351&r2=1518352&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestBadConfig.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestBadConfig.java Wed Aug 28 20:18:51 2013
@@ -27,6 +27,10 @@ public class TestBadConfig extends Abstr
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 {
assertConfigs("bad-solrconfig-multiple-dirfactory.xml", "schema12.xml",
"directoryFactory");
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java?rev=1518352&r1=1518351&r2=1518352&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/core/TestMergePolicyConfig.java Wed Aug 28 20:18:51 2013
@@ -27,6 +27,9 @@ import org.apache.lucene.index.SegmentIn
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.MergePolicy;
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.solr.core.SolrCore;
import org.apache.solr.util.RefCounted;
@@ -82,7 +85,7 @@ public class TestMergePolicyConfig exten
final boolean expectCFS
= 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());
assertEquals(expectCFS, iwc.getUseCompoundFile());
@@ -116,6 +119,37 @@ public class TestMergePolicyConfig exten
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
* instance of the specified Type. The object is then cast to that type and
Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java?rev=1518352&r1=1518351&r2=1518352&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/update/SolrIndexConfigTest.java Wed Aug 28 20:18:51 2013
@@ -54,7 +54,7 @@ public class SolrIndexConfigTest extends
@Test
public void testTieredMPSolrIndexConfigCreation() throws Exception {
SolrConfig solrConfig = new SolrConfig("solr" + File.separator
- + "collection1", "solrconfig-mergepolicy.xml", null);
+ + "collection1", "solrconfig-tieredmergepolicy.xml", null);
SolrIndexConfig solrIndexConfig = new SolrIndexConfig(solrConfig, null,
null);
assertNotNull(solrIndexConfig);