You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/10/29 04:18:34 UTC
[lucene-solr] 02/02: @1065 Harden.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit 3dc1b71a4e139f2e92a78a494900fae6bd535ea3
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Wed Oct 28 23:18:07 2020 -0500
@1065 Harden.
---
solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java | 6 +-----
.../solr/update/processor/DistributedUpdateProcessor.java | 5 ++---
.../src/test/org/apache/solr/cloud/TestCloudRecovery2.java | 10 +++++++++-
.../solr/response/transform/TestChildDocTransformer.java | 7 ++-----
.../solr/client/solrj/embedded/SolrExampleEmbeddedTest.java | 2 ++
.../solr/client/solrj/io/stream/StreamExpressionTest.java | 2 +-
.../java/org/apache/solr/BaseDistributedSearchTestCase.java | 7 ++++---
7 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
index 4308393..83be9ef 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
@@ -78,10 +78,6 @@ public class ZkShardTerms implements AutoCloseable{
private final AtomicReference<ShardTerms> terms = new AtomicReference<>();
- public void addAll(ZkShardTerms old) {
- this.terms.get().getTerms().putAll(old.getTerms());
- }
-
/**
* Listener of a core for shard's term change events
*/
@@ -205,7 +201,7 @@ public class ZkShardTerms implements AutoCloseable{
return true;
}
tries++;
- if (tries > 15) {
+ if (tries > 30) {
log.warn("Could not save terms to zk within " + tries + " tries");
return true;
}
diff --git a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
index b0008ad..870d5bd 100644
--- a/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
+++ b/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
@@ -72,7 +72,6 @@ import static org.apache.solr.common.params.CommonParams.DISTRIB;
import static org.apache.solr.update.processor.DistributingUpdateProcessorFactory.DISTRIB_UPDATE_PARAM;
// NOT mt-safe... create a new processor for each add thread
-// TODO: we really should not wait for distrib after local? unless a certain replication factor is asked for
public class DistributedUpdateProcessor extends UpdateRequestProcessor {
final static String PARAM_WHITELIST_CTX_KEY = DistributedUpdateProcessor.class + "PARAM_WHITELIST_CTX_KEY";
@@ -784,7 +783,7 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
// we have to spoof the replicationTracker and set the achieved rf to the number of active replicas.
//
protected void doDeleteById(DeleteUpdateCommand cmd) throws IOException {
-
+ // TODO: parallel
setupRequest(cmd);
boolean dropCmd = false;
@@ -872,7 +871,7 @@ public class DistributedUpdateProcessor extends UpdateRequestProcessor {
versionDeleteByQuery(cmd);
- try (ParWork work = new ParWork(this)) {
+ try (ParWork work = new ParWork(this, false, true)) {
work.collect("localDeleteByQuery", () -> {
try {
doLocalDelete(cmd);
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery2.java b/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery2.java
index b355d63..509d8ad 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery2.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestCloudRecovery2.java
@@ -18,6 +18,7 @@
package org.apache.solr.cloud;
import java.lang.invoke.MethodHandles;
+import java.util.concurrent.TimeUnit;
import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrQuery;
@@ -39,7 +40,7 @@ public class TestCloudRecovery2 extends SolrCloudTestCase {
@BeforeClass
public static void setupCluster() throws Exception {
- System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
+ useFactory(null);
System.setProperty("solr.ulog.numRecordsToKeep", "1000");
configureCluster(2)
@@ -60,6 +61,13 @@ public class TestCloudRecovery2 extends SolrCloudTestCase {
node2.stop();
+ cluster.waitForActiveCollection(COLLECTION, 1, 1, true);
+
+ cluster.getSolrClient().getZkStateReader().waitForLiveNodes(5, TimeUnit.SECONDS, (oldLiveNodes, newLiveNodes) -> newLiveNodes.size() == 1);
+
+ // we need to be sure the jetty has the up to date state, but we are not using a smart client here
+ Thread.sleep(250);
+
UpdateRequest req = new UpdateRequest();
for (int i = 0; i < 100; i++) {
req = req.add("id", i+"", "num", i+"");
diff --git a/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java b/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java
index c286e36..e880552 100644
--- a/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java
+++ b/solr/core/src/test/org/apache/solr/response/transform/TestChildDocTransformer.java
@@ -32,7 +32,6 @@ import org.junit.Test;
import static org.hamcrest.core.StringContains.containsString;
-// nocommit - note this test is flakey, I think sometimes does not return a version - testParentFilter and testAllParams
public class TestChildDocTransformer extends SolrTestCaseJ4 {
private static String ID_FIELD = "id";
@@ -46,14 +45,13 @@ public class TestChildDocTransformer extends SolrTestCaseJ4 {
@After
public void cleanup() throws Exception {
assertU(delQ("*:*"));
- assertU(commit());
+ // TODO: if we followed this with a commit, this test would randomly fail, I think do to not getting a full & good delete
}
@Test
- // nocommit - note this test is flakey, I think sometimes does not return a version - testParentFilter and testAllParams
public void testParentFilter() throws Exception {
for(int i=0; i<titleVals.length; i++) {
- titleVals[i] = TestUtil.randomSimpleString(random(), 1, 20);
+ titleVals[i] = TestUtil.randomSimpleString(random(), 5, 20);
}
createIndex(titleVals);
testParentFilterJSON();
@@ -63,7 +61,6 @@ public class TestChildDocTransformer extends SolrTestCaseJ4 {
}
@Test
- // nocommit - note this test is flakey, I think sometimes does not return a version - testParentFilter and testAllParams
public void testAllParams() throws Exception {
createSimpleIndex();
testChildDoctransformerJSON();
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
index 89d7148..b34f7cf 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.solr.client.solrj.embedded;
+import org.apache.lucene.util.LuceneTestCase;
import org.apache.solr.client.solrj.SolrExampleTests;
import org.junit.BeforeClass;
@@ -25,6 +26,7 @@ import org.junit.BeforeClass;
*
* @since solr 1.3
*/
+@LuceneTestCase.Nightly
public class SolrExampleEmbeddedTest extends SolrExampleTests {
@BeforeClass
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
index d0f19b6..d45cfed 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/io/stream/StreamExpressionTest.java
@@ -67,7 +67,7 @@ import org.junit.Test;
@Slow
@SolrTestCaseJ4.SuppressSSL
@LuceneTestCase.SuppressCodecs({"Lucene3x", "Lucene40","Lucene41","Lucene42","Lucene45"})
-
+@LuceneTestCase.Nightly
public class StreamExpressionTest extends SolrCloudTestCase {
private static final String COLLECTIONORALIAS = "collection1";
diff --git a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
index eacec1b..6ba236d 100644
--- a/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
@@ -359,7 +359,7 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
}
- try (ParWork worker = new ParWork(this)) {
+ try (ParWork worker = new ParWork(this, false, true)) {
worker.collect("createControlJetty", () -> {
try {
controlJetty = createControlJetty();
@@ -435,15 +435,16 @@ public abstract class BaseDistributedSearchTestCase extends SolrTestCaseJ4 {
private volatile boolean destroyServersCalled = false;
protected void destroyServers() throws Exception {
- System.out.println("DESTROYSERVERS");
// if (destroyServersCalled) throw new RuntimeException("destroyServers already called");
// destroyServersCalled = true;
- try (ParWork closer = new ParWork(this, true)) {
+ try (ParWork closer = new ParWork(this, true, true)) {
closer.collect(controlClient, clients, jettys, controlJetty);
}
clients.clear();
jettys.clear();
+ controlClient = null;
+ controlJetty = null;
}
public JettySolrRunner createJetty(File solrHome, String dataDir) throws Exception {