dsmiley commented on code in PR #2126:
URL: https://github.com/apache/solr/pull/2126#discussion_r1448196037


##########
solr/core/src/java/org/apache/solr/api/ClusterPluginsSourceConfigurator.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.api;
+
+import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.NodeConfig;
+import org.apache.solr.core.SolrResourceLoader;
+import org.apache.solr.util.plugin.NamedListInitializedPlugin;
+
+/**
+ * Loads the {@link ClusterPluginsSource} depending on the declared 
implementation. The default
+ * implementation is {@link ZkClusterPluginsSource}, but can be overridden by 
a system property, or
+ * by declaring the implementation class in solr.xml
+ */
+public class ClusterPluginsSourceConfigurator implements 
NamedListInitializedPlugin {

Review Comment:
   Extending NamedListInitializedPlugin means we have an init() method.  But 
what becomes of those args?



##########
solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java:
##########
@@ -651,6 +651,27 @@ private static PluginInfo[] 
getBackupRepositoryPluginInfos(List<ConfigNode> cfg)
     return configs;
   }
 
+  private static PluginInfo[] getClusterPlugins(SolrResourceLoader loader, 
ConfigNode root) {
+    List<PluginInfo> clusterPlugins = new ArrayList<>();
+
+    Collections.addAll(
+        clusterPlugins, getClusterSingletonPluginInfos(loader, 
root.getAll("clusterSingleton")));
+
+    PluginInfo replicaPlacementFactory = 
getPluginInfo(root.get("replicaPlacementFactory"));
+    if (replicaPlacementFactory != null) {
+      if (replicaPlacementFactory.name != null
+          && 
!replicaPlacementFactory.name.equals(PlacementPluginFactory.PLUGIN_NAME)) {
+        throw new SolrException(
+            SolrException.ErrorCode.SERVER_ERROR,
+            "The replicaPlacementFactory name attribute must be "
+                + PlacementPluginFactory.PLUGIN_NAME);
+      }
+      clusterPlugins.add(replicaPlacementFactory);
+    }
+
+    return clusterPlugins.toArray(new PluginInfo[0]);

Review Comment:
   Is there a reason why we use native arrays instead of simply keeping a List? 
 I think I'd prefer a List.



##########
solr/core/src/java/org/apache/solr/api/ClusterPluginsSource.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.api;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.solr.client.solrj.request.beans.PluginMeta;
+import org.apache.solr.handler.admin.ContainerPluginsApi;
+
+/** A source for Container Plugin configurations */

Review Comment:
   and more edits are needed in this file



##########
solr/core/src/java/org/apache/solr/core/SolrXmlConfig.java:
##########
@@ -159,16 +160,15 @@ public static NodeConfig fromConfig(
     configBuilder.setSolrResourceLoader(loader);
     configBuilder.setUpdateShardHandlerConfig(updateConfig);
     
configBuilder.setShardHandlerFactoryConfig(getPluginInfo(root.get("shardHandlerFactory")));
-    configBuilder.setReplicaPlacementFactoryConfig(
-        getPluginInfo(root.get("replicaPlacementFactory")));
+    // configBuilder.setReplicaPlacementFactoryConfig(

Review Comment:
   a "nocommit" I suppose.  BTW that's a magic keyword used by the Lucene & 
Solr projects that will show up in WIP that is not intended to be 
committed/merged.



##########
solr/CHANGES.txt:
##########
@@ -20,6 +20,8 @@ Improvements
 
 * SOLR-16536: Replace OpenTracing instrumentation with OpenTelemetry (Alex 
Deparvu, janhoy)
 
+* SOLR-17096: Support for Cluster Singleton plugins with immutable deployments 
(Paul McArthur)

Review Comment:
   Express this how a user will understand.  Like `solr.xml now supports 
<clusterSingleton>`. And reference myself secondarily as well please. 
(reviewers often are listed too if non-trivial involvement)



##########
solr/core/src/java/org/apache/solr/api/ClusterPluginsSource.java:
##########
@@ -0,0 +1,59 @@
+/*
+ * 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.api;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.function.Function;
+import org.apache.solr.client.solrj.request.beans.PluginMeta;
+import org.apache.solr.handler.admin.ContainerPluginsApi;
+
+/** A source for Container Plugin configurations */

Review Comment:
   ```suggestion
   /** A source for Cluster Plugin configurations */
   ```
   (since this is our current naming approach)



##########
solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java:
##########
@@ -104,9 +105,6 @@
 public class SolrConfigHandler extends RequestHandlerBase
     implements SolrCoreAware, PermissionNameProvider {
   private static final Logger log = 
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  public static final String CONFIGSET_EDITING_DISABLED_ARG = 
"disable.configEdit";

Review Comment:
   Sorry for the back & forth here... I had thought let's use 
`disable.configEdit` but I don't want to shine a light (document) a badly named 
config, especially at a time when a config naming standardization effort is 
underway.
   
   Absent further feedback, I think we should use a **new** property, like 
`solr.cluster.plugin.mutable` using `EnvUtils`.  It's scoped to just the 
`/cluster/plugin` API and thus doesn't have a debatable scope (too broad, like 
all config editing, which should get more agreement/care).  Such a narrow scope 
also suggests moving the setting to ContainerPluginsRegistry or 
ZkClusterPluginsSource.



##########
solr/core/src/java/org/apache/solr/api/NodeConfigClusterPluginsSource.java:
##########
@@ -70,13 +71,14 @@ public void persistPlugins(Function<Map<String, Object>, 
Map<String, Object>> mo
 
   private static Map<String, Object> readPlugins(final NodeConfig cfg) {
     Map<String, Object> pluginInfos = new HashMap<>();
-    PluginInfo[] clusterSingletons = cfg.getClusterSingletonPlugins();
+    PluginInfo[] clusterSingletons = cfg.getClusterPlugins();
     if (clusterSingletons != null) {
       Arrays.stream(clusterSingletons)
           .forEach(

Review Comment:
   Streams can be cool when their power can be leveraged, but if you're simply 
going to iterate, than really, `for(p : clusterSingletons)` is best



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