You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2020/10/09 15:11:57 UTC

[lucene-solr] branch reference_impl_dev updated: Re-enable test after beasting, seems to pass but need to watch

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

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new f3185ab  Re-enable test after beasting, seems to pass but need to watch
f3185ab is described below

commit f3185abbf45d094c9d6bd66948387850945ae14f
Author: Timothy Potter <th...@gmail.com>
AuthorDate: Fri Oct 9 09:11:45 2020 -0600

    Re-enable test after beasting, seems to pass but need to watch
---
 .../CollectionsAPIDistClusterPerZkTest.java        |  1 -
 .../apache/solr/cloud/MiniSolrCloudCluster.java    | 28 ++++++++++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistClusterPerZkTest.java b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistClusterPerZkTest.java
index 8656464..64d8e9a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistClusterPerZkTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionsAPIDistClusterPerZkTest.java
@@ -80,7 +80,6 @@ import java.util.concurrent.TimeUnit;
 /**
  * Tests the Cloud Collections API.
  */
-@Ignore // nocommit ~ debug, TJP: fails randomly deleting collections during tear down
 public class CollectionsAPIDistClusterPerZkTest extends SolrCloudTestCase {
   private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
   protected static volatile String configSet = "cloud-minimal";
diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
index d85b0ec..4a57fed 100644
--- a/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
+++ b/solr/test-framework/src/java/org/apache/solr/cloud/MiniSolrCloudCluster.java
@@ -27,7 +27,10 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.Random;
@@ -607,21 +610,36 @@ public class MiniSolrCloudCluster {
     ZkStateReader reader = solrClient.getZkStateReader();
 
     reader.aliasesManager.applyModificationAndExportToZk(aliases -> Aliases.EMPTY);
-    for (String collection : reader.getClusterState().getCollectionsMap().keySet()) {
+    Map<String,Exception> errors = new HashMap<>();
+    final Set<String> collections = reader.getClusterState().getCollectionsMap().keySet();
+    collections.parallelStream().forEach(collection -> {
       try {
         CollectionAdminRequest.deleteCollection(collection).process(solrClient);
       } catch (BaseHttpSolrClient.RemoteSolrException e) {
         if (!e.getMessage().contains("Could not find")) {
-          throw e;
+          errors.put(collection, e);
         }
+      } catch (Exception e) {
+        errors.put(collection, e);
       }
+    });
+
+    if (!errors.isEmpty()) {
+      errors.forEach((k,v) -> {
+        log.error("Failed to delete collection {}", k, v);
+      });
+      throw errors.values().iterator().next();
     }
 
     // TODO timeouts
 
-    for (String collection : reader.getClusterState().getCollectionStates().keySet()) {
-      reader.waitForState(collection, 10, TimeUnit.SECONDS,
-              (collectionState) -> collectionState == null ? true : false);
+    for (String collection : collections) {
+      try {
+        reader.waitForState(collection, 10, TimeUnit.SECONDS, Objects::isNull);
+      } catch (TimeoutException timeoutException) {
+        log.error("Wait to see collection {} deleted in client state timed out!", collection, timeoutException);
+        throw timeoutException;
+      }
     }
 
     // may be deleted, but may not be gone yet - we only wait to not see it in ZK, not for core unloads