diff --git a/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java b/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java index 9e876c43df6..7de69b87f42 100644 --- a/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java +++ b/solr/core/src/test/org/apache/solr/cloud/CloudStateUpdateTest.java @@ -243,9 +243,8 @@ public class CloudStateUpdateTest extends SolrTestCaseJ4 { } container1.shutdown(); container2.shutdown(); - if (!container3.isShutDown()) { - container3.shutdown(); - } + container3.shutdown(); + zkServer.shutdown(); super.tearDown(); System.clearProperty("zkClientTimeout"); diff --git a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java index f7746124bfb..314c571f81b 100644 --- a/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java +++ b/solr/solrj/src/java/org/apache/solr/common/cloud/SolrZkClient.java @@ -491,6 +491,15 @@ public class SolrZkClient { keeper.create(currentPath, bytes, ZooDefs.Ids.OPEN_ACL_UNSAFE, mode); } } catch (NodeExistsException e) { + + if (!failOnExists) { + // TODO: version ? for now, don't worry about race + setData(currentPath, data, -1, retryOnConnLoss); + // set new watch + exists(currentPath, watcher, retryOnConnLoss); + return; + } + // ignore unless it's the last node in the path if (i == paths.length - 1) { throw e; @@ -643,6 +652,7 @@ public class SolrZkClient { * @throws InterruptedException */ public void close() throws InterruptedException { + if (isClosed) return; // it's okay if we over close - same as solrcore isClosed = true; keeper.close(); numCloses.incrementAndGet();