You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Joe Gresock (Jira)" <ji...@apache.org> on 2022/03/01 11:52:00 UTC

[jira] [Resolved] (NIFI-9641) Allow ZooKeeper to respect the chroot suffix for ZK connection strings

     [ https://issues.apache.org/jira/browse/NIFI-9641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Gresock resolved NIFI-9641.
-------------------------------
    Fix Version/s: 1.16.0
       Resolution: Fixed

> Allow ZooKeeper to respect the chroot suffix for ZK connection strings
> ----------------------------------------------------------------------
>
>                 Key: NIFI-9641
>                 URL: https://issues.apache.org/jira/browse/NIFI-9641
>             Project: Apache NiFi
>          Issue Type: Improvement
>            Reporter: Nathan Gough
>            Assignee: Nathan Gough
>            Priority: Major
>             Fix For: 1.16.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> As per a question from the mail list:
> {quote}... 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|https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-solr-bundle/nifi-solr-processors/src/main/java/org/apache/nifi/processors/solr/SolrUtils.java])
> The commit of intrest regarding the new process for initiating a CloudSolrClient in SolrJ 
> [https://github.com/apache/nifi/commit/9b4292024be6fae188cb1efa3a07dc9489e9a5b4#diff-13320e5b198f236cea296fb01cb7376755d65c444678e781fa0940c2a28db88b]
> 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:
>  
> {code:java}
> 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];
>             }
> {code}
>  
>   
> !https://mail.google.com/mail/u/1?ui=2&ik=3b9ca9ac83&attid=0.1&permmsgid=msg-f:1723201017234436500&th=17ea0a31fcd9b194&view=fimg&fur=ip&sz=s0-l75-ft&attbid=ANGjdJ_C76OBTZcalaQ6x_CIKaXFOUPW7Z6szcqxT0RjR36mSNY8n1NJ_MhMQzIp9FgZr9nDL6JCDcUUy_SxtSo2tA8Cv3riYx9laQAbBEZUvbJ9M8he48Pjy4ORjhE&disp=emb|width=1347,height=270!
> 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.
> {code:java}
> final String zk[] = solrLocation.split("/");{code}
> To
> {code:java}
> final String[] zk = solrLocation.split("/",2){code}
> {quote}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)