epugh commented on code in PR #4320:
URL: https://github.com/apache/solr/pull/4320#discussion_r3176994369
##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/RandomStream.java:
##########
@@ -56,9 +57,8 @@
*/
public class RandomStream extends TupleStream implements Expressible {
- private String solrCloud;
- // TODO: replace all Map<String, String> in stream handlers by
ModifiableSolrParams ?
Review Comment:
nice clean up!
##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/DeepRandomStream.java:
##########
@@ -170,8 +171,8 @@ public StreamExpression toExpression(StreamFactory factory)
throws IOException {
}
}
- // solrCloud
- expression.addParameter(new StreamExpressionNamedParameter("solrCloud",
solrCloud));
Review Comment:
So we don't expose `solrCloud` as a property in our streaming expressions?
Checking
https://solr.apache.org/guide/solr/latest/query-guide/stream-source-reference.html#search-parameters
it looks just fine!
##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java:
##########
@@ -76,36 +76,35 @@ public void setDefaultZKHost(String zkHost) {
}
}
- public synchronized CloudSolrClient getCloudSolrClient(String
connectionString) {
+ public synchronized CloudSolrClient getCloudSolrClient(
+ CloudSolrClient.CloudSolrClientConnection solrConnection) {
ensureOpen();
- Objects.requireNonNull(connectionString, "Connection string cannot be
null!");
- if (solrClients.containsKey(connectionString)) {
- return (CloudSolrClient) solrClients.get(connectionString);
+ Objects.requireNonNull(solrConnection, "'solrConnection' cannot be null!");
+ String cacheKey = solrConnection.toString();
+ if (solrClients.containsKey(cacheKey)) {
+ return (CloudSolrClient) solrClients.get(cacheKey);
}
// Can only use ZK ACLs if there is a default ZK Host, and the given ZK
host contains that
// default.
// Basically the ZK ACLs are assumed to be only used for the default ZK
host,
// thus we should only provide the ACLs to that Zookeeper instance.
boolean canUseACLs = false;
- var cloudClientConnection =
CloudSolrClient.CloudSolrClientConnection.parse(connectionString);
- if (cloudClientConnection.isZk()) {
- String chroot = cloudClientConnection.zkChroot();
- String zkHostNoChroot =
- chroot != null && connectionString.endsWith(chroot)
- ? connectionString.substring(0, connectionString.length() -
chroot.length())
- : connectionString;
+ if (solrConnection.isZk()) {
Review Comment:
I don't know that I love the short cut `isZK` versus `isZooKeeper` (or
however we case it? my just be my style.
##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/SolrClientCache.java:
##########
@@ -76,36 +76,35 @@ public void setDefaultZKHost(String zkHost) {
}
}
- public synchronized CloudSolrClient getCloudSolrClient(String
connectionString) {
+ public synchronized CloudSolrClient getCloudSolrClient(
+ CloudSolrClient.CloudSolrClientConnection solrConnection) {
ensureOpen();
- Objects.requireNonNull(connectionString, "Connection string cannot be
null!");
- if (solrClients.containsKey(connectionString)) {
- return (CloudSolrClient) solrClients.get(connectionString);
+ Objects.requireNonNull(solrConnection, "'solrConnection' cannot be null!");
+ String cacheKey = solrConnection.toString();
+ if (solrClients.containsKey(cacheKey)) {
+ return (CloudSolrClient) solrClients.get(cacheKey);
}
// Can only use ZK ACLs if there is a default ZK Host, and the given ZK
host contains that
// default.
// Basically the ZK ACLs are assumed to be only used for the default ZK
host,
// thus we should only provide the ACLs to that Zookeeper instance.
boolean canUseACLs = false;
- var cloudClientConnection =
CloudSolrClient.CloudSolrClientConnection.parse(connectionString);
- if (cloudClientConnection.isZk()) {
- String chroot = cloudClientConnection.zkChroot();
- String zkHostNoChroot =
- chroot != null && connectionString.endsWith(chroot)
- ? connectionString.substring(0, connectionString.length() -
chroot.length())
- : connectionString;
+ if (solrConnection.isZk()) {
Review Comment:
I guess it's fine.. it reads pretty easy.
--
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]