From b85bcde640da53f95e6fcc174e0a32333ecd91cf Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Wed, 24 Jul 2013 01:57:40 +0200 Subject: [PATCH] better logging on failure to create index if the index already exists, trace log it, since it might happen as a result of multiple index requests at the same time creating the index, all other ones, should be debug and not warn in the same spirit of other APIs --- .../admin/indices/create/TransportCreateIndexAction.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java index 182ae6c2d19..1185016adf7 100644 --- a/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java +++ b/src/main/java/org/elasticsearch/action/admin/indices/create/TransportCreateIndexAction.java @@ -29,6 +29,7 @@ import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.metadata.MetaDataCreateIndexService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.indices.IndexAlreadyExistsException; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -92,7 +93,11 @@ public class TransportCreateIndexAction extends TransportMasterNodeOperationActi @Override public void onFailure(Throwable t) { - logger.warn("[{}] failed to create", t, request.index()); + if (t instanceof IndexAlreadyExistsException) { + logger.trace("[{}] failed to create", t, request.index()); + } else { + logger.debug("[{}] failed to create", t, request.index()); + } listener.onFailure(t); } });