Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
As per a question from the mail list:
... use of the PutSolrContentStream processor had broken. Looking through the processor code there was an upgrade to the SolrJ client and a commit in March 2020 (and referenced below) that appears to prevent nested zk chroot paths for SolrCloud connections (i.e. the zookeeper connection string is truncated).
SolrUtils.java (nifi/SolrUtils.java at master · apache/nifi · GitHub)
The commit of intrest regarding the new process for initiating a CloudSolrClient in SolrJ
For a nested Solr path "/solr/PROD", "/solr/DEV", "/solr/DR" … the string is truncated to the base path only i.e. “/solr” (this is only an issue for nested chroots)
The code of interest is here in the SolrUtils.java class:
if (SOLR_TYPE_STANDARD.getValue().equals(context.getProperty(SOLR_TYPE).getValue())) { return new HttpSolrClient(solrLocation, httpClient); return new HttpSolrClient.Builder(solrLocation).withHttpClient(httpClient).build(); } else { // CloudSolrClient.Builder now requires a List of ZK addresses and znode for solr as separate parameters final String zk[] = solrLocation.split("/"); final List zkList = Arrays.asList(zk[0].split(",")); String zkRoot = "/"; if (zk.length > 1 && ! zk[1].isEmpty()) { zkRoot += zk[1]; }
I think the issue can be resolved by changing this line of code which should capture the entire nested path and not just the base path at position zk[1] in the String array.
final String zk[] = solrLocation.split("/");To
final String[] zk = solrLocation.split("/",2)
This page documents the ability for connection strings to include a 'chroot suffix' which executes commands relative to the ZK database path specified:
https://zookeeper.apache.org/doc/r3.6.1/apidocs/zookeeper-server/org/apache/zookeeper/ZooKeeper.html
Ensure that NiFi can use the suffix correctly, in particular for Solr processors. The SolrUtils.java:284 class ignores the possibility of this suffix so will need to be fixed.
Attachments
Issue Links
- links to