HoustonPutman commented on a change in pull request #1861: URL: https://github.com/apache/lucene-solr/pull/1861#discussion_r489447516
########## File path: solr/core/src/java/org/apache/solr/handler/admin/ConfigSetsHandler.java ########## @@ -170,21 +176,90 @@ private void handleConfigUploadRequest(SolrQueryRequest req, SolrQueryResponse r // Create a node for the configuration in zookeeper boolean trusted = getTrusted(req); - zkClient.makePath(configPathInZk, ("{\"trusted\": " + Boolean.toString(trusted) + "}"). - getBytes(StandardCharsets.UTF_8), true); + Set<String> filesToDelete = Collections.emptySet(); + if (overwritesExisting) { + if (!trusted) { + ensureOverwritingUntrustedConfigSet(zkClient, configPathInZk); + } + if (req.getParams().getBool(ConfigSetParams.CLEANUP, false)) { + filesToDelete = getAllConfigsetFiles(zkClient, configPathInZk); + } + } else { + zkClient.makePath(configPathInZk, ("{\"trusted\": " + Boolean.toString(trusted) + "}"). + getBytes(StandardCharsets.UTF_8), true); + } ZipInputStream zis = new ZipInputStream(inputStream, StandardCharsets.UTF_8); ZipEntry zipEntry = null; while ((zipEntry = zis.getNextEntry()) != null) { String filePathInZk = configPathInZk + "/" + zipEntry.getName(); + if (filePathInZk.endsWith("/")) { + filesToDelete.remove(filePathInZk.substring(0, filePathInZk.length() -1)); + } else { + filesToDelete.remove(filePathInZk); + } if (zipEntry.isDirectory()) { - zkClient.makePath(filePathInZk, true); + zkClient.makePath(filePathInZk, false, true); Review comment: Not very likely, was just thinking about possibilities. It's probably not an issue 99.9% of times, so it likely doesn't need to be addressed. ---------------------------------------------------------------- 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