Yuriy Flyud created NIFI-6744:
---------------------------------

             Summary: PutSolrContentStream Processor does no route to 
connection_failure in Cloud mode if Zookeeper is not running
                 Key: NIFI-6744
                 URL: https://issues.apache.org/jira/browse/NIFI-6744
             Project: Apache NiFi
          Issue Type: Bug
          Components: Core Framework
    Affects Versions: 1.9.2
            Reporter: Yuriy Flyud


Solr processors would not detect connection failure in case ZK is not running. 
When this happens a SolrException is thrown. The following causes should route 
a flow file to a connection_failure:
 * java.util.concurren.TimeoutException - when ZK was down during Solr 
processor start
 * org.apache.zookeeper.KeeperException.ConnectionLossException - when ZK 
stopped after Solr processor was started and connection established.

This could be fixed by implementing a SolrException handling in the following 
way:
{code:java}
catch (SolrException e) {
  //Additional handling of ZK connection exceptions.
  if (causedByException(e, TimeoutException.class) || causedByException(e, 
ConnectionLossException.class)) {
    connectionError.set(e);
  } else {
    error.set(e);
  }

...

private boolean causedByException(Exception e, Class<? extends Exception> ec) {
  boolean foundException = false;
  Throwable cause = e.getCause();
  while (cause != null) {
    if (ec.isInstance(cause)) {
      foundException = true;
      break;
    }
    cause = cause.getCause();
  }
  return foundException;
}{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to