|
15 | 15 | import org.elasticsearch.action.support.PlainActionFuture; |
16 | 16 | import org.elasticsearch.cluster.node.DiscoveryNode; |
17 | 17 | import org.elasticsearch.cluster.node.DiscoveryNodeUtils; |
| 18 | +import org.elasticsearch.common.breaker.CircuitBreaker.Durability; |
| 19 | +import org.elasticsearch.common.breaker.CircuitBreakingException; |
18 | 20 | import org.elasticsearch.common.settings.Settings; |
19 | 21 | import org.elasticsearch.common.util.concurrent.ConcurrentCollections; |
20 | 22 | import org.elasticsearch.common.util.concurrent.EsExecutors; |
@@ -271,6 +273,17 @@ public void testNonFatalFailedOnAllNodes() { |
271 | 273 | assertThat(sent.size(), equalTo(2)); |
272 | 274 | } |
273 | 275 |
|
| 276 | + public void testDoNotRetryCircuitBreakerException() { |
| 277 | + var targetShards = List.of(targetShard(shard1, node1, node2)); |
| 278 | + var sent = ConcurrentCollections.newQueue(); |
| 279 | + var future = sendRequests(targetShards, false, (node, shardIds, aliasFilters, listener) -> { |
| 280 | + sent.add(new NodeRequest(node, shardIds, aliasFilters)); |
| 281 | + runWithDelay(() -> listener.onFailure(new CircuitBreakingException("cbe", randomFrom(Durability.values())), false)); |
| 282 | + }); |
| 283 | + expectThrows(CircuitBreakingException.class, equalTo("cbe"), future::actionGet); |
| 284 | + assertThat(sent.size(), equalTo(1)); |
| 285 | + } |
| 286 | + |
274 | 287 | static DataNodeRequestSender.TargetShard targetShard(ShardId shardId, DiscoveryNode... nodes) { |
275 | 288 | return new DataNodeRequestSender.TargetShard(shardId, new ArrayList<>(Arrays.asList(nodes)), null); |
276 | 289 | } |
|
0 commit comments