oleewere closed pull request #34: AMBARI-24932. Log Feeder: LB solr client - retry requests in case of errors URL: https://github.com/apache/ambari-logsearch/pull/34
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): 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 dd89e0ad47..90d13ef038 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 @@ private void initParams(LogFeederProps logFeederProps) throws Exception { 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 @@ private boolean sendToSolr(OutputData outputData) { //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 @@ private boolean sendToSolr(OutputData outputData) { // 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; } ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services