Removed exception handling in InternalIndexShard.docStats() & storeStats()

This is already caught at another level, see #4203
This commit is contained in:
Boaz Leskes 2013-12-18 11:08:30 +01:00
parent fffa6a21dc
commit b865047125
1 changed files with 10 additions and 14 deletions

View File

@ -85,6 +85,7 @@ import org.elasticsearch.search.suggest.completion.Completion090PostingsFormat;
import org.elasticsearch.search.suggest.completion.CompletionStats; import org.elasticsearch.search.suggest.completion.CompletionStats;
import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPool;
import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.nio.channels.ClosedByInterruptException; import java.nio.channels.ClosedByInterruptException;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
@ -349,8 +350,9 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I
/** /**
* Changes the state of the current shard * Changes the state of the current shard
*
* @param newState the new shard state * @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 * @return the previous shard state
*/ */
private IndexShardState changeState(IndexShardState newState, String reason) { private IndexShardState changeState(IndexShardState newState, String reason) {
@ -487,16 +489,11 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I
@Override @Override
public DocsStats docStats() { public DocsStats docStats() {
final Engine.Searcher searcher = acquireSearcher("doc_stats");
try { try {
final Engine.Searcher searcher = acquireSearcher("doc_stats"); return new DocsStats(searcher.reader().numDocs(), searcher.reader().numDeletedDocs());
try { } finally {
return new DocsStats(searcher.reader().numDocs(), searcher.reader().numDeletedDocs()); searcher.release();
} finally {
searcher.release();
}
} catch (Throwable e) {
logger.debug("Can not build 'doc stats' from engine shard state [{}]", e, state);
return new DocsStats();
} }
} }
@ -519,9 +516,8 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I
public StoreStats storeStats() { public StoreStats storeStats() {
try { try {
return store.stats(); return store.stats();
} catch (Throwable e) { } catch (IOException e) {
logger.debug("Can not build 'store stats' from engine shard state [{}]", e, state); throw new ElasticSearchException("io exception while building 'store stats'", e);
return new StoreStats();
} }
} }
@ -1040,4 +1036,4 @@ public class InternalIndexShard extends AbstractIndexShardComponent implements I
logger.warn("failed to check index", e); logger.warn("failed to check index", e);
} }
} }
} }