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