gus-asf commented on code in PR #864: URL: https://github.com/apache/solr/pull/864#discussion_r874295318
########## solr/core/src/java/org/apache/solr/core/CoreContainer.java: ########## @@ -2299,6 +2300,25 @@ public long getStatus() { return status; } + /** + * Retrieve the aliases from zookeeper. This is typically cached and does not hit zookeeper after + * the first use. + * + * @return an immutable instance of {@code Aliases} accurate as of at the time this method is + * invoked, less any zookeeper update lag. + * @throws RuntimeException if invoked on a {@code CoreContainer} where {@link + * #isZooKeeperAware()} returns false + */ + public Aliases getAliases() { + if (isZooKeeperAware()) { + return getZkController().getZkStateReader().getAliases(); + } else { + // fail fast because it's programmer error, but give slightly more info than NPE. + throw new IllegalStateException( Review Comment: When I was looking at this I felt that returning empty was likely to hide lurking misuse, and documenting this also makes things clearer for someone learning the code base. Both the javadoc and the code now make it clear that this is something only germane to cloud usage, whereas before one had to be familiar enough to realize that "isZookeeperAware()" is solr-code-speak for "isThisCloudAndNotUserManagedStandaloneOrWhateverWeCallItNow()" ;) Also, hopefully they can also now know that it's a safe/cheap thing to call and doesn't pound on zookeeper without reading much more complicated code. Anyway that's what I was thinking. I could possibly be convinced to not backport this aspect to 8.11.2 however since in theory it might expose any existing bad code in a harmful way. -- 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