HoustonPutman commented on a change in pull request #414: URL: https://github.com/apache/solr/pull/414#discussion_r750484513
########## File path: solr/core/src/java/org/apache/solr/cloud/api/collections/Assign.java ########## @@ -356,6 +356,26 @@ public int weight() { return createNodeList; // unmodified, but return for inline use } + // throw an exception if all nodes in the supplied list are not live. + // Empty list will also fail. + // Returns the input + private static List<String> checkAnyLiveNodes(List<String> createNodeList, ClusterState clusterState) { + Set<String> liveNodes = clusterState.getLiveNodes(); + if (createNodeList == null) { + createNodeList = Collections.emptyList(); + } + boolean anyLiveNodes = false; + for (String node : createNodeList) { + anyLiveNodes |= liveNodes.contains(node); + } + if (!anyLiveNodes) { + throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, + "None of the node(s) specified " + createNodeList + " are not currently active in " + + createNodeList + ", no action taken."); + } + return createNodeList; // unmodified, but return for inline use. Only modified if empty, and that will throw an error Review comment: It's used down below to replace the assert. -- 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. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org