SOLR-10397: Overseer.createAutoscalingTriggerIfNotExist() should log error instead of throwing SolrException

This commit is contained in:
Cao Manh Dat 2017-07-28 23:05:32 +07:00
parent 6f8ca53b3c
commit 6893699f06
1 changed files with 8 additions and 5 deletions

View File

@ -599,11 +599,14 @@ public class Overseer implements Closeable {
request.getContext().put("httpMethod", "POST");
request.setContentStreams(Collections.singleton(new ContentStreamBase.StringStream(dsl)));
SolrQueryResponse response = new SolrQueryResponse();
getZkController().getCoreContainer()
.getRequestHandler(AutoScalingHandler.HANDLER_PATH).handleRequest(request, response);
if (!"success".equals(response.getValues().get("result"))) {
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Failed when creating .auto_add_replicas trigger, return " + response);
try {
getZkController().getCoreContainer()
.getRequestHandler(AutoScalingHandler.HANDLER_PATH).handleRequest(request, response);
if (!"success".equals(response.getValues().get("result"))) {
log.error("Failed when creating .auto_add_replicas trigger, return {}",response);
}
} catch (Exception e) {
log.error("Failed when creating .auto_add_replicas trigger ", e);
}
}
};