Copilot commented on code in PR #5347:
URL: https://github.com/apache/solr/pull/5347#discussion_r4575011569


##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -557,8 +558,8 @@ public void runImpl(CommandLine cli) throws Exception {
   }
 
   /**
-   * Rejects ports outside the range bin/solr's embedded ZooKeeper (port + 
1000) can support, for
-   * every example type.
+   * Rejects ports outside the range bin/solr's embedded ZooKeeper (port + 
1000, unless {@link
+   * SolrZkServer#EMBEDDED_ZK_PORT_PROPERTY} is set) can support, for every 
example type.

Review Comment:
   Explicitly configuring the ZooKeeper port still does not allow Solr ports 
above 64535: validatePort() unconditionally rejects them, and both 
bin/solr:1129 and bin/solr.cmd:977 retain the same derived-port restriction. 
For example, Solr port 65000 with SOLR_ZOOKEEPER_EMBEDDED_PORT=2181 is a valid 
port pair but cannot start. Make these checks account for an explicit ZooKeeper 
port, retaining the 64535 limit only when deriving the port.



##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -1581,6 +1584,12 @@ Map<String, Object> startSolr(
     if (zkHost != null) {
       command.add("-z");
       command.add(zkHost);
+    } else if (cloudMode) {
+      // this node starts the embedded ZooKeeper, so pass on an explicitly 
configured port
+      Integer embeddedZkPort = SolrZkServer.getConfiguredClientPort();

Review Comment:
   Validating the property in the parent changes the documented precedence for 
examples. With clientPort=2181 in the node's zoo.cfg and 
solr.zookeeper.embedded.port=not-a-port, SolrZkServer.parseConfig() correctly 
ignores the overridden property, but this call aborts the example before the 
server starts. Forward the raw property and let the child validate it only if 
zoo.cfg does not supply clientPort.



##########
solr/core/src/java/org/apache/solr/cli/RunExampleTool.java:
##########
@@ -668,9 +669,11 @@ void runSecureExample(CloudExampleParams params, boolean 
userManaged) throws Exc
             + serverDir.getParent().toAbsolutePath().normalize());
     Path tls = home.resolve("tls");
     Path include = tls.resolve("solr.in.sh");
-    String zkHost = "localhost:" + (port + 1000);
+    int zkPort = SolrZkServer.resolveClientPort(port);
+    String zkHost = "localhost:" + zkPort;

Review Comment:
   With `clientPort=2181` in the copied `zoo.cfg` and the new property set to 
`3456`, the secure example sends node 2 and ZooKeeper commands to the wrong 
port. An invalid property also aborts the example even though `clientPort` 
should override it. Honor the effective `zoo.cfg` before resolving the 
property, or discover node 1's runtime endpoint before starting node 2.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to