This is an automated email from the ASF dual-hosted git repository.

oleewere pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ambari-logsearch.git


The following commit(s) were added to refs/heads/master by this push:
     new eed97c5  AMBARI-24932. Log Feeder: LB solr client - retry requests in 
case of errors (#34)
eed97c5 is described below

commit eed97c50dd7fcd0a1655750d51beb5e072b0f836
Author: Olivér Szabó <oleew...@gmail.com>
AuthorDate: Wed Nov 21 13:11:30 2018 +0100

    AMBARI-24932. Log Feeder: LB solr client - retry requests in case of errors 
(#34)
---
 .../org/apache/ambari/logfeeder/output/OutputSolr.java     | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
index dd89e0a..90d13ef 100644
--- 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
+++ 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/OutputSolr.java
@@ -148,11 +148,15 @@ public class OutputSolr extends Output<LogFeederProps, 
InputMarker> {
     zkConnectString = getStringValue("zk_connect_string");
     List<String> solrUrlsList = getListValue("solr_urls");
 
-    if (StringUtils.isBlank(zkConnectString) && 
CollectionUtils.isEmpty(solrUrlsList)) {
+    if (StringUtils.isBlank(zkConnectString)
+      && CollectionUtils.isEmpty(solrUrlsList)
+      && StringUtils.isBlank(logFeederProps.getSolrUrlsStr())) {
       throw new Exception("For solr output the zk_connect_string or solr_urls 
property need to be set");
     }
 
-    if (CollectionUtils.isNotEmpty(solrUrlsList)) {
+    if (StringUtils.isNotBlank(logFeederProps.getSolrUrlsStr())) {
+      solrUrls = logFeederProps.getSolrUrls();
+    } else if (CollectionUtils.isNotEmpty(solrUrlsList)) {
       solrUrls = solrUrlsList.toArray(new String[0]);
     }
 
@@ -405,7 +409,7 @@ public class OutputSolr extends Output<LogFeederProps, 
InputMarker> {
           //Send successful, will return 
           result = true;
           break;
-        } catch (IOException | SolrException exception) {
+        } catch (IOException | SolrException | SolrServerException exception ) 
{
           // Transient error, lets block till it is available
           try {
             logger.warn("Solr is not reachable. Going to retry after " + 
RETRY_INTERVAL + " seconds. " + "output="
@@ -415,11 +419,11 @@ public class OutputSolr extends Output<LogFeederProps, 
InputMarker> {
             // ignore
           }
         } catch (Throwable serverException) {
-          // Something unknown happened. Let's not block because of this 
error. 
+          // Something unknown happened. Let's not block because of this error.
           // Clear the buffer
           String logMessageKey = this.getClass().getSimpleName() + 
"_SOLR_UPDATE_EXCEPTION";
           LogFeederUtil.logErrorMessageByInterval(logMessageKey, "Error 
sending log message to server. Dropping logs",
-              serverException, logger, Level.ERROR);
+            serverException, logger, Level.ERROR);
           resetLocalBuffer();
           break;
         }

Reply via email to