diff options
author | Boaz Leskes <b.leskes@gmail.com> | 2017-01-16 21:14:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-16 21:14:41 +0100 |
commit | d80e3eea6c93300f8d6e8ea90fb1e5e38e0dee3e (patch) | |
tree | 01c2f7cbcdba555c6d5250676170880fb6bc0280 /core/src/test/java/org/elasticsearch/action/support | |
parent | f30b1f82eea3ae892f33e143c8237f89baf09a95 (diff) |
Replace EngineClosedException with AlreadyClosedExcpetion (#22631)
`EngineClosedException` is a ES level exception that is used to indicate that the engine is closed when operation starts. It doesn't really add much value and we can use `AlreadyClosedException` from Lucene (which may already bubble if things go wrong during operations). Having two exception can just add confusion and lead to bugs, like wrong handling of `EngineClosedException` when dealing with document level failures. The latter was exposed by `IndexWithShadowReplicasIT`.
This PR also removes the AwaitFix from the `IndexWithShadowReplicasIT` tests (which was what cause this to be discovered). While debugging the source of the issue I found some mismatches in document uid management in the tests. The term that was passed to the engine didn't correspond to the uid in the parsed doc - those are fixed as well.
Diffstat (limited to 'core/src/test/java/org/elasticsearch/action/support')
-rw-r--r-- | core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java b/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java index b929681032..8e5950fe9f 100644 --- a/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java +++ b/core/src/test/java/org/elasticsearch/action/support/replication/TransportReplicationActionTests.java @@ -19,6 +19,7 @@ package org.elasticsearch.action.support.replication; +import org.apache.lucene.store.AlreadyClosedException; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.UnavailableShardsException; @@ -55,7 +56,6 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.index.IndexService; -import org.elasticsearch.index.engine.EngineClosedException; import org.elasticsearch.index.shard.IndexShard; import org.elasticsearch.index.shard.IndexShardClosedException; import org.elasticsearch.index.shard.IndexShardState; @@ -431,12 +431,12 @@ public class TransportReplicationActionTests extends ESTestCase { } } - private ElasticsearchException randomRetryPrimaryException(ShardId shardId) { + private Exception randomRetryPrimaryException(ShardId shardId) { return randomFrom( new ShardNotFoundException(shardId), new IndexNotFoundException(shardId.getIndex()), new IndexShardClosedException(shardId), - new EngineClosedException(shardId), + new AlreadyClosedException(shardId + " primary is closed"), new ReplicationOperation.RetryOnPrimaryException(shardId, "hello") ); } |