[GitHub] [lucene-solr] madrob commented on a change in pull request #1759: SOLR-13438: on collection delete, also delete .AUTOCREATED config set

2020-08-21 Thread GitBox


madrob commented on a change in pull request #1759:
URL: https://github.com/apache/lucene-solr/pull/1759#discussion_r474835389



##
File path: 
solr/core/src/test/org/apache/solr/cloud/api/collections/SimpleCollectionCreateDeleteTest.java
##
@@ -32,69 +28,151 @@
 import org.apache.solr.util.TimeOut;
 import org.junit.Test;
 
+import java.util.Collection;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
 public class SimpleCollectionCreateDeleteTest extends 
AbstractFullDistribZkTestBase {
 
-  public SimpleCollectionCreateDeleteTest() {
-sliceCount = 1;
-  }
-
-  @Test
-  @ShardsFixed(num = 1)
-  public void test() throws Exception {
-String overseerNode = 
OverseerCollectionConfigSetProcessor.getLeaderNode(cloudClient.getZkStateReader().getZkClient());
-String notOverseerNode = null;
-for (CloudJettyRunner cloudJetty : cloudJettys) {
-  if (!overseerNode.equals(cloudJetty.nodeName)) {
-notOverseerNode = cloudJetty.nodeName;
-break;
-  }
+public SimpleCollectionCreateDeleteTest() {
+sliceCount = 1;
 }
-String collectionName = "SimpleCollectionCreateDeleteTest";
-CollectionAdminRequest.Create create = 
CollectionAdminRequest.createCollection(collectionName,1,1)
-.setCreateNodeSet(overseerNode);
-
-NamedList request = create.process(cloudClient).getResponse();
-
-if (request.get("success") != null) {
-  
assertTrue(cloudClient.getZkStateReader().getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE
 + "/" + collectionName, false));
-
-  @SuppressWarnings({"rawtypes"})
-  CollectionAdminRequest delete = 
CollectionAdminRequest.deleteCollection(collectionName);
-  cloudClient.request(delete);
-
-  
assertFalse(cloudClient.getZkStateReader().getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE
 + "/" + collectionName, false));
-  
-  // currently, removing a collection does not wait for cores to be 
unloaded
-  TimeOut timeout = new TimeOut(30, TimeUnit.SECONDS, 
TimeSource.NANO_TIME);
-  while (true) {
-
-if( timeout.hasTimedOut() ) {
-  throw new TimeoutException("Timed out waiting for all collections to 
be fully removed.");
+
+@Test
+@ShardsFixed(num = 1)
+public void testCreateAndDeleteThenCreateAgain() throws Exception {

Review comment:
   👍 





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene-solr] madrob commented on a change in pull request #1759: SOLR-13438: on collection delete, also delete .AUTOCREATED config set

2020-08-19 Thread GitBox


madrob commented on a change in pull request #1759:
URL: https://github.com/apache/lucene-solr/pull/1759#discussion_r473340424



##
File path: solr/CHANGES.txt
##
@@ -42,6 +42,8 @@ Improvements
 
 * SOLR-13528 Rate Limiting in Solr (Atri Sharma, Mike Drob)
 
+* SOLR-13438: On deleting a collection, its config set will also be deleted 
iff it has been auto-created, and not used by any other collection.

Review comment:
   Please include your preferred name here after the change summary so that 
we can properly credit you!

##
File path: 
solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionDeleteAlsoDeletesAutocreatedConfigSetTest.java
##
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.cloud.api.collections;
+
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
+import org.apache.solr.cloud.OverseerCollectionConfigSetProcessor;
+import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.NamedList;
+import org.junit.Test;
+
+public class CollectionDeleteAlsoDeletesAutocreatedConfigSetTest extends 
AbstractFullDistribZkTestBase {

Review comment:
   Instead of new file, can this be part of 
`SimpleCollectionCreateDeleteTest`?

##
File path: 
solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionDeleteAlsoDeletesAutocreatedConfigSetTest.java
##
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.cloud.api.collections;
+
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
+import org.apache.solr.cloud.OverseerCollectionConfigSetProcessor;
+import org.apache.solr.common.cloud.ZkStateReader;
+import org.apache.solr.common.util.NamedList;
+import org.junit.Test;
+
+public class CollectionDeleteAlsoDeletesAutocreatedConfigSetTest extends 
AbstractFullDistribZkTestBase {
+
+  public CollectionDeleteAlsoDeletesAutocreatedConfigSetTest() {
+sliceCount = 1;
+  }
+
+  @Test
+  @ShardsFixed(num = 1)
+  public void test() throws Exception {
+String overseerNode = 
OverseerCollectionConfigSetProcessor.getLeaderNode(cloudClient.getZkStateReader().getZkClient());
+
+String collectionName = 
"CollectionDeleteAlsoDeletesAutocreatedConfigSetTest";
+CollectionAdminRequest.Create create = 
CollectionAdminRequest.createCollection(collectionName,1,1)
+.setCreateNodeSet(overseerNode);
+
+NamedList request = create.process(cloudClient).getResponse();
+
+if (request.get("success") != null) {
+  // collection exists now
+  
assertTrue(cloudClient.getZkStateReader().getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE
 + "/" + collectionName, false));
+
+  String configName = 
cloudClient.getZkStateReader().readConfigName(collectionName);
+
+  // config for this collection is '.AUTOCREATED', and exists globally
+  assertTrue(configName.endsWith(".AUTOCREATED"));
+  
assertTrue(cloudClient.getZkStateReader().getConfigManager().listConfigs().contains(configName));
+
+  @SuppressWarnings({"rawtypes"})

Review comment:
   Please avoid suppressing warnings in new code and use generics

##
File path: 
solr/core/src/test/org/apache/solr/cloud/api/collections/CollectionDeleteAlsoDeletesAutocreatedConfigSetTest.java