|
20 | 20 | import org.elasticsearch.action.index.IndexRequest;
|
21 | 21 | import org.elasticsearch.action.support.IndicesOptions;
|
22 | 22 | import org.elasticsearch.action.support.WriteRequest;
|
23 |
| -import org.elasticsearch.client.internal.Client; |
24 | 23 | import org.elasticsearch.cluster.metadata.IndexMetadata;
|
25 | 24 | import org.elasticsearch.common.Strings;
|
26 | 25 | import org.elasticsearch.common.breaker.CircuitBreaker;
|
@@ -445,84 +444,6 @@ public void testSearchIdle() throws Exception {
|
445 | 444 | );
|
446 | 445 | }
|
447 | 446 |
|
448 |
| - public void testCircuitBreakerReduceFail() throws Exception { |
449 |
| - int numShards = randomIntBetween(1, 10); |
450 |
| - indexSomeDocs("test", numShards, numShards * 3); |
451 |
| - |
452 |
| - { |
453 |
| - final AtomicArray<Boolean> responses = new AtomicArray<>(10); |
454 |
| - final CountDownLatch latch = new CountDownLatch(10); |
455 |
| - for (int i = 0; i < 10; i++) { |
456 |
| - int batchReduceSize = randomIntBetween(2, Math.max(numShards + 1, 3)); |
457 |
| - SearchRequest request = prepareSearch("test").addAggregation(new TestAggregationBuilder("test")) |
458 |
| - .setBatchedReduceSize(batchReduceSize) |
459 |
| - .request(); |
460 |
| - final int index = i; |
461 |
| - client().search(request, new ActionListener<>() { |
462 |
| - @Override |
463 |
| - public void onResponse(SearchResponse response) { |
464 |
| - responses.set(index, true); |
465 |
| - latch.countDown(); |
466 |
| - } |
467 |
| - |
468 |
| - @Override |
469 |
| - public void onFailure(Exception e) { |
470 |
| - responses.set(index, false); |
471 |
| - latch.countDown(); |
472 |
| - } |
473 |
| - }); |
474 |
| - } |
475 |
| - latch.await(); |
476 |
| - assertThat(responses.asList().size(), equalTo(10)); |
477 |
| - for (boolean resp : responses.asList()) { |
478 |
| - assertTrue(resp); |
479 |
| - } |
480 |
| - assertBusy(() -> assertThat(requestBreakerUsed(), equalTo(0L))); |
481 |
| - } |
482 |
| - |
483 |
| - try { |
484 |
| - updateClusterSettings(Settings.builder().put("indices.breaker.request.limit", "1b")); |
485 |
| - final Client client = client(); |
486 |
| - assertBusy(() -> { |
487 |
| - Exception exc = expectThrows( |
488 |
| - Exception.class, |
489 |
| - client.prepareSearch("test").addAggregation(new TestAggregationBuilder("test")) |
490 |
| - ); |
491 |
| - assertThat(exc.getCause().getMessage(), containsString("<reduce_aggs>")); |
492 |
| - }); |
493 |
| - |
494 |
| - final AtomicArray<Exception> exceptions = new AtomicArray<>(10); |
495 |
| - final CountDownLatch latch = new CountDownLatch(10); |
496 |
| - for (int i = 0; i < 10; i++) { |
497 |
| - int batchReduceSize = randomIntBetween(2, Math.max(numShards + 1, 3)); |
498 |
| - SearchRequest request = prepareSearch("test").addAggregation(new TestAggregationBuilder("test")) |
499 |
| - .setBatchedReduceSize(batchReduceSize) |
500 |
| - .request(); |
501 |
| - final int index = i; |
502 |
| - client().search(request, new ActionListener<>() { |
503 |
| - @Override |
504 |
| - public void onResponse(SearchResponse response) { |
505 |
| - latch.countDown(); |
506 |
| - } |
507 |
| - |
508 |
| - @Override |
509 |
| - public void onFailure(Exception exc) { |
510 |
| - exceptions.set(index, exc); |
511 |
| - latch.countDown(); |
512 |
| - } |
513 |
| - }); |
514 |
| - } |
515 |
| - latch.await(); |
516 |
| - assertThat(exceptions.asList().size(), equalTo(10)); |
517 |
| - for (Exception exc : exceptions.asList()) { |
518 |
| - assertThat(exc.getCause().getMessage(), containsString("<reduce_aggs>")); |
519 |
| - } |
520 |
| - assertBusy(() -> assertThat(requestBreakerUsed(), equalTo(0L))); |
521 |
| - } finally { |
522 |
| - updateClusterSettings(Settings.builder().putNull("indices.breaker.request.limit")); |
523 |
| - } |
524 |
| - } |
525 |
| - |
526 | 447 | public void testCircuitBreakerFetchFail() throws Exception {
|
527 | 448 | int numShards = randomIntBetween(1, 10);
|
528 | 449 | int numDocs = numShards * 10;
|
|
0 commit comments