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
This commit is contained in:
Shay Banon 2013-07-24 01:57:40 +02:00
parent bb6df34671
commit b85bcde640
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}
});