madrob commented on code in PR #864:
URL: https://github.com/apache/solr/pull/864#discussion_r874282086


##########
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:
   This is odd to me that we go from default behavior of returning empty to 
throwing exceptions. Can you help me follow the motivations?



##########
solr/core/src/java/org/apache/solr/cloud/api/collections/CreateAliasCmd.java:
##########
@@ -140,15 +145,21 @@ private void callCreateRoutedAlias(
                   Sets.difference(routedAlias.getRequiredParams(), 
props.keySet()), ','));
     }
 
-    // Create the first collection.
-    String initialColl = routedAlias.computeInitialCollectionName();
-    ensureAliasCollection(
-        aliasName, zkStateReader, state, routedAlias.getAliasMetadata(), 
initialColl);
+    Aliases aliases = zkStateReader.aliasesManager.getAliases();
+
+    List<String> collectionList = aliases.resolveAliases(aliasName);
+    String collectionListStr = String.join(",", collectionList);

Review Comment:
   If you put this inside of an else then we don't need to spend cycles in it 
when it gets overwritten, and we can also drop finslCollectionListStr



-- 
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

Reply via email to