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<Object> 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
##########
@@ -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);

Review comment:
       Do we need this call to `setCreateNodeSet`? If not, can also delete 
getting overseerNode above. If so, add a comment explaining why.

##########
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<Object> 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"})
+      CollectionAdminRequest delete = 
CollectionAdminRequest.deleteCollection(collectionName);

Review comment:
       Declare as `CollectionAdminRequest.Delete`

##########
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 {

Review comment:
       Please add another test where we have two collections sharing the same 
autogenerated configset, and verify deleting one of them doesn't orphan the 
other.




----------------------------------------------------------------
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

Reply via email to