diff --git a/core/src/main/java/org/elasticsearch/ElasticsearchException.java b/core/src/main/java/org/elasticsearch/ElasticsearchException.java index 4f478057fa0..a9b0ba58e09 100644 --- a/core/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/core/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -583,7 +583,6 @@ public class ElasticsearchException extends RuntimeException implements ToXConte org.elasticsearch.index.query.QueryParsingException.class, org.elasticsearch.action.support.replication.TransportReplicationAction.RetryOnPrimaryException.class, org.elasticsearch.index.engine.DeleteByQueryFailedEngineException.class, - org.elasticsearch.index.engine.ForceMergeFailedEngineException.class, org.elasticsearch.discovery.MasterNotDiscoveredException.class, org.elasticsearch.action.support.broadcast.BroadcastShardOperationFailedException.class, org.elasticsearch.node.NodeClosedException.class, diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java b/core/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java index 549ce8fd57b..846612dae47 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/optimize/TransportOptimizeAction.java @@ -74,7 +74,7 @@ public class TransportOptimizeAction extends TransportBroadcastByNodeAction throwable = new AtomicReference<>(); + String operation = randomFrom("optimize", "refresh", "flush"); + Thread mergeThread = new Thread() { + @Override + public void run() { + boolean stop = false; + logger.info("try with {}", operation); + while (stop == false) { + try { + switch (operation) { + case "optimize": { + engine.forceMerge(true, 1, false, false, false); + break; + } + case "refresh": { + engine.refresh("test refresh"); + break; + } + case "flush": { + engine.flush(true, false); + break; + } + } + } catch (Throwable t) { + throwable.set(t); + stop = true; + } + } + } + }; + mergeThread.start(); + engine.close(); + mergeThread.join(); + logger.info("exception caught: ", throwable.get()); + assertTrue("expected an Exception that signals shard is not available", TransportActions.isShardNotAvailableException(throwable.get())); + } }