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/08 22:10:08 UTC

[lucene-solr] branch reference_impl_dev updated: @958 Test issues.

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


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 558629a  @958 Test issues.
558629a is described below

commit 558629a3d7ed2a111a4b0a9b71002b39515875bd
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Thu Oct 8 17:09:07 2020 -0500

    @958 Test issues.
---
 solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java         | 6 +++++-
 .../org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java | 7 +++++++
 .../cloud/api/collections/CollectionsAPIDistClusterPerZkTest.java  | 6 ++++--
 3 files changed, 16 insertions(+), 3 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 8d12bd7..824eb3f 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ZkShardTerms.java
@@ -315,6 +315,10 @@ public class ZkShardTerms implements AutoCloseable{
       log.info("Successful update of terms at {} to {}", znodePath, newTerms);
       return true;
     } catch (KeeperException.BadVersionException e) {
+      if (isClosed.get()) {
+        return false;
+      }
+
       log.info("Failed to save terms, version is not a match, retrying");
       // TODO: wait till next version shows up
     } catch (KeeperException.NoNodeException e) {
@@ -380,7 +384,7 @@ public class ZkShardTerms implements AutoCloseable{
     boolean isChanged = false;
     for (;;)  {
       ShardTerms terms = this.terms.get();
-      if (terms == null || newTerms.getVersion() > terms.getVersion())  {
+      if (terms == null || newTerms.getVersion() != terms.getVersion())  {
         if (this.terms.compareAndSet(terms, newTerms))  {
           isChanged = true;
           break;
diff --git a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
index 2482e12..8185b1c 100644
--- a/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
+++ b/solr/core/src/java/org/apache/solr/cloud/api/collections/DeleteCollectionCmd.java
@@ -163,6 +163,13 @@ public class DeleteCollectionCmd implements OverseerCollectionMessageHandler.Cmd
         log.error("Exception while removing collection", e);
       }
 
+      // make sure it's gone again after cores have been removed
+      try {
+        zkStateReader.getZkClient().clean(ZkStateReader.COLLECTIONS_ZKNODE + "/" + collection);
+      } catch (Exception e) {
+        log.error("Exception while trying to remove collection zknode", e);
+      }
+
       // we can delete any remaining unique aliases
       if (!aliasReferences.isEmpty()) {
         ocmh.zkStateReader.aliasesManager.applyModificationAndExportToZk(a -> {
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 b0d8ae2..c429fd0 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
@@ -89,6 +89,7 @@ public class CollectionsAPIDistClusterPerZkTest extends SolrCloudTestCase {
 
   @BeforeClass
   public static void setupCluster() throws Exception {
+    useFactory(null);
     // we don't want this test to have zk timeouts
     System.setProperty("zkClientTimeout", "60000");
     if (TEST_NIGHTLY) {
@@ -358,8 +359,9 @@ public class CollectionsAPIDistClusterPerZkTest extends SolrCloudTestCase {
       assertTrue("Could not find expected core.properties file", Files.exists(instancedir.resolve("core.properties")));
 
       Path expected = Paths.get(jetty.getSolrHome()).toAbsolutePath().resolve(core.getName());
-
-      assertTrue("Expected: " + expected + "\nFrom core stats: " + instancedir, Files.isSameFile(expected, instancedir));
+      if (Files.exists(expected) && Files.exists(instancedir)) {
+        assertTrue("Expected: " + expected + "\nFrom core stats: " + instancedir, Files.isSameFile(expected, instancedir));
+      }
     }
   }