From b865047125648cd571e40b165357fbb0b2f7a51f Mon Sep 17 00:00:00 2001 From: Boaz Leskes Date: Wed, 18 Dec 2013 11:08:30 +0100 Subject: [PATCH] Removed exception handling in InternalIndexShard.docStats() & storeStats() This is already caught at another level, see #4203 --- .../shard/service/InternalIndexShard.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java b/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java index 3484247abde..806e6812293 100644 --- a/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java +++ b/src/main/java/org/elasticsearch/index/shard/service/InternalIndexShard.java @@ -85,6 +85,7 @@ import org.elasticsearch.search.suggest.completion.Completion090PostingsFormat; import org.elasticsearch.search.suggest.completion.CompletionStats; import org.elasticsearch.threadpool.ThreadPool; +import java.io.IOException; import java.io.PrintStream; import java.nio.channels.ClosedByInterruptException; import java.util.concurrent.ScheduledFuture; @@ -349,8 +350,9 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I /** * Changes the state of the current shard + * * @param newState the new shard state - * @param reason the reason for the state change + * @param reason the reason for the state change * @return the previous shard state */ private IndexShardState changeState(IndexShardState newState, String reason) { @@ -487,16 +489,11 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I @Override public DocsStats docStats() { + final Engine.Searcher searcher = acquireSearcher("doc_stats"); try { - final Engine.Searcher searcher = acquireSearcher("doc_stats"); - try { - return new DocsStats(searcher.reader().numDocs(), searcher.reader().numDeletedDocs()); - } finally { - searcher.release(); - } - } catch (Throwable e) { - logger.debug("Can not build 'doc stats' from engine shard state [{}]", e, state); - return new DocsStats(); + return new DocsStats(searcher.reader().numDocs(), searcher.reader().numDeletedDocs()); + } finally { + searcher.release(); } } @@ -519,9 +516,8 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I public StoreStats storeStats() { try { return store.stats(); - } catch (Throwable e) { - logger.debug("Can not build 'store stats' from engine shard state [{}]", e, state); - return new StoreStats(); + } catch (IOException e) { + throw new ElasticSearchException("io exception while building 'store stats'", e); } } @@ -1040,4 +1036,4 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I logger.warn("failed to check index", e); } } -} \ No newline at end of file +}