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/07/26 19:15:10 UTC

[GitHub] [lucene-solr] gus-asf commented on a change in pull request #1694: SOLR-14680: Provide simple interfaces to our concrete SolrCloud classes

gus-asf commented on a change in pull request #1694:
URL: https://github.com/apache/lucene-solr/pull/1694#discussion_r460560248



##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/sdk/SolrCluster.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.common.cloud.sdk;
+
+import org.apache.solr.common.util.SimpleMap;
+
+/**
+ * Represents a Solr cluster
+ */
+public interface SolrCluster {
+  /** collections in the cluster */
+  SimpleMap<SolrCollection> collections();

Review comment:
       Also aliases... and the Alias class returned should list the collections provided and routing info if routed. (also law of Demeter etc...)

##########
File path: solr/solrj/src/java/org/apache/solr/common/util/LinkedSimpleHashMap.java
##########
@@ -0,0 +1,27 @@
+/*
+ * 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.common.util;
+
+import java.util.LinkedHashMap;
+
+public class LinkedSimpleHashMap<T> extends LinkedHashMap<CharSequence, T>  implements SimpleMap<T> {

Review comment:
       this class appears unused...

##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/sdk/SolrNode.java
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.common.cloud.sdk;
+
+import org.apache.solr.common.util.SimpleMap;
+
+/**
+ * A read only view of a Solr node
+ */
+public interface SolrNode {
+
+  /** The node name */
+  String name();
+
+  String baseUrl(boolean isV2);
+
+  SimpleMap<ShardReplica> cores();

Review comment:
       Possibly good to also answer the question of "what collections are participating in this node" and what shards of Collection X are on this node.

##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/sdk/SolrCollection.java
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.common.cloud.sdk;
+
+import org.apache.solr.common.util.SimpleMap;
+
+/** Represents a collection in Solr */
+public interface SolrCollection {

Review comment:
       Also I've definitely had cases where I wanted a list of nodes where this collection is hosted.

##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/sdk/SolrCluster.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.common.cloud.sdk;
+
+import org.apache.solr.common.util.SimpleMap;
+
+/**
+ * Represents a Solr cluster
+ */
+public interface SolrCluster {

Review comment:
       Since we have our own package namespace, prepending solr isn't really needed unless we think we might also model non-solr clusters.

##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/ClusterState.java
##########
@@ -38,7 +43,7 @@
  * {@link ZkStateReader#getClusterState()}.
  * @lucene.experimental
  */
-public class ClusterState implements JSONWriter.Writable {
+public class ClusterState implements JSONWriter.Writable , SolrCluster {

Review comment:
       Little worried that this design allows for casting of the SolrCluster reference... 

##########
File path: solr/solrj/src/java/org/apache/solr/common/cloud/sdk/SolrCluster.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.common.cloud.sdk;
+
+import org.apache.solr.common.util.SimpleMap;
+
+/**
+ * Represents a Solr cluster
+ */
+public interface SolrCluster {
+  /** collections in the cluster */
+  SimpleMap<SolrCollection> collections();
+
+  /** nodes in the cluster */
+  SimpleMap<SolrNode> nodes();
+
+  /** Get a {@link SolrNode} by name. returns null if no such node exists */
+  SolrNode getNode(String node);
+
+  /**
+   * Name of the node in which the overseer is running
+   */
+  String overseerNode();
+
+  /**
+   * The name of the node in which this method is invoked from. returns null, if this is not invoked from a
+   * Solr node
+   */
+  String thisNode();
+

Review comment:
       I've wondered sometimes if clusters should have name or id of some sort but that's probably another topic.




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