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/07/15 00:43:44 UTC

[lucene-solr] branch reference_impl updated (738556b -> ad372f9)

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a change to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git.


    from 738556b  #160- Add to flakies for now.
     new cbf2e16  #161- Add a timeout toe SolrQueuedThreadPool.
     new ad372f9  #162- Knock down some test timeouts.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../solr/cloud/TestSolrCloudWithKerberosAlt.java   |  4 +--
 .../TestCollectionsAPIViaSolrCloudCluster.java     |  3 +-
 .../solr/cloud/cdcr/BaseCdcrDistributedZkTest.java | 37 +---------------------
 .../hadoop/TestSolrCloudWithHadoopAuthPlugin.java  |  3 +-
 .../solr/common/util/SolrQueuedThreadPool.java     |  5 +++
 .../solr/cloud/AbstractDistribZkTestBase.java      |  9 +++---
 6 files changed, 13 insertions(+), 48 deletions(-)


[lucene-solr] 01/02: #161- Add a timeout toe SolrQueuedThreadPool.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit cbf2e161accf6411345a538f5f7955be045589e4
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 19:35:00 2020 -0500

    #161- Add a timeout toe SolrQueuedThreadPool.
---
 .../src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
index 59c6c0b..fe89147 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/SolrQueuedThreadPool.java
@@ -18,6 +18,7 @@ package org.apache.solr.common.util;
 
 import java.io.Closeable;
 import java.lang.invoke.MethodHandles;
+import java.util.concurrent.TimeUnit;
 
 import org.apache.solr.common.util.ObjectReleaseTracker;
 import org.apache.solr.common.util.SolrNamedThreadFactory;
@@ -67,7 +68,11 @@ public class SolrQueuedThreadPool extends QueuedThreadPool implements Closeable
 //    }
 
     public void close() {
+        TimeOut timeout = new TimeOut(5, TimeUnit.SECONDS, TimeSource.NANO_TIME);
         while (getBusyThreads() != 0) {
+            if (timeout.hasTimedOut()) {
+                throw new RuntimeException("Timed out waiting for SolrQueuedThreadPool to close");
+            }
             try {
                 synchronized (notify) {
                     notify.wait(500);


[lucene-solr] 02/02: #162- Knock down some test timeouts.

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git

commit ad372f91eaabb877681565587a236449088f40d8
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Tue Jul 14 19:35:24 2020 -0500

    #162- Knock down some test timeouts.
---
 .../solr/cloud/TestSolrCloudWithKerberosAlt.java   |  4 +--
 .../TestCollectionsAPIViaSolrCloudCluster.java     |  3 +-
 .../solr/cloud/cdcr/BaseCdcrDistributedZkTest.java | 37 +---------------------
 .../hadoop/TestSolrCloudWithHadoopAuthPlugin.java  |  3 +-
 .../solr/cloud/AbstractDistribZkTestBase.java      |  9 +++---
 5 files changed, 8 insertions(+), 48 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
index ae1175e..cffe034 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithKerberosAlt.java
@@ -141,9 +141,7 @@ public class TestSolrCloudWithKerberosAlt extends SolrCloudTestCase {
         
     // delete the collection we created earlier
     CollectionAdminRequest.deleteCollection(collectionName).process(client);
-        
-    AbstractDistribZkTestBase.waitForCollectionToDisappear
-        (collectionName, client.getZkStateReader(), true, 330);
+    cluster.waitForRemovedCollection(collectionName);
   }
 
   @Override
diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java
index f3bad87..47709ad 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/TestCollectionsAPIViaSolrCloudCluster.java
@@ -169,8 +169,7 @@ public class TestCollectionsAPIViaSolrCloudCluster extends SolrCloudTestCase {
     assertEquals(nodeCount, cluster.getJettySolrRunners().size());
 
     CollectionAdminRequest.deleteCollection(collectionName).process(client);
-    AbstractDistribZkTestBase.waitForCollectionToDisappear
-        (collectionName, client.getZkStateReader(), true, 330);
+    cluster.waitForRemovedCollection(collectionName);
 
     // create it again
     createCollection(collectionName, null);
diff --git a/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java b/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java
index b63752a..87bdac1 100644
--- a/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/cdcr/BaseCdcrDistributedZkTest.java
@@ -355,18 +355,6 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {
   }
 
   /**
-   * Clear the source collection. It will delete then create the collection through the collection API.
-   * The collection will have a new fresh index, i.e., including a new update log.
-   */
-  protected void clearSourceCollection() throws Exception {
-    this.deleteCollection(SOURCE_COLLECTION);
-    this.waitForCollectionToDisappear(SOURCE_COLLECTION);
-    this.createCollection(SOURCE_COLLECTION);
-    this.waitForRecoveriesToFinish(SOURCE_COLLECTION, true);
-    this.updateMappingsFromZk(SOURCE_COLLECTION);
-  }
-
-  /**
    * Starts the servers, saves and associates the node names to the target collection,
    * and finally creates the target collection.
    */
@@ -379,18 +367,6 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {
   }
 
   /**
-   * Clear the source collection. It will delete then create the collection through the collection API.
-   * The collection will have a new fresh index, i.e., including a new update log.
-   */
-  protected void clearTargetCollection() throws Exception {
-    this.deleteCollection(TARGET_COLLECTION);
-    this.waitForCollectionToDisappear(TARGET_COLLECTION);
-    this.createCollection(TARGET_COLLECTION);
-    this.waitForRecoveriesToFinish(TARGET_COLLECTION, true);
-    this.updateMappingsFromZk(TARGET_COLLECTION);
-  }
-
-  /**
    * Create a new collection through the Collection API. It enforces the use of one max shard per node.
    * It will define the nodes to spread the new collection across by using the mapping {@link #collectionToNodeNames},
    * to ensure that a node will not host more than one core (which will create problem when trying to restart servers).
@@ -492,17 +468,6 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {
     return res;
   }
 
-  private void waitForCollectionToDisappear(String collection) throws Exception {
-    CloudSolrClient client = this.createCloudClient(null);
-    try {
-      client.connect();
-      ZkStateReader zkStateReader = client.getZkStateReader();
-      AbstractDistribZkTestBase.waitForCollectionToDisappear(collection, zkStateReader, true, 15);
-    } finally {
-      client.close();
-    }
-  }
-
   private void waitForRecoveriesToFinish(String collection, boolean verbose) throws Exception {
     CloudSolrClient client = this.createCloudClient(null);
     try {
@@ -611,7 +576,7 @@ public class BaseCdcrDistributedZkTest extends AbstractDistribZkTestBase {
     this.waitForRecoveriesToFinish(temporaryCollection,zkStateReader, true);
     // delete the temporary collection - we will create our own collections later
     this.deleteCollection(temporaryCollection);
-    this.waitForCollectionToDisappear(temporaryCollection);
+    this.waitForCollectionToDisappear(temporaryCollection, zkStateReader);
     System.clearProperty("collection");
 
     return nodeNames;
diff --git a/solr/core/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithHadoopAuthPlugin.java b/solr/core/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithHadoopAuthPlugin.java
index 877f396..c59eaf9 100644
--- a/solr/core/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithHadoopAuthPlugin.java
+++ b/solr/core/src/test/org/apache/solr/security/hadoop/TestSolrCloudWithHadoopAuthPlugin.java
@@ -138,8 +138,7 @@ public class TestSolrCloudWithHadoopAuthPlugin extends SolrCloudAuthTestCase {
 
     CollectionAdminRequest.Delete deleteReq = CollectionAdminRequest.deleteCollection(collectionName);
     deleteReq.process(solrClient);
-    AbstractDistribZkTestBase.waitForCollectionToDisappear(collectionName,
-        solrClient.getZkStateReader(), true, 330);
+    cluster.waitForRemovedCollection(collectionName);
     assertAuthMetricsMinimums(14, 8, 0, 6, 0, 0);
   }
 }
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
index 8e28cd0..480c233 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
@@ -201,13 +201,12 @@ public abstract class AbstractDistribZkTestBase extends BaseDistributedSearchTes
   }
 
 
-  public static void waitForCollectionToDisappear(String collection,
-      ZkStateReader zkStateReader, boolean failOnTimeout, int timeoutSeconds)
+  public static void waitForCollectionToDisappear(String collection, ZkStateReader zkStateReader)
       throws Exception {
-    log.info("Wait for collection to disappear - collection: {} failOnTimeout:{} timeout (sec):{}"
-        , collection, failOnTimeout, timeoutSeconds);
+    log.info("Wait for collection to disappear - collection: {}"
+        , collection);
 
-    zkStateReader.waitForState(collection, timeoutSeconds, TimeUnit.SECONDS, (docCollection) -> docCollection == null);
+    zkStateReader.waitForState(collection, 10, TimeUnit.SECONDS, (docCollection) -> docCollection == null);
     log.info("Collection has disappeared - collection:{}", collection);
   }