tflobbe commented on a change in pull request #1861: URL: https://github.com/apache/lucene-solr/pull/1861#discussion_r492423507
########## 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: Yes, I don't think this would be needed at this point. No API would set this, and no Solr component would read it. I guess the only case would be a custom component that writes and reads directly to ZooKeeper. ---------------------------------------------------------------- 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