You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/09/01 16:43:33 UTC

[GitHub] [lucene-solr] thelabdude commented on a change in pull request #1684: SOLR-14613: strongly typed placement plugin interface and implementation

thelabdude commented on a change in pull request #1684:
URL: https://github.com/apache/lucene-solr/pull/1684#discussion_r481286449



##########
File path: solr/core/src/java/org/apache/solr/cluster/placement/Cluster.java
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.solr.cluster.placement;
+
+import java.io.IOException;
+import java.util.Optional;
+import java.util.Set;
+
+/**
+ * <p>A representation of the (initial) cluster state, providing information on which nodes are part of the cluster and a way
+ * to get to more detailed info.
+ *
+ * <p>This instance can also be used as a {@link PropertyValueSource} if {@link PropertyKey}'s need to be specified with
+ * a global cluster target.
+ */
+public interface Cluster extends PropertyValueSource {
+  /**
+   * @return current set of live nodes. Never <code>null</code>, never empty (Solr wouldn't call the plugin if empty
+   * since no useful could then be done).
+   */
+  Set<Node> getLiveNodes();
+
+  /**
+   * <p>Returns info about the given collection if one exists. Because it is not expected for plugins to request info about
+   * a large number of collections, requests can only be made one by one.
+   *
+   * <p>This is also the reason we do not return a {@link java.util.Map} or {@link Set} of {@link SolrCollection}'s here: it would be
+   * wasteful to fetch all data and fill such a map when plugin code likely needs info about at most one or two collections.
+   */
+  Optional<SolrCollection> getCollection(String collectionName) throws IOException;

Review comment:
       You can use system property rules for ensuring replicas for one collection don't get placed on nodes hosting another collection vs. the new framework trying to compute this by looking at all the nodes hosting a specific collection (which can change anyway). Here's an example using the current framework: 
   https://github.com/lucidworks/fusion-cloud-native/blob/master/policy.json#L19
   
   This approach is also simple to reason about and is in-use in a number of production environments. Any ops person will be comfortable with setting JVM props or ENV vars to indicate unique Solr node properties that they want to use for placement decisions.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org