Apache Solr open-source search software
SOLR-6564: Fix failing CloudExitableDirectoryReader test in Solr
Anshum Gupta8a004bc63dd3
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog-with-delayingcomponent.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog-with-delayingcomponent.xmlnew file mode 100644index 00000000000..f62a2e109f2--- /dev/null+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog-with-delayingcomponent.xml@@ -0,0 +1,142 @@+<?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:false}</str>+ </directoryFactory>++ <dataDir>${solr.data.dir:}</dataDir>++ <xi:include href="solrconfig.snippet.randomindexconfig.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>++ <!-- 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>++ <requestHandler name="/get" class="solr.RealTimeGetHandler">+ <lst name="defaults">+ <str name="omitHeader">true</str>+ </lst>+ </requestHandler>++ <requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />++ <requestHandler name="/update" class="solr.UpdateRequestHandler" />++ <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>++ <requestHandler name="/admin/" class="org.apache.solr.handler.admin.AdminHandlers" />++ <requestHandler name="/admin/file" class="solr.admin.ShowFileRequestHandler" >+ <lst name="invariants">+ <str name="hidden">bogus.txt</str>+ </lst>+ </requestHandler>++ <requestHandler name="/admin/fileedit" class="solr.admin.EditFileRequestHandler" >+ <lst name="invariants">+ <str name="hidden">bogus.txt</str>+ </lst>+ </requestHandler>++ <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>diff --git a/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java b/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.javaindex 180171c9c46..8996e59b46e 100644--- a/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java+++ b/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java@@ -18,6 +18,7 @@ package org.apache.solr.cloud;*/+import org.apache.lucene.util.LuceneTestCase.Slow;import org.apache.lucene.util.TestUtil;import org.apache.solr.client.solrj.SolrServerException;import org.apache.solr.client.solrj.response.QueryResponse;@@ -31,12 +32,13 @@ import static org.apache.solr.common.SolrException.ErrorCode;/*** Distributed test for {@link org.apache.lucene.index.ExitableDirectoryReader}*/+@Slowpublic class CloudExitableDirectoryReaderTest extends AbstractFullDistribZkTestBase {public static Logger log = LoggerFactory.getLogger(CloudExitableDirectoryReaderTest.class);- private static final int NUM_DOCS_PER_TYPE = 2000;+ private static final int NUM_DOCS_PER_TYPE = 20;public CloudExitableDirectoryReaderTest() {- configString = "solrconfig-tlog.xml";+ configString = "solrconfig-tlog-with-delayingcomponent.xml";schemaString = "schema.xml";}@@ -74,13 +76,19 @@ public class CloudExitableDirectoryReaderTest extends AbstractFullDistribZkTestBpublic void doTimeoutTests() throws Exception {assertFail(params("q", "name:a*", "timeAllowed", "1"));- long oneSecond = 1000L; // query rewriting for NUM_DOCS_PER_TYPE terms should take less time than this- Long timeAllowed = TestUtil.nextLong(random(), oneSecond, Long.MAX_VALUE);+ /*+ query rewriting for NUM_DOCS_PER_TYPE terms should take less+ time than this. Keeping it at 5 because the delaying search component delays all requests+ by at 1 second.+ */+ long fiveSeconds = 5000L;++ Long timeAllowed = TestUtil.nextLong(random(), fiveSeconds, Long.MAX_VALUE);assertSuccess(params("q", "name:a*", "timeAllowed",timeAllowed.toString()));assertFail(params("q", "name:a*", "timeAllowed", "1"));- timeAllowed = TestUtil.nextLong(random(), oneSecond, Long.MAX_VALUE);+ timeAllowed = TestUtil.nextLong(random(), fiveSeconds, Long.MAX_VALUE);assertSuccess(params("q", "name:b*", "timeAllowed",timeAllowed.toString()));timeAllowed = TestUtil.nextLong(random(), Long.MIN_VALUE, -1L); // negative timeAllowed should disable timeouts