Skip to content

Apache Lucene open-source search software

SOLR-7421: RecoveryAfterSoftCommitTest fails frequently on Jenkins due to full index replication taking longer than 30 seconds

Shalin Shekhar Mangarda1cd63a22fb
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 6a21a7e9da4..8bddf3bb414 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -176,6 +176,9 @@ Other Changes
* SOLR-6886: Removed redundant size check and added missing calls to
DelegatingCollection.finish inside Grouping code. (Christine Poerschke via shalin)
+* SOLR-7421: RecoveryAfterSoftCommitTest fails frequently on Jenkins due to full index
+ replication taking longer than 30 seconds. (Timothy Potter, shalin)
+
================== 5.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml
index 412f443a6c5..f84b8db08d5 100644
--- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml
+++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-tlog.xml
@@ -49,6 +49,8 @@
<updateHandler class="solr.DirectUpdateHandler2">
<updateLog>
<str name="dir">${solr.ulog.dir:}</str>
+ <str name="maxNumLogsToKeep">${solr.ulog.maxNumLogsToKeep:10}</str>
+ <str name="numRecordsToKeep">${solr.ulog.numRecordsToKeep:100}</str>
</updateLog>
</updateHandler>
diff --git a/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java b/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java
index 4a9f923f8c0..26093766db0 100644
--- a/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/RecoveryAfterSoftCommitTest.java
@@ -33,8 +33,8 @@ import org.junit.Test;
// See SOLR-6640
@SolrTestCaseJ4.SuppressSSL
[email protected](bugUrl = "https://issues.apache.org/jira/browse/SOLR-7421")
public class RecoveryAfterSoftCommitTest extends AbstractFullDistribZkTestBase {
+ private static final int MAX_BUFFERED_DOCS = 2, ULOG_NUM_RECORDS_TO_KEEP = 2;
public RecoveryAfterSoftCommitTest() {
sliceCount = 1;
@@ -43,12 +43,20 @@ public class RecoveryAfterSoftCommitTest extends AbstractFullDistribZkTestBase {
@BeforeClass
public static void beforeTests() {
- System.setProperty("solr.tests.maxBufferedDocs", "2");
+ System.setProperty("solr.tests.maxBufferedDocs", String.valueOf(MAX_BUFFERED_DOCS));
+ System.setProperty("solr.ulog.numRecordsToKeep", String.valueOf(ULOG_NUM_RECORDS_TO_KEEP));
+ // the default=7000ms artificially slows down recovery and is not needed for this test
+ System.setProperty("solr.cloud.wait-for-updates-with-stale-state-pause", "500");
+ // avoid creating too many files, see SOLR-7421
+ System.setProperty("useCompoundFile", "true");
}
@AfterClass
public static void afterTest() {
System.clearProperty("solr.tests.maxBufferedDocs");
+ System.clearProperty("solr.ulog.numRecordsToKeep");
+ System.clearProperty("solr.cloud.wait-for-updates-with-stale-state-pause");
+ System.clearProperty("useCompoundFile");
}
/**
@@ -64,8 +72,10 @@ public class RecoveryAfterSoftCommitTest extends AbstractFullDistribZkTestBase {
@Test
public void test() throws Exception {
+ waitForRecoveriesToFinish(DEFAULT_COLLECTION, true);
// flush twice
- for (int i=0; i<4; i++) {
+ int i = 0;
+ for (; i<MAX_BUFFERED_DOCS + 1; i++) {
SolrInputDocument document = new SolrInputDocument();
document.addField("id", String.valueOf(i));
document.addField("a_t", "text_" + i);
@@ -82,8 +92,9 @@ public class RecoveryAfterSoftCommitTest extends AbstractFullDistribZkTestBase {
proxy.close();
- // add more than 100 docs so that peer sync cannot be used for recovery
- for (int i=5; i<115; i++) {
+ // add more than ULOG_NUM_RECORDS_TO_KEEP docs so that peer sync cannot be used for recovery
+ int MAX_DOCS = 2 + MAX_BUFFERED_DOCS + ULOG_NUM_RECORDS_TO_KEEP;
+ for (; i < MAX_DOCS; i++) {
SolrInputDocument document = new SolrInputDocument();
document.addField("id", String.valueOf(i));
document.addField("a_t", "text_" + i);