IndexService#maybeRefresh should catch `IndexShardClosedException` (#21205)

We throw this exception in some cases that the shard is closed, so we have to be consistent here. Otherwise we get logs like:

```
 1> [2016-10-30T21:06:22,529][WARN ][o.e.i.IndexService       ] [node_s_0] [test] failed to run task refresh - suppressing re-occurring exceptions unless the exception changes
 1> org.elasticsearch.index.shard.IndexShardClosedException: CurrentState[CLOSED] operation only allowed when not closed
 1> 	at org.elasticsearch.index.shard.IndexShard.verifyNotClosed(IndexShard.java:1147) ~[main/:?]
 1> 	at org.elasticsearch.index.shard.IndexShard.verifyNotClosed(IndexShard.java:1141) ~[main/:?]
```
This commit is contained in:
Boaz Leskes 2016-10-31 20:04:33 +01:00 committed by GitHub
parent 1f5adaa824
commit c10a6ddec1
1 changed files with 2 additions and 1 deletions

View File

@ -52,6 +52,7 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.index.shard.IndexEventListener;
import org.elasticsearch.index.shard.IndexSearcherWrapper;
import org.elasticsearch.index.shard.IndexShard;
import org.elasticsearch.index.shard.IndexShardClosedException;
import org.elasticsearch.index.shard.IndexingOperationListener;
import org.elasticsearch.index.shard.SearchOperationListener;
import org.elasticsearch.index.shard.ShadowIndexShard;
@ -692,7 +693,7 @@ public class IndexService extends AbstractIndexComponent implements IndicesClust
if (shard.isRefreshNeeded()) {
shard.refresh("schedule");
}
} catch (EngineClosedException | AlreadyClosedException ex) {
} catch (IndexShardClosedException | AlreadyClosedException ex) {
// fine - continue;
}
continue;