You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ro...@apache.org on 2016/05/19 16:31:23 UTC
[2/2] lucene-solr:branch_6x: SOLR-9132: Move some tests to
SolrCloudTestBase
SOLR-9132: Move some tests to SolrCloudTestBase
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f1e870c0
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f1e870c0
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f1e870c0
Branch: refs/heads/branch_6x
Commit: f1e870c016147e43c3ef4a6aab5851f69bc97c1c
Parents: 8db3c73
Author: Alan Woodward <ro...@apache.org>
Authored: Mon May 16 13:43:02 2016 +0100
Committer: Alan Woodward <ro...@apache.org>
Committed: Thu May 19 16:59:08 2016 +0100
----------------------------------------------------------------------
solr/CHANGES.txt | 4 +-
.../apache/solr/search/mlt/CloudMLTQParser.java | 19 +-
.../configsets/cloud-dynamic/conf/schema.xml | 275 ++++++++++++++++++
.../cloud-dynamic/conf/solrconfig.xml | 48 ++++
.../solr/configsets/doc-expiry/conf/schema.xml | 271 ++++++++++++++++++
.../solrconfig.snippet.randomindexconfig.xml | 47 ++++
.../configsets/doc-expiry/conf/solrconfig.xml | 96 +++++++
.../exitable-directory/conf/schema.xml | 28 ++
.../exitable-directory/conf/solrconfig.xml | 117 ++++++++
.../solr/client/solrj/ConnectionReuseTest.java | 191 +++++++------
.../apache/solr/cloud/CleanupOldIndexTest.java | 105 ++-----
.../cloud/CloudExitableDirectoryReaderTest.java | 47 ++--
.../apache/solr/cloud/ConfigSetsAPITest.java | 39 ++-
...DistribDocExpirationUpdateProcessorTest.java | 137 ++++-----
.../solr/cloud/DistributedVersionInfoTest.java | 102 +++----
...stributedQueryComponentOptimizationTest.java | 236 +++++++++-------
.../solr/search/mlt/CloudMLTQParserTest.java | 277 ++++++++++---------
.../org/apache/solr/client/solrj/SolrQuery.java | 11 +-
.../apache/solr/common/cloud/DocCollection.java | 9 +
.../org/apache/solr/common/cloud/Replica.java | 5 +
.../cloud/AbstractFullDistribZkTestBase.java | 8 +-
.../apache/solr/cloud/MiniSolrCloudCluster.java | 9 +
.../apache/solr/cloud/SolrCloudTestCase.java | 6 +
23 files changed, 1504 insertions(+), 583 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 818cf28..2958bda 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -260,7 +260,7 @@ Other Changes
* SOLR-9066: Make CountMetric return long instead of double (Kevin Risden)
-* SOLR-9065: Migrate SolrJ distributed tests to SolrCloudTestCase. (Alan Woodward)
+* SOLR-9065, SOLR-9072, SOLR-9132: Migrate some distributed tests to SolrCloudTestCase. (Alan Woodward)
* SOLR-8184: Negative tests for JDBC Connection String (Susheel Kumar, Jason Gerlowski, Kevin Risden)
@@ -274,8 +274,6 @@ Other Changes
* SOLR-9105: Fix a bunch of typos across 103 files (Bartosz Krasi\u0144ski via janhoy)
-* SOLR-9072: Migrate morphline-core tests to SolrCloudTestCase. (Alan Woodward)
-
* SOLR-9115: Get rid of javax.xml.bind.DatatypeConverter in SimplePostTool
for Java 9 compatibility. (Uwe Schindler)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
index f2ed8b9..7491653 100644
--- a/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
+++ b/solr/core/src/java/org/apache/solr/search/mlt/CloudMLTQParser.java
@@ -15,6 +15,13 @@
* limitations under the License.
*/
package org.apache.solr.search.mlt;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.regex.Pattern;
+
import org.apache.lucene.index.Term;
import org.apache.lucene.queries.mlt.MoreLikeThis;
import org.apache.lucene.search.BooleanClause;
@@ -39,13 +46,6 @@ import org.apache.solr.search.QParser;
import org.apache.solr.search.QueryParsing;
import org.apache.solr.util.SolrPluginUtils;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Pattern;
-
public class CloudMLTQParser extends QParser {
// Pattern is thread safe -- TODO? share this with general 'fl' param
private static final Pattern splitList = Pattern.compile(",| ");
@@ -112,13 +112,12 @@ public class CloudMLTQParser extends QParser {
}
}
} else {
- Map<String, SchemaField> fields = req.getSchema().getFields();
for (String field : doc.getFieldNames()) {
// Only use fields that are stored and have an explicit analyzer.
// This makes sense as the query uses tf/idf/.. for query construction.
// We might want to relook and change this in the future though.
- if(fields.get(field).stored()
- && fields.get(field).getType().isExplicitAnalyzer()) {
+ SchemaField f = req.getSchema().getFieldOrNull(field);
+ if (f != null && f.stored() && f.getType().isExplicitAnalyzer()) {
fieldNames.add(field);
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/schema.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/schema.xml b/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/schema.xml
new file mode 100644
index 0000000..41822a3
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/schema.xml
@@ -0,0 +1,275 @@
+<?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.
+-->
+
+<!-- The Solr schema file, version 1.6 -->
+
+<schema name="cloud-dynamic" version="1.6">
+ <!-- attribute "name" is the name of this schema and is only used for display purposes.
+ Applications should change this to reflect the nature of the search collection.
+ version="x.y" is Solr's version number for the schema syntax and semantics. It should
+ not normally be changed by applications.
+ 1.0: multiValued attribute did not exist, all fields are multiValued by nature
+ 1.1: multiValued attribute introduced, false by default
+ 1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
+ 1.3: removed optional field compress feature
+ 1.4: default auto-phrase (QueryParser feature) to off
+ 1.5: omitNorms defaults to true for primitive field types (int, float, boolean, string...)
+ 1.6: useDocValuesAsStored defaults to true.
+ -->
+ <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
+ <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
+ <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
+ <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
+
+ <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
+
+ <!-- Field type demonstrating an Analyzer failure -->
+ <fieldType name="failtype1" class="solr.TextField">
+ <analyzer type="index">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="0" catenateWords="0"
+ catenateNumbers="0" catenateAll="0"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <!-- Demonstrating ignoreCaseChange -->
+ <fieldType name="wdf_nocase" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="0" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="0" preserveOriginal="0"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="wdf_preserve" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="1" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="0" preserveOriginal="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+
+ <!-- HighlitText optimizes storage for (long) columns which will be highlit -->
+ <fieldType name="highlittext" class="solr.TextField"/>
+
+ <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
+ <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
+
+ <!-- format for date is 1995-12-31T23:59:59.999Z and only the fractional
+ seconds part (.999) is optional.
+ -->
+ <fieldType name="date" class="solr.TrieDateField" sortMissingLast="true"/>
+ <fieldType name="tdate" class="solr.TrieDateField" sortMissingLast="true" precisionStep="6"/>
+
+ <fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
+ <analyzer type="index">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1"
+ catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ <analyzer type="query">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="unstemmed" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <!-- field type that doesn't generate phrases from unquoted multiple tokens per analysis unit -->
+ <fieldType name="text_np" class="solr.TextField" positionIncrementGap="100">
+ <analyzer type="index">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1"
+ catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ <analyzer type="query">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="nametext" class="solr.TextField">
+ <analyzer class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
+ </fieldType>
+
+ <fieldType name="unstored" class="solr.StrField" indexed="true" stored="false"/>
+
+ <fieldType name="textgap" class="solr.TextField" multiValued="true" positionIncrementGap="100">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="uuid" class="solr.UUIDField"/>
+ <fieldType name="ignored" class="solr.StrField" indexed="false" stored="false"/>
+
+
+ <fieldType name="random" class="solr.RandomSortField" indexed="true"/>
+
+ <!-- Poly field -->
+ <fieldType name="xy" class="solr.PointType" dimension="2" subFieldType="double"/>
+ <fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="*_d"/>
+ <fieldType name="geohash" class="solr.GeoHashField"/>
+
+ <fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
+ <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
+ <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
+
+ <fieldType class="org.apache.solr.schema.SortableBinaryField" name="sortable_binary"/>
+
+ <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
+ <field name="signatureField" type="string" indexed="true" stored="false"/>
+ <field name="uuid" type="uuid" stored="true"/>
+ <field name="name" type="nametext" indexed="true" stored="true"/>
+ <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
+ <field name="subject" type="text" indexed="true" stored="true"/>
+ <field name="title" type="nametext" indexed="true" stored="true"/>
+ <field name="weight" type="float" indexed="true" stored="true"/>
+ <field name="bday" type="date" indexed="true" stored="true"/>
+
+ <field name="text_np" type="text_np" indexed="true" stored="false"/>
+
+ <!-- to test property inheritance and overriding -->
+ <field name="shouldbeunstored" type="unstored"/>
+ <field name="shouldbestored" type="unstored" stored="true"/>
+ <field name="shouldbeunindexed" type="unstored" indexed="false" stored="true"/>
+
+
+ <!-- test different combinations of indexed and stored -->
+ <field name="bind" type="boolean" indexed="true" stored="false"/>
+ <field name="bsto" type="boolean" indexed="false" stored="true"/>
+ <field name="bindsto" type="boolean" indexed="true" stored="true"/>
+ <field name="isto" type="int" indexed="false" stored="true"/>
+ <field name="iind" type="int" indexed="true" stored="false"/>
+ <field name="ssto" type="string" indexed="false" stored="true"/>
+ <field name="sind" type="string" indexed="true" stored="false"/>
+ <field name="sindsto" type="string" indexed="true" stored="true"/>
+
+ <!-- test combinations of term vector settings -->
+ <field name="test_basictv" type="text" termVectors="true"/>
+ <field name="test_notv" type="text" termVectors="false"/>
+ <field name="test_postv" type="text" termVectors="true" termPositions="true"/>
+ <field name="test_offtv" type="text" termVectors="true" termOffsets="true"/>
+ <field name="test_posofftv" type="text" termVectors="true"
+ termPositions="true" termOffsets="true"/>
+
+ <!-- test highlit field settings -->
+ <field name="test_hlt" type="highlittext" indexed="true"/>
+ <field name="test_hlt_off" type="highlittext" indexed="true"/>
+
+ <!--
+ <field name="timestamp" type="date" indexed="true" stored="true" default="NOW"/>
+ -->
+ <field name="timestamp" type="date" indexed="true" stored="true"/>
+
+ <!-- Test a point field for distances -->
+ <field name="point" type="xy" indexed="true" stored="true" multiValued="false"/>
+ <field name="pointD" type="xyd" indexed="true" stored="true" multiValued="false"/>
+ <field name="point_hash" type="geohash" indexed="true" stored="true" multiValued="false"/>
+ <field name="store" type="location" indexed="true" stored="true"/>
+
+ <!-- to test uniq fields -->
+ <field name="uniq" type="string" indexed="true" stored="true" multiValued="true"/>
+ <field name="uniq2" type="string" indexed="true" stored="true" multiValued="true"/>
+ <field name="uniq3" type="string" indexed="true" stored="true"/>
+ <field name="nouniq" type="string" indexed="true" stored="true" multiValued="true"/>
+
+
+ <field name="copyfield_source" type="string" indexed="true" stored="true" multiValued="true"/>
+
+ <field name="payload" type="sortable_binary" indexed="false"
+ stored="true" multiValued="false" docValues="true"/>
+
+ <!-- for versioning -->
+ <field name="_version_" type="long" indexed="true" stored="true"/>
+ <!-- points to the root document of a block of nested documents -->
+ <field name="_root_" type="string" indexed="true" stored="true"/>
+
+ <field name="multi_int_with_docvals" type="tint" multiValued="true" docValues="true" indexed="false"/>
+
+ <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
+
+ <dynamicField name="*_sI" type="string" indexed="true" stored="false"/>
+ <dynamicField name="*_sS" type="string" indexed="false" stored="true"/>
+ <dynamicField name="t_*" type="text" indexed="true" stored="true"/>
+ <dynamicField name="tv_*" type="text" indexed="true" stored="true"
+ termVectors="true" termPositions="true" termOffsets="true"/>
+ <dynamicField name="tv_mv_*" type="text" indexed="true" stored="true" multiValued="true"
+ termVectors="true" termPositions="true" termOffsets="true"/>
+
+ <dynamicField name="*_mfacet" type="string" indexed="true" stored="false" multiValued="true"/>
+
+ <dynamicField name="*_i" type="int" indexed="true" stored="true"/>
+ <dynamicField name="*_is" type="int" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_s1" type="string" indexed="true" stored="true" multiValued="false"/>
+ <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_l" type="long" indexed="true" stored="true"/>
+ <dynamicField name="*_ll" type="long" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_t" type="text" indexed="true" stored="true"/>
+ <dynamicField name="*_u" type="unstemmed" indexed="true" stored="true"/>
+ <dynamicField name="*_ws" type="nametext" indexed="true" stored="true"/>
+ <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
+ <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
+ <dynamicField name="*_d" type="double" indexed="true" stored="true"/>
+ <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
+
+ <!-- some trie-coded dynamic fields for faster range queries -->
+ <dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
+ <dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
+ <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
+ <dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
+ <dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
+
+ <dynamicField name="ignored_*" type="ignored" multiValued="true"/>
+ <dynamicField name="attr_*" type="text" indexed="true" stored="true" multiValued="true"/>
+
+ <dynamicField name="random_*" type="random"/>
+
+
+ <defaultSearchField>text</defaultSearchField>
+ <uniqueKey>id</uniqueKey>
+
+ <!-- example of a custom similarity -->
+ <similarity class="solr.CustomSimilarityFactory">
+ <str name="echo">I am your default sim</str>
+ </similarity>
+
+</schema>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/solrconfig.xml
new file mode 100644
index 0000000..059e58f
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/cloud-dynamic/conf/solrconfig.xml
@@ -0,0 +1,48 @@
+<?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.
+-->
+
+<!-- Minimal solrconfig.xml with /select, /admin and /update only -->
+
+<config>
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory"
+ class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ <commitWithin>
+ <softCommit>${solr.commitwithin.softcommit:true}</softCommit>
+ </commitWithin>
+ <updateLog></updateLog>
+ </updateHandler>
+
+ <requestHandler name="/select" class="solr.SearchHandler">
+ <lst name="defaults">
+ <str name="echoParams">explicit</str>
+ <str name="indent">true</str>
+ <str name="df">text</str>
+ </lst>
+
+ </requestHandler>
+</config>
+
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/doc-expiry/conf/schema.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/doc-expiry/conf/schema.xml b/solr/core/src/test-files/solr/configsets/doc-expiry/conf/schema.xml
new file mode 100644
index 0000000..8400fe8
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/doc-expiry/conf/schema.xml
@@ -0,0 +1,271 @@
+<?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.
+-->
+
+<!-- The Solr schema file, version 1.6 -->
+
+<schema name="cloud-dynamic" version="1.6">
+ <!-- attribute "name" is the name of this schema and is only used for display purposes.
+ Applications should change this to reflect the nature of the search collection.
+ version="x.y" is Solr's version number for the schema syntax and semantics. It should
+ not normally be changed by applications.
+ 1.0: multiValued attribute did not exist, all fields are multiValued by nature
+ 1.1: multiValued attribute introduced, false by default
+ 1.2: omitTermFreqAndPositions attribute introduced, true by default except for text fields.
+ 1.3: removed optional field compress feature
+ 1.4: default auto-phrase (QueryParser feature) to off
+ 1.5: omitNorms defaults to true for primitive field types (int, float, boolean, string...)
+ 1.6: useDocValuesAsStored defaults to true.
+ -->
+ <fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
+ <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
+ <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
+ <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>
+
+ <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" positionIncrementGap="0"/>
+ <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
+
+ <!-- Field type demonstrating an Analyzer failure -->
+ <fieldType name="failtype1" class="solr.TextField">
+ <analyzer type="index">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="0" catenateWords="0"
+ catenateNumbers="0" catenateAll="0"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <!-- Demonstrating ignoreCaseChange -->
+ <fieldType name="wdf_nocase" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="0" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="0" preserveOriginal="0"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="wdf_preserve" class="solr.TextField">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="1" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="0" preserveOriginal="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+
+ <!-- HighlitText optimizes storage for (long) columns which will be highlit -->
+ <fieldType name="highlittext" class="solr.TextField"/>
+
+ <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
+ <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
+
+ <!-- format for date is 1995-12-31T23:59:59.999Z and only the fractional
+ seconds part (.999) is optional.
+ -->
+ <fieldType name="date" class="solr.TrieDateField" sortMissingLast="true"/>
+ <fieldType name="tdate" class="solr.TrieDateField" sortMissingLast="true" precisionStep="6"/>
+
+ <fieldType name="text" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
+ <analyzer type="index">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1"
+ catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ <analyzer type="query">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="unstemmed" class="solr.TextField" positionIncrementGap="100" autoGeneratePhraseQueries="true">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <!-- field type that doesn't generate phrases from unquoted multiple tokens per analysis unit -->
+ <fieldType name="text_np" class="solr.TextField" positionIncrementGap="100">
+ <analyzer type="index">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1"
+ catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ <analyzer type="query">
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0"
+ catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ <filter class="solr.PorterStemFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="nametext" class="solr.TextField">
+ <analyzer class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
+ </fieldType>
+
+ <fieldType name="unstored" class="solr.StrField" indexed="true" stored="false"/>
+
+ <fieldType name="textgap" class="solr.TextField" multiValued="true" positionIncrementGap="100">
+ <analyzer>
+ <tokenizer class="solr.MockTokenizerFactory"/>
+ <filter class="solr.LowerCaseFilterFactory"/>
+ </analyzer>
+ </fieldType>
+
+ <fieldType name="uuid" class="solr.UUIDField"/>
+ <fieldType name="ignored" class="solr.StrField" indexed="false" stored="false"/>
+
+
+ <fieldType name="random" class="solr.RandomSortField" indexed="true"/>
+
+ <!-- Poly field -->
+ <fieldType name="xy" class="solr.PointType" dimension="2" subFieldType="double"/>
+ <fieldType name="xyd" class="solr.PointType" dimension="2" subFieldSuffix="*_d"/>
+ <fieldType name="geohash" class="solr.GeoHashField"/>
+
+ <fieldType name="point" class="solr.PointType" dimension="2" subFieldSuffix="_d"/>
+ <!-- A specialized field for geospatial search. If indexed, this fieldType must not be multivalued. -->
+ <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
+
+
+ <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>
+ <field name="signatureField" type="string" indexed="true" stored="false"/>
+ <field name="uuid" type="uuid" stored="true"/>
+ <field name="name" type="nametext" indexed="true" stored="true"/>
+ <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
+ <field name="subject" type="text" indexed="true" stored="true"/>
+ <field name="title" type="nametext" indexed="true" stored="true"/>
+ <field name="weight" type="float" indexed="true" stored="true"/>
+ <field name="bday" type="date" indexed="true" stored="true"/>
+
+ <field name="text_np" type="text_np" indexed="true" stored="false"/>
+
+ <!-- to test property inheritance and overriding -->
+ <field name="shouldbeunstored" type="unstored"/>
+ <field name="shouldbestored" type="unstored" stored="true"/>
+ <field name="shouldbeunindexed" type="unstored" indexed="false" stored="true"/>
+
+
+ <!-- test different combinations of indexed and stored -->
+ <field name="bind" type="boolean" indexed="true" stored="false"/>
+ <field name="bsto" type="boolean" indexed="false" stored="true"/>
+ <field name="bindsto" type="boolean" indexed="true" stored="true"/>
+ <field name="isto" type="int" indexed="false" stored="true"/>
+ <field name="iind" type="int" indexed="true" stored="false"/>
+ <field name="ssto" type="string" indexed="false" stored="true"/>
+ <field name="sind" type="string" indexed="true" stored="false"/>
+ <field name="sindsto" type="string" indexed="true" stored="true"/>
+
+ <!-- test combinations of term vector settings -->
+ <field name="test_basictv" type="text" termVectors="true"/>
+ <field name="test_notv" type="text" termVectors="false"/>
+ <field name="test_postv" type="text" termVectors="true" termPositions="true"/>
+ <field name="test_offtv" type="text" termVectors="true" termOffsets="true"/>
+ <field name="test_posofftv" type="text" termVectors="true"
+ termPositions="true" termOffsets="true"/>
+
+ <!-- test highlit field settings -->
+ <field name="test_hlt" type="highlittext" indexed="true"/>
+ <field name="test_hlt_off" type="highlittext" indexed="true"/>
+
+ <!--
+ <field name="timestamp" type="date" indexed="true" stored="true" default="NOW"/>
+ -->
+ <field name="timestamp" type="date" indexed="true" stored="true"/>
+
+ <!-- Test a point field for distances -->
+ <field name="point" type="xy" indexed="true" stored="true" multiValued="false"/>
+ <field name="pointD" type="xyd" indexed="true" stored="true" multiValued="false"/>
+ <field name="point_hash" type="geohash" indexed="true" stored="true" multiValued="false"/>
+ <field name="store" type="location" indexed="true" stored="true"/>
+
+ <!-- to test uniq fields -->
+ <field name="uniq" type="string" indexed="true" stored="true" multiValued="true"/>
+ <field name="uniq2" type="string" indexed="true" stored="true" multiValued="true"/>
+ <field name="uniq3" type="string" indexed="true" stored="true"/>
+ <field name="nouniq" type="string" indexed="true" stored="true" multiValued="true"/>
+
+
+ <field name="copyfield_source" type="string" indexed="true" stored="true" multiValued="true"/>
+
+ <!-- for versioning -->
+ <field name="_version_" type="long" indexed="true" stored="true"/>
+ <!-- points to the root document of a block of nested documents -->
+ <field name="_root_" type="string" indexed="true" stored="true"/>
+
+ <field name="multi_int_with_docvals" type="tint" multiValued="true" docValues="true" indexed="false"/>
+
+ <dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>
+
+ <dynamicField name="*_sI" type="string" indexed="true" stored="false"/>
+ <dynamicField name="*_sS" type="string" indexed="false" stored="true"/>
+ <dynamicField name="t_*" type="text" indexed="true" stored="true"/>
+ <dynamicField name="tv_*" type="text" indexed="true" stored="true"
+ termVectors="true" termPositions="true" termOffsets="true"/>
+ <dynamicField name="tv_mv_*" type="text" indexed="true" stored="true" multiValued="true"
+ termVectors="true" termPositions="true" termOffsets="true"/>
+
+ <dynamicField name="*_mfacet" type="string" indexed="true" stored="false" multiValued="true"/>
+
+ <dynamicField name="*_i" type="int" indexed="true" stored="true"/>
+ <dynamicField name="*_is" type="int" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_s1" type="string" indexed="true" stored="true" multiValued="false"/>
+ <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_l" type="long" indexed="true" stored="true"/>
+ <dynamicField name="*_ll" type="long" indexed="true" stored="true" multiValued="true"/>
+ <dynamicField name="*_t" type="text" indexed="true" stored="true"/>
+ <dynamicField name="*_u" type="unstemmed" indexed="true" stored="true"/>
+ <dynamicField name="*_ws" type="nametext" indexed="true" stored="true"/>
+ <dynamicField name="*_b" type="boolean" indexed="true" stored="true"/>
+ <dynamicField name="*_f" type="float" indexed="true" stored="true"/>
+ <dynamicField name="*_d" type="double" indexed="true" stored="true"/>
+ <dynamicField name="*_dt" type="date" indexed="true" stored="true"/>
+
+ <!-- some trie-coded dynamic fields for faster range queries -->
+ <dynamicField name="*_ti" type="tint" indexed="true" stored="true"/>
+ <dynamicField name="*_tl" type="tlong" indexed="true" stored="true"/>
+ <dynamicField name="*_tf" type="tfloat" indexed="true" stored="true"/>
+ <dynamicField name="*_td" type="tdouble" indexed="true" stored="true"/>
+ <dynamicField name="*_tdt" type="tdate" indexed="true" stored="true"/>
+
+ <dynamicField name="ignored_*" type="ignored" multiValued="true"/>
+ <dynamicField name="attr_*" type="text" indexed="true" stored="true" multiValued="true"/>
+
+ <dynamicField name="random_*" type="random"/>
+
+
+ <defaultSearchField>text</defaultSearchField>
+ <uniqueKey>id</uniqueKey>
+
+ <!-- example of a custom similarity -->
+ <similarity class="solr.CustomSimilarityFactory">
+ <str name="echo">I am your default sim</str>
+ </similarity>
+
+</schema>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.snippet.randomindexconfig.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.snippet.randomindexconfig.xml b/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.snippet.randomindexconfig.xml
new file mode 100644
index 0000000..ec5f54e
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.snippet.randomindexconfig.xml
@@ -0,0 +1,47 @@
+<?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.
+-->
+<!--
+
+A solrconfig.xml snippet containing indexConfig settings for randomized testing.
+
+-->
+<indexConfig>
+ <!-- this sys property is not set by SolrTestCaseJ4 because we ideally want to use
+ the RandomMergePolicy in all tests - but some tests expect very specific
+ Merge behavior, so those tests can set it as needed.
+ -->
+ <mergePolicy enable="${solr.tests.useMergePolicy:true}" class="${solr.tests.mergePolicy:org.apache.solr.util.RandomMergePolicy}" />
+ <mergePolicyFactory enable="${solr.tests.useMergePolicyFactory:true}" class="${solr.tests.mergePolicyFactory:org.apache.solr.util.RandomMergePolicyFactory}" />
+
+ <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
+
+ <maxBufferedDocs>${solr.tests.maxBufferedDocs}</maxBufferedDocs>
+ <ramBufferSizeMB>${solr.tests.ramBufferSizeMB}</ramBufferSizeMB>
+
+ <mergeScheduler class="${solr.tests.mergeScheduler}" />
+
+ <writeLockTimeout>1000</writeLockTimeout>
+ <commitLockTimeout>10000</commitLockTimeout>
+
+ <!-- this sys property is not set by SolrTestCaseJ4 because almost all tests should
+ use the single process lockType for speed - but tests that explicitly need
+ to vary the lockType canset it as needed.
+ -->
+ <lockType>${solr.tests.lockType:single}</lockType>
+</indexConfig>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.xml
new file mode 100644
index 0000000..18d16a3
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/doc-expiry/conf/solrconfig.xml
@@ -0,0 +1,96 @@
+<?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.
+-->
+
+<!--
+ See DocExpirationUpdateProcessorFactoryTest
+ and DistribDocExpirationUpdateProcessorTest
+ -->
+<config>
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <directoryFactory name="DirectoryFactory"
+ class="${solr.directoryFactory:solr.NRTCachingDirectoryFactory}"/>
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+
+ <xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ <updateLog>
+ <str name="dir">${solr.ulog.dir:}</str>
+ </updateLog>
+ </updateHandler>
+
+ <requestHandler name="/select" class="solr.SearchHandler" default="true" />
+
+ <updateRequestProcessorChain name="convert-ttl-defaults">
+ <processor class="solr.processor.DocExpirationUpdateProcessorFactory">
+ <str name="expirationFieldName">_expire_at_tdt</str>
+ </processor>
+ </updateRequestProcessorChain>
+
+ <updateRequestProcessorChain name="convert-ttl-field">
+ <processor class="solr.processor.DocExpirationUpdateProcessorFactory">
+ <str name="ttlFieldName">_ttl_field_</str>
+ <null name="ttlParamName"/>
+ <str name="expirationFieldName">_expire_at_tdt</str>
+ </processor>
+ <processor class="solr.IgnoreFieldUpdateProcessorFactory">
+ <str name="fieldName">_ttl_field_</str>
+ </processor>
+ </updateRequestProcessorChain>
+
+ <updateRequestProcessorChain name="convert-ttl-param">
+ <processor class="solr.processor.DocExpirationUpdateProcessorFactory">
+ <str name="ttlParamName">_ttl_param_</str>
+ <null name="ttlFieldName"/>
+ <str name="expirationFieldName">_expire_at_tdt</str>
+ </processor>
+ </updateRequestProcessorChain>
+
+ <updateRequestProcessorChain name="convert-ttl-field-with-param-default">
+ <processor class="solr.processor.DocExpirationUpdateProcessorFactory">
+ <str name="ttlFieldName">_ttl_field_</str>
+ <str name="ttlParamName">_ttl_param_</str>
+ <str name="expirationFieldName">_expire_at_tdt</str>
+ </processor>
+ <processor class="solr.IgnoreFieldUpdateProcessorFactory">
+ <str name="fieldName">_ttl_field_</str>
+ </processor>
+ </updateRequestProcessorChain>
+
+ <updateRequestProcessorChain name="scheduled-delete" default="true">
+ <!-- NOTE: this chain is default so we can see that
+ autoDeleteChainName defaults to the default chain for the SolrCore
+ -->
+ <processor class="solr.processor.DocExpirationUpdateProcessorFactory">
+ <!-- str name="autoDeleteChainName">scheduled-delete</str -->
+ <int name="autoDeletePeriodSeconds">3</int>
+ <str name="expirationFieldName">eXpField_tdt</str>
+ <str name="ttlFieldName">tTl_s</str>
+ <null name="ttlParamName"/>
+ </processor>
+ <processor class="solr.RecordingUpdateProcessorFactory" />
+ <processor class="solr.LogUpdateProcessorFactory" />
+ <processor class="solr.RunUpdateProcessorFactory" />
+ </updateRequestProcessorChain>
+
+</config>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/exitable-directory/conf/schema.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/exitable-directory/conf/schema.xml b/solr/core/src/test-files/solr/configsets/exitable-directory/conf/schema.xml
new file mode 100644
index 0000000..aab5e81
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/exitable-directory/conf/schema.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ 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.
+-->
+<schema name="minimal" version="1.1">
+ <fieldType name="string" class="solr.StrField"/>
+ <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
+ <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
+ <dynamicField name="*" type="string" indexed="true" stored="true"/>
+ <!-- for versioning -->
+ <field name="_version_" type="long" indexed="true" stored="true"/>
+ <field name="_root_" type="int" indexed="true" stored="true" multiValued="false" required="false"/>
+ <field name="id" type="string" indexed="true" stored="true"/>
+ <uniqueKey>id</uniqueKey>
+</schema>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test-files/solr/configsets/exitable-directory/conf/solrconfig.xml
----------------------------------------------------------------------
diff --git a/solr/core/src/test-files/solr/configsets/exitable-directory/conf/solrconfig.xml b/solr/core/src/test-files/solr/configsets/exitable-directory/conf/solrconfig.xml
new file mode 100644
index 0000000..31c374c
--- /dev/null
+++ b/solr/core/src/test-files/solr/configsets/exitable-directory/conf/solrconfig.xml
@@ -0,0 +1,117 @@
+<?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>
+ <jmx />
+
+ <luceneMatchVersion>${tests.luceneMatchVersion:LATEST}</luceneMatchVersion>
+
+ <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}">
+ <!-- used to keep RAM reqs down for HdfsDirectoryFactory -->
+ <bool name="solr.hdfs.blockcache.enabled">${solr.hdfs.blockcache.enabled:true}</bool>
+ <int name="solr.hdfs.blockcache.blocksperbank">${solr.hdfs.blockcache.blocksperbank:1024}</int>
+ <str name="solr.hdfs.home">${solr.hdfs.home:}</str>
+ <str name="solr.hdfs.confdir">${solr.hdfs.confdir:}</str>
+ <str name="solr.hdfs.blockcache.global">${solr.hdfs.blockcache.global:true}</str>
+ </directoryFactory>
+ <schemaFactory class="ClassicIndexSchemaFactory"/>
+
+ <dataDir>${solr.data.dir:}</dataDir>
+
+ <!-- an update processor the explicitly excludes distrib to test
+ clean errors when people attempt atomic updates w/o it
+ -->
+ <updateRequestProcessorChain name="nodistrib" >
+ <processor class="solr.NoOpDistributingUpdateProcessorFactory" />
+ <processor class="solr.RunUpdateProcessorFactory" />
+ </updateRequestProcessorChain>
+
+ <requestHandler name="standard" class="solr.StandardRequestHandler">
+ </requestHandler>
+
+ <updateHandler class="solr.DirectUpdateHandler2">
+ <updateLog>
+ <str name="dir">${solr.ulog.dir:}</str>
+ </updateLog>
+ </updateHandler>
+
+ <updateRequestProcessorChain name="dedupe">
+ <processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
+ <bool name="enabled">true</bool>
+ <bool name="overwriteDupes">true</bool>
+ <str name="fields">v_t,t_field</str>
+ <str name="signatureClass">org.apache.solr.update.processor.TextProfileSignature</str>
+ </processor>
+ <processor class="solr.RunUpdateProcessorFactory" />
+ </updateRequestProcessorChain>
+ <updateRequestProcessorChain name="stored_sig">
+ <!-- this chain is valid even though the signature field is not
+ indexed, because we are not asking for dups to be overwritten
+ -->
+ <processor class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
+ <bool name="enabled">true</bool>
+ <str name="signatureField">non_indexed_signature_sS</str>
+ <bool name="overwriteDupes">false</bool>
+ <str name="fields">v_t,t_field</str>
+ <str name="signatureClass">org.apache.solr.update.processor.TextProfileSignature</str>
+ </processor>
+ <processor class="solr.RunUpdateProcessorFactory" />
+ </updateRequestProcessorChain>
+
+ <updateRequestProcessorChain name="distrib-dup-test-chain-explicit">
+ <!-- explicit test using processors before and after distrib -->
+ <processor class="solr.RegexReplaceProcessorFactory">
+ <str name="fieldName">regex_dup_A_s</str>
+ <str name="pattern">x</str>
+ <str name="replacement">x_x</str>
+ </processor>
+ <processor class="solr.DistributedUpdateProcessorFactory" />
+ <processor class="solr.RegexReplaceProcessorFactory">
+ <str name="fieldName">regex_dup_B_s</str>
+ <str name="pattern">x</str>
+ <str name="replacement">x_x</str>
+ </processor>
+ <processor class="solr.RunUpdateProcessorFactory" />
+ </updateRequestProcessorChain>
+
+ <updateRequestProcessorChain name="distrib-dup-test-chain-implicit">
+ <!-- implicit test w/o distrib declared-->
+ <processor class="solr.RegexReplaceProcessorFactory">
+ <str name="fieldName">regex_dup_A_s</str>
+ <str name="pattern">x</str>
+ <str name="replacement">x_x</str>
+ </processor>
+ <processor class="solr.RegexReplaceProcessorFactory">
+ <str name="fieldName">regex_dup_B_s</str>
+ <str name="pattern">x</str>
+ <str name="replacement">x_x</str>
+ </processor>
+ <processor class="solr.RunUpdateProcessorFactory" />
+ </updateRequestProcessorChain>
+
+ <searchComponent name="delayingSearchComponent"
+ class="org.apache.solr.search.DelayingSearchComponent"/>
+
+ <requestHandler name="/select" class="solr.SearchHandler">
+ <arr name="first-components">
+ <str>delayingSearchComponent</str>
+ </arr>
+ </requestHandler>
+
+</config>
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test/org/apache/solr/client/solrj/ConnectionReuseTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/client/solrj/ConnectionReuseTest.java b/solr/core/src/test/org/apache/solr/client/solrj/ConnectionReuseTest.java
index 05f1157..6b4fa7b 100644
--- a/solr/core/src/test/org/apache/solr/client/solrj/ConnectionReuseTest.java
+++ b/solr/core/src/test/org/apache/solr/client/solrj/ConnectionReuseTest.java
@@ -40,123 +40,130 @@ import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.impl.CloudSolrClient;
import org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient;
import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.update.AddUpdateCommand;
import org.apache.solr.util.TestInjection;
import org.junit.BeforeClass;
import org.junit.Test;
@SuppressSSL
-public class ConnectionReuseTest extends AbstractFullDistribZkTestBase {
+public class ConnectionReuseTest extends SolrCloudTestCase {
private AtomicInteger id = new AtomicInteger();
-
+
+ private static final String COLLECTION = "collection1";
+
@BeforeClass
- public static void beforeConnectionReuseTest() {
- if (true) TestInjection.failUpdateRequests = "true:100";
- }
-
- public ConnectionReuseTest() {
- fixShardCount(1);
- sliceCount = 1;
- stress = 0;
- }
+ public static void setupCluster() throws Exception {
+ TestInjection.failUpdateRequests = "true:100";
+ configureCluster(1)
+ .addConfig("config", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf"))
+ .configure();
- public static String getSchemaFile() {
- return "schema.xml";
+ CollectionAdminRequest.createCollection(COLLECTION, "config", 1, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+
+ cluster.getSolrClient().waitForState(COLLECTION, DEFAULT_TIMEOUT, TimeUnit.SECONDS,
+ (n, c) -> DocCollection.isFullyActive(n, c, 1, 1));
}
-
- public static String getSolrConfigFile() {
- // use this because it has /update and is minimal
- return "solrconfig-tlog.xml";
+
+ private SolrClient buildClient(HttpClient httpClient, URL url) {
+ switch (random().nextInt(3)) {
+ case 0:
+ // currently only testing with 1 thread
+ return getConcurrentUpdateSolrClient(url.toString() + "/" + COLLECTION, httpClient, 6, 1);
+ case 1:
+ return getHttpSolrClient(url.toString() + "/" + COLLECTION, httpClient);
+ case 2:
+ CloudSolrClient client = getCloudSolrClient(cluster.getZkServer().getZkAddress(), random().nextBoolean(), httpClient);
+ client.setParallelUpdates(random().nextBoolean());
+ client.setDefaultCollection(COLLECTION);
+ client.getLbClient().setConnectionTimeout(30000);
+ client.getLbClient().setSoTimeout(60000);
+ return client;
+ }
+ throw new RuntimeException("impossible");
}
@Test
- public void test() throws Exception {
- URL url = new URL(((HttpSolrClient) clients.get(0)).getBaseURL());
-
- SolrClient client;
+ public void testConnectionReuse() throws Exception {
+
+ URL url = cluster.getJettySolrRunners().get(0).getBaseUrl();
+
HttpClient httpClient = HttpClientUtil.createClient(null);
- int rndClient = random().nextInt(3);
- if (rndClient == 0) {
- client = getConcurrentUpdateSolrClient(url.toString(), httpClient, 6, 1); // currently only testing with 1 thread
- } else if (rndClient == 1) {
- client = getHttpSolrClient(url.toString(), httpClient);
- } else if (rndClient == 2) {
- client = getCloudSolrClient(zkServer.getZkAddress(), random().nextBoolean(), httpClient);
- ((CloudSolrClient) client).setParallelUpdates(random().nextBoolean());
- ((CloudSolrClient) client).setDefaultCollection(DEFAULT_COLLECTION);
- ((CloudSolrClient) client).getLbClient().setConnectionTimeout(30000);
- ((CloudSolrClient) client).getLbClient().setSoTimeout(60000);
- } else {
- throw new RuntimeException("impossible");
- }
-
PoolingClientConnectionManager cm = (PoolingClientConnectionManager) httpClient.getConnectionManager();
- HttpHost target = new HttpHost(url.getHost(), url.getPort(), isSSLMode() ? "https" : "http");
- HttpRoute route = new HttpRoute(target);
-
- ClientConnectionRequest mConn = getClientConnectionRequest(httpClient, route);
-
- ManagedClientConnection conn1 = getConn(mConn);
- headerRequest(target, route, conn1);
- conn1.releaseConnection();
- cm.releaseConnection(conn1, -1, TimeUnit.MILLISECONDS);
-
- int queueBreaks = 0;
- int cnt1 = atLeast(3);
- int cnt2 = atLeast(30);
- for (int j = 0; j < cnt1; j++) {
- for (int i = 0; i < cnt2; i++) {
+ try (SolrClient client = buildClient(httpClient, url)) {
+
+ HttpHost target = new HttpHost(url.getHost(), url.getPort(), isSSLMode() ? "https" : "http");
+ HttpRoute route = new HttpRoute(target);
+
+ ClientConnectionRequest mConn = getClientConnectionRequest(httpClient, route);
+
+ ManagedClientConnection conn1 = getConn(mConn);
+ headerRequest(target, route, conn1);
+ conn1.releaseConnection();
+ cm.releaseConnection(conn1, -1, TimeUnit.MILLISECONDS);
+
+ int queueBreaks = 0;
+ int cnt1 = atLeast(3);
+ int cnt2 = atLeast(30);
+ for (int j = 0; j < cnt1; j++) {
boolean done = false;
- AddUpdateCommand c = new AddUpdateCommand(null);
- c.solrDoc = sdoc("id", id.incrementAndGet());
- try {
- client.add(c.solrDoc);
- } catch (Exception e) {
- e.printStackTrace();
- }
- if (!done && i > 0 && i < cnt2 - 1 && client instanceof ConcurrentUpdateSolrClient && random().nextInt(10) > 8) {
- queueBreaks++;
- done = true;
- Thread.sleep(350); // wait past streaming client poll time of 250ms
+ for (int i = 0; i < cnt2; i++) {
+ AddUpdateCommand c = new AddUpdateCommand(null);
+ c.solrDoc = sdoc("id", id.incrementAndGet());
+ try {
+ client.add(c.solrDoc);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ if (!done && i > 0 && i < cnt2 - 1 && client instanceof ConcurrentUpdateSolrClient
+ && random().nextInt(10) > 8) {
+ queueBreaks++;
+ done = true;
+ Thread.sleep(350); // wait past streaming client poll time of 250ms
+ }
}
}
if (client instanceof ConcurrentUpdateSolrClient) {
((ConcurrentUpdateSolrClient) client).blockUntilFinished();
}
- }
- route = new HttpRoute(new HttpHost(url.getHost(), url.getPort(), isSSLMode() ? "https" : "http"));
-
- mConn = cm.requestConnection(route, null);
-
- ManagedClientConnection conn2 = getConn(mConn);
-
- HttpConnectionMetrics metrics = conn2.getMetrics();
- headerRequest(target, route, conn2);
- conn2.releaseConnection();
- cm.releaseConnection(conn2, -1, TimeUnit.MILLISECONDS);
-
-
- assertNotNull("No connection metrics found - is the connection getting aborted? server closing the connection? " + client.getClass().getSimpleName(), metrics);
-
- // we try and make sure the connection we get has handled all of the requests in this test
- if (client instanceof ConcurrentUpdateSolrClient) {
- // we can't fully control queue polling breaking up requests - allow a bit of leeway
- int exp = cnt1 + queueBreaks + 2;
- assertTrue(
- "We expected all communication via streaming client to use one connection! expected=" + exp + " got="
- + metrics.getRequestCount(),
- Math.max(exp, metrics.getRequestCount()) - Math.min(exp, metrics.getRequestCount()) < 3);
- } else {
- assertTrue("We expected all communication to use one connection! " + client.getClass().getSimpleName(),
- cnt1 * cnt2 + 2 <= metrics.getRequestCount());
+
+ route = new HttpRoute(new HttpHost(url.getHost(), url.getPort(), isSSLMode() ? "https" : "http"));
+
+ mConn = cm.requestConnection(route, null);
+
+ ManagedClientConnection conn2 = getConn(mConn);
+
+ HttpConnectionMetrics metrics = conn2.getMetrics();
+ headerRequest(target, route, conn2);
+ conn2.releaseConnection();
+ cm.releaseConnection(conn2, -1, TimeUnit.MILLISECONDS);
+
+
+ assertNotNull("No connection metrics found - is the connection getting aborted? server closing the connection? " + client.getClass().getSimpleName(), metrics);
+
+ // we try and make sure the connection we get has handled all of the requests in this test
+ if (client instanceof ConcurrentUpdateSolrClient) {
+ // we can't fully control queue polling breaking up requests - allow a bit of leeway
+ int exp = cnt1 + queueBreaks + 2;
+ assertTrue(
+ "We expected all communication via streaming client to use one connection! expected=" + exp + " got="
+ + metrics.getRequestCount(),
+ Math.max(exp, metrics.getRequestCount()) - Math.min(exp, metrics.getRequestCount()) < 3);
+ } else {
+ assertTrue("We expected all communication to use one connection! " + client.getClass().getSimpleName(),
+ cnt1 * cnt2 + 2 <= metrics.getRequestCount());
+ }
+ }
+ finally {
+ HttpClientUtil.close(httpClient);
}
-
- client.close();
+
}
public ManagedClientConnection getConn(ClientConnectionRequest mConn)
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java b/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
index 610bb54..48243bb 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CleanupOldIndexTest.java
@@ -17,55 +17,45 @@
package org.apache.solr.cloud;
import java.io.File;
-import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
+import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils;
-import org.apache.lucene.util.LuceneTestCase.Slow;
-import org.apache.solr.client.solrj.SolrQuery;
-import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.core.CoreContainer;
import org.apache.solr.core.SolrCore;
import org.apache.solr.handler.SnapShooter;
+import org.junit.BeforeClass;
import org.junit.Test;
-@Slow
-public class CleanupOldIndexTest extends AbstractFullDistribZkTestBase {
+@LuceneTestCase.Slow
+public class CleanupOldIndexTest extends SolrCloudTestCase {
- private StoppableIndexingThread indexThread;
-
- public CleanupOldIndexTest() {
- super();
- sliceCount = 1;
- fixShardCount(2);
- schemaString = "schema15.xml";
- }
-
- public static String[] fieldNames = new String[]{"f_i", "f_f", "f_d", "f_l", "f_dt"};
- public static RandVal[] randVals = new RandVal[]{rint, rfloat, rdouble, rlong, rdate};
-
- protected String[] getFieldNames() {
- return fieldNames;
+ @BeforeClass
+ public static void setupCluster() throws Exception {
+ configureCluster(2)
+ .addConfig("conf1", TEST_PATH().resolve("configsets").resolve("cloud-dynamic").resolve("conf"))
+ .configure();
}
- protected RandVal[] getRandValues() {
- return randVals;
- }
+ private static final String COLLECTION = "oldindextest";
@Test
public void test() throws Exception {
- handle.clear();
- handle.put("timestamp", SKIPVAL);
-
+
+ CollectionAdminRequest.createCollection(COLLECTION, "conf1", 1, 2)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+ cluster.getSolrClient().setDefaultCollection(COLLECTION); // TODO make this configurable on StoppableIndexingThread
+
int[] maxDocList = new int[] {300, 700, 1200};
int maxDoc = maxDocList[random().nextInt(maxDocList.length - 1)];
- indexThread = new StoppableIndexingThread(controlClient, cloudClient, "1", true, maxDoc, 1, true);
+ StoppableIndexingThread indexThread = new StoppableIndexingThread(null, cluster.getSolrClient(), "1", true, maxDoc, 1, true);
indexThread.start();
// give some time to index...
@@ -73,10 +63,10 @@ public class CleanupOldIndexTest extends AbstractFullDistribZkTestBase {
Thread.sleep(waitTimes[random().nextInt(waitTimes.length - 1)]);
// create some "old" index directories
- JettySolrRunner jetty = chaosMonkey.getShard("shard1", 1);
+ JettySolrRunner jetty = cluster.getRandomJetty(random());
CoreContainer coreContainer = jetty.getCoreContainer();
File dataDir = null;
- try (SolrCore solrCore = coreContainer.getCore("collection1")) {
+ try (SolrCore solrCore = coreContainer.getCore(coreContainer.getCoreDescriptors().get(0).getName())) {
dataDir = new File(solrCore.getDataDir());
}
assertTrue(dataDir.isDirectory());
@@ -94,66 +84,27 @@ public class CleanupOldIndexTest extends AbstractFullDistribZkTestBase {
assertTrue(oldIndexDir2.isDirectory());
// bring shard replica down
- JettySolrRunner replica = chaosMonkey.stopShard("shard1", 1).jetty;
+ jetty.stop();
// wait a moment - lets allow some docs to be indexed so replication time is non 0
Thread.sleep(waitTimes[random().nextInt(waitTimes.length - 1)]);
-
+
// bring shard replica up
- replica.start();
-
+ jetty.start();
+
// make sure replication can start
Thread.sleep(3000);
- ZkStateReader zkStateReader = cloudClient.getZkStateReader();
-
+
// stop indexing threads
indexThread.safeStop();
indexThread.join();
- Thread.sleep(1000);
-
- waitForThingsToLevelOut(120);
- waitForRecoveriesToFinish(DEFAULT_COLLECTION, zkStateReader, false, true);
-
- // test that leader and replica have same doc count
-
- String fail = checkShardConsistency("shard1", false, false);
- if (fail != null)
- fail(fail);
-
- SolrQuery query = new SolrQuery("*:*");
- query.setParam("distrib", "false");
- long client1Docs = shardToJetty.get("shard1").get(0).client.solrClient.query(query).getResults().getNumFound();
- long client2Docs = shardToJetty.get("shard1").get(1).client.solrClient.query(query).getResults().getNumFound();
-
- assertTrue(client1Docs > 0);
- assertEquals(client1Docs, client2Docs);
+ cluster.getSolrClient().waitForState(COLLECTION, DEFAULT_TIMEOUT, TimeUnit.SECONDS,
+ (n, c) -> DocCollection.isFullyActive(n, c, 1, 2));
assertTrue(!oldIndexDir1.isDirectory());
assertTrue(!oldIndexDir2.isDirectory());
}
- @Override
- protected void indexDoc(SolrInputDocument doc) throws IOException, SolrServerException {
- controlClient.add(doc);
- cloudClient.add(doc);
- }
-
- @Override
- public void distribTearDown() throws Exception {
- // make sure threads have been stopped...
- indexThread.safeStop();
- indexThread.join();
- super.distribTearDown();
- }
-
- // skip the randoms - they can deadlock...
- @Override
- protected void indexr(Object... fields) throws Exception {
- SolrInputDocument doc = new SolrInputDocument();
- addFields(doc, fields);
- addFields(doc, "rnd_b", true);
- indexDoc(doc);
- }
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java b/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java
index ec84c06..a4dc86e 100644
--- a/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java
@@ -16,55 +16,62 @@
*/
package org.apache.solr.cloud;
-import org.apache.lucene.util.LuceneTestCase.Slow;
+import java.util.concurrent.TimeUnit;
+
import org.apache.lucene.util.TestUtil;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.response.SolrQueryResponse;
+import org.junit.BeforeClass;
import org.junit.Test;
/**
* Distributed test for {@link org.apache.lucene.index.ExitableDirectoryReader}
*/
-@Slow
-public class CloudExitableDirectoryReaderTest extends AbstractFullDistribZkTestBase {
+public class CloudExitableDirectoryReaderTest extends SolrCloudTestCase {
+
private static final int NUM_DOCS_PER_TYPE = 20;
private static final String sleep = "2";
-
- public CloudExitableDirectoryReaderTest() {
- configString = "solrconfig-tlog-with-delayingcomponent.xml";
- schemaString = "schema.xml";
- }
- @Override
- protected String getCloudSolrConfig() {
- return configString;
+ private static final String COLLECTION = "exitable";
+
+ @BeforeClass
+ public static void setupCluster() throws Exception {
+ configureCluster(2)
+ .addConfig("conf", TEST_PATH().resolve("configsets").resolve("exitable-directory").resolve("conf"))
+ .configure();
+
+ CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+ cluster.getSolrClient().waitForState(COLLECTION, DEFAULT_TIMEOUT, TimeUnit.SECONDS,
+ (n, c) -> DocCollection.isFullyActive(n, c, 2, 1));
}
@Test
public void test() throws Exception {
- handle.clear();
- handle.put("timestamp", SKIPVAL);
- waitForRecoveriesToFinish(false);
indexDocs();
doTimeoutTests();
}
public void indexDocs() throws Exception {
int counter = 1;
+ UpdateRequest req = new UpdateRequest();
for(; (counter % NUM_DOCS_PER_TYPE) != 0; counter++ )
- indexDoc(sdoc("id", Integer.toString(counter), "name", "a" + counter));
+ req.add(sdoc("id", Integer.toString(counter), "name", "a" + counter));
counter++;
for(; (counter % NUM_DOCS_PER_TYPE) != 0; counter++ )
- indexDoc(sdoc("id", Integer.toString(counter), "name", "b" + counter));
+ req.add(sdoc("id", Integer.toString(counter), "name", "b" + counter));
counter++;
for(; counter % NUM_DOCS_PER_TYPE != 0; counter++ )
- indexDoc(sdoc("id", Integer.toString(counter), "name", "dummy term doc" + counter));
+ req.add(sdoc("id", Integer.toString(counter), "name", "dummy term doc" + counter));
- commit();
+ req.commit(cluster.getSolrClient(), COLLECTION);
}
public void doTimeoutTests() throws Exception {
@@ -96,13 +103,13 @@ public class CloudExitableDirectoryReaderTest extends AbstractFullDistribZkTestB
* execute a request, verify that we get an expected error
*/
public void assertPartialResults(ModifiableSolrParams p) throws Exception {
- QueryResponse rsp = queryServer(p);
+ QueryResponse rsp = cluster.getSolrClient().query(COLLECTION, p);
assertEquals(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY+" were expected",
true, rsp.getHeader().get(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY));
}
public void assertSuccess(ModifiableSolrParams p) throws Exception {
- QueryResponse response = queryServer(p);
+ QueryResponse response = cluster.getSolrClient().query(COLLECTION, p);
assertEquals("Wrong #docs in response", NUM_DOCS_PER_TYPE - 1, response.getResults().getNumFound());
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java b/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
index 8e13103..b749134 100644
--- a/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/ConfigSetsAPITest.java
@@ -16,41 +16,34 @@
*/
package org.apache.solr.cloud;
-import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.ConfigSetAdminRequest;
import org.apache.solr.common.SolrException;
+import org.junit.BeforeClass;
import org.junit.Test;
-@LuceneTestCase.Slow
-public class ConfigSetsAPITest extends AbstractFullDistribZkTestBase {
- public ConfigSetsAPITest() {
- super();
- sliceCount = 1;
+public class ConfigSetsAPITest extends SolrCloudTestCase {
+
+ @BeforeClass
+ public static void setupCluster() throws Exception {
+ configureCluster(1)
+ .addConfig("conf1", TEST_PATH().resolve("configsets").resolve("cloud-minimal").resolve("conf"))
+ .configure();
}
@Test
public void testConfigSetDeleteWhenInUse() throws Exception {
- CollectionAdminRequest.Create create = new CollectionAdminRequest.Create();
- create.setConfigName("conf1");
- create.setCollectionName("test_configset_delete");
- create.setNumShards(1);
- create.process(cloudClient);
- waitForCollection(cloudClient.getZkStateReader(), "test_configset_delete", 1);
+ CollectionAdminRequest.createCollection("test_configset_delete", "conf1", 1, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+
+ // TODO - check exception response!
ConfigSetAdminRequest.Delete deleteConfigRequest = new ConfigSetAdminRequest.Delete();
deleteConfigRequest.setConfigSetName("conf1");
- try {
- deleteConfigRequest.process(cloudClient);
- fail("The config deletion should cause an exception as it's currently being used by a collection.");
- } catch (SolrException e) {
- // Do nothing
- }
-
- // Clean up the collection
- CollectionAdminRequest.Delete deleteCollectionRequest = new CollectionAdminRequest.Delete();
- deleteCollectionRequest.setCollectionName("test_configset_delete");
- deleteCollectionRequest.process(cloudClient);
+ expectThrows(SolrException.class, () -> {
+ deleteConfigRequest.process(cluster.getSolrClient());
+ });
+
}
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f1e870c0/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java
index e1d9922..31f8418 100644
--- a/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/DistribDocExpirationUpdateProcessorTest.java
@@ -16,62 +16,62 @@
*/
package org.apache.solr.cloud;
+import java.io.IOException;
+import java.lang.invoke.MethodHandles;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
+import org.apache.solr.common.cloud.DocCollection;
+import org.apache.solr.common.cloud.Replica;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList;
import org.apache.solr.handler.ReplicationHandler;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.params.ModifiableSolrParams;
-
-import org.apache.solr.update.processor.DocExpirationUpdateProcessorFactory; // jdoc
-import org.apache.solr.update.processor.DocExpirationUpdateProcessorFactoryTest;
-
+import org.apache.solr.update.processor.DocExpirationUpdateProcessorFactory;
import org.apache.solr.util.TimeOut;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.HashMap;
-import java.util.concurrent.TimeUnit;
-
/** Test of {@link DocExpirationUpdateProcessorFactory} in a cloud setup */
@Slow // Has to do some sleeping to wait for a future expiration
-public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistribZkTestBase {
+public class DistribDocExpirationUpdateProcessorTest extends SolrCloudTestCase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- public DistribDocExpirationUpdateProcessorTest() {
- configString = DocExpirationUpdateProcessorFactoryTest.CONFIG_XML;
- schemaString = DocExpirationUpdateProcessorFactoryTest.SCHEMA_XML;
- }
+ private static final String COLLECTION = "expiry";
+
+ @BeforeClass
+ public static void setupCluster() throws Exception {
+ configureCluster(2)
+ .addConfig("conf", TEST_PATH().resolve("configsets").resolve("doc-expiry").resolve("conf"))
+ .configure();
- @Override
- protected String getCloudSolrConfig() {
- return configString;
+ CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1)
+ .processAndWait(cluster.getSolrClient(), DEFAULT_TIMEOUT);
+ cluster.getSolrClient().waitForState(COLLECTION, DEFAULT_TIMEOUT, TimeUnit.SECONDS,
+ (n, c) -> DocCollection.isFullyActive(n, c, 2, 1));
}
@Test
public void test() throws Exception {
- assertTrue("only one shard?!?!?!", 1 < shardToJetty.keySet().size());
- log.info("number of shards: {}", shardToJetty.keySet().size());
-
- handle.clear();
- handle.put("maxScore", SKIPVAL);
- handle.put("timestamp", SKIPVAL);
// some docs with no expiration
+ UpdateRequest req1 = new UpdateRequest();
for (int i = 1; i <= 100; i++) {
- indexDoc(sdoc("id", i));
+ req1.add(sdoc("id", i));
}
- commit();
- waitForRecoveriesToFinish(false, 45);
+ req1.commit(cluster.getSolrClient(), COLLECTION);
// this doc better not already exist
waitForNoResults(0, params("q","id:999","rows","0","_trace","sanity_check"));
@@ -81,10 +81,8 @@ public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistrib
final Map<String,Long> initIndexVersions = getIndexVersionOfAllReplicas();
assertTrue("WTF? no versions?", 0 < initIndexVersions.size());
-
// add a doc with a short TTL
- indexDoc(sdoc("id", "999", "tTl_s","+30SECONDS"));
- commit();
+ new UpdateRequest().add(sdoc("id", "999", "tTl_s","+30SECONDS")).commit(cluster.getSolrClient(), COLLECTION);
// wait for one doc to be deleted
waitForNoResults(180, params("q","id:999","rows","0","_trace","did_it_expire_yet"));
@@ -99,20 +97,19 @@ public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistrib
final Set<String> shardsThatChange = new HashSet<String>();
int coresCompared = 0;
- for (String shard : shardToJetty.keySet()) {
- for (CloudJettyRunner replicaRunner : shardToJetty.get(shard)) {
- coresCompared++;
-
- String core = replicaRunner.coreNodeName;
- Long initVersion = initIndexVersions.get(core);
- Long finalVersion = finalIndexVersions.get(core);
- assertNotNull(shard + ": no init version for core: " + core, initVersion);
- assertNotNull(shard + ": no final version for core: " + core, finalVersion);
-
- if (!initVersion.equals(finalVersion)) {
- nodesThatChange.add(core + "("+shard+")");
- shardsThatChange.add(shard);
- }
+ DocCollection collectionState = cluster.getSolrClient().getZkStateReader().getClusterState().getCollection(COLLECTION);
+ for (Replica replica : collectionState.getReplicas()) {
+ coresCompared++;
+ String name = replica.getName();
+ String core = replica.getCoreName();
+ Long initVersion = initIndexVersions.get(core);
+ Long finalVersion = finalIndexVersions.get(core);
+ assertNotNull(name + ": no init version for core: " + core, initVersion);
+ assertNotNull(name + ": no final version for core: " + core, finalVersion);
+
+ if (!initVersion.equals(finalVersion)) {
+ nodesThatChange.add(core + "("+name+")");
+ shardsThatChange.add(name);
}
}
@@ -136,32 +133,36 @@ public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistrib
private Map<String,Long> getIndexVersionOfAllReplicas() throws IOException, SolrServerException {
Map<String,Long> results = new HashMap<String,Long>();
- for (List<CloudJettyRunner> listOfReplicas : shardToJetty.values()) {
- for (CloudJettyRunner replicaRunner : listOfReplicas) {
+ DocCollection collectionState = cluster.getSolrClient().getZkStateReader().getClusterState().getCollection(COLLECTION);
+
+ for (Replica replica : collectionState.getReplicas()) {
+
+ String coreName = replica.getCoreName();
+ try (HttpSolrClient client = getHttpSolrClient(replica.getCoreUrl())) {
+
ModifiableSolrParams params = new ModifiableSolrParams();
- params.set("command","indexversion");
- params.set("_trace","getIndexVersion");
- params.set("qt",ReplicationHandler.PATH);
+ params.set("command", "indexversion");
+ params.set("_trace", "getIndexVersion");
+ params.set("qt", ReplicationHandler.PATH);
QueryRequest req = new QueryRequest(params);
-
- NamedList<Object> res = replicaRunner.client.solrClient.request(req);
- assertNotNull("null response from server: " + replicaRunner.coreNodeName, res);
+
+ NamedList<Object> res = client.request(req);
+ assertNotNull("null response from server: " + coreName, res);
Object version = res.get("indexversion");
- assertNotNull("null version from server: " + replicaRunner.coreNodeName, version);
- assertTrue("version isn't a long: "+replicaRunner.coreNodeName,
- version instanceof Long);
- results.put(replicaRunner.coreNodeName, (Long)version);
+ assertNotNull("null version from server: " + coreName, version);
+ assertTrue("version isn't a long: " + coreName, version instanceof Long);
+ results.put(coreName, (Long) version);
- long numDocs = replicaRunner.client.solrClient.query
- (params("q","*:*","distrib","false","rows","0","_trace","counting_docs"))
- .getResults().getNumFound();
- log.info("core=" + replicaRunner.coreNodeName + "; ver=" + version +
- "; numDocs=" + numDocs);
+ long numDocs = client.query(params("q", "*:*", "distrib", "false", "rows", "0", "_trace", "counting_docs"))
+ .getResults().getNumFound();
+ log.info("core=" + coreName + "; ver=" + version +
+ "; numDocs=" + numDocs);
}
}
+
return results;
}
@@ -175,10 +176,10 @@ public class DistribDocExpirationUpdateProcessorTest extends AbstractFullDistrib
throws SolrServerException, InterruptedException, IOException {
final TimeOut timeout = new TimeOut(maxTimeLimitSeconds, TimeUnit.SECONDS);
- long numFound = cloudClient.query(params).getResults().getNumFound();
+ long numFound = cluster.getSolrClient().query(COLLECTION, params).getResults().getNumFound();
while (0L < numFound && ! timeout.hasTimedOut()) {
Thread.sleep(Math.max(1, Math.min(5000, timeout.timeLeft(TimeUnit.MILLISECONDS))));
- numFound = cloudClient.query(params).getResults().getNumFound();
+ numFound = cluster.getSolrClient().query(COLLECTION, params).getResults().getNumFound();
}
assertEquals("Give up waiting for no results: " + params,
0L, numFound);