eribeiro commented on a change in pull request #1083: SOLR-13662: Fixes to
package manager
URL: https://github.com/apache/lucene-solr/pull/1083#discussion_r357944394
##########
File path:
solr/core/src/java/org/apache/solr/packagemanager/PackageManager.java
##########
@@ -121,25 +121,44 @@ public void close() throws IOException {
Map<String, SolrPackageInstance> ret = new HashMap<String,
SolrPackageInstance>();
for (String packageName: packages.keySet()) {
if (Strings.isNullOrEmpty(packageName) == false) { // There can be an
empty key, storing the version here
+ if (packages.get(packageName) == null) { // This means the package was
undeployed from this package before
+ continue;
+ }
ret.put(packageName, getPackageInstance(packageName,
packages.get(packageName)));
}
}
return ret;
}
+ private void ensureCollectionsExist(List<String> collections) {
+ try {
+ List<String> existingCollections = zkClient.getChildren("/collections",
null, true);
+ for (String c: collections) {
Review comment:
```
List<String> unexistent = collections.stream().filter( c ->
existingCollections.contains(c) == false ).collect(Collectors.toList());
if (unexistent.isEmpty() == false) {
throw new SolrException(ErrorCode.BAD_REQUEST, "Collection(s) doesn't
exist: " + unexistent.toString());
}
```
Or yet
```
List<String> unexistent = new HashSet<>(collections); // could be a ArrayList
unexistent.removeAll(existingCollections);
if (unexistent.isEmpty() == false) {
throw new SolrException(ErrorCode.BAD_REQUEST, "Collection(s) doesn't
exist: " + unexistent.toString());
}
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]