From 4d87d7db76da416fdfe13347203007f1e09f4f17 Mon Sep 17 00:00:00 2001 From: Artem Prigoda Date: Thu, 20 Feb 2025 14:09:10 +0100 Subject: [PATCH 1/3] [test] Check that requests for adding an index block in parallel are acked See https://github.com/elastic/elasticsearch/issues/122324 --- .../java/org/elasticsearch/blocks/SimpleBlocksIT.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java b/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java index 93f8997ff24a1..6501369e600b6 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java @@ -405,7 +405,8 @@ public void testConcurrentAddBlock() throws InterruptedException, ExecutionExcep try { startInParallel(threadCount, i -> { try { - indicesAdmin().prepareAddBlock(block, indexName).get(); + AddIndexBlockResponse response = indicesAdmin().prepareAddBlock(block, indexName).get(); + assertTrue("Add block [" + block + "] to index [" + indexName + "] not acknowledged: " + response, response.isAcknowledged()); assertIndexHasBlock(block, indexName); } catch (final ClusterBlockException e) { assertThat(e.blocks(), hasSize(1)); From e5c2c13e9dd4d2ef878bb01984c4e252c48fe91b Mon Sep 17 00:00:00 2001 From: elasticsearchmachine Date: Thu, 20 Feb 2025 13:18:43 +0000 Subject: [PATCH 2/3] [CI] Auto commit changes from spotless --- .../java/org/elasticsearch/blocks/SimpleBlocksIT.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java b/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java index 6501369e600b6..6ccc0066fa54a 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java @@ -406,7 +406,10 @@ public void testConcurrentAddBlock() throws InterruptedException, ExecutionExcep startInParallel(threadCount, i -> { try { AddIndexBlockResponse response = indicesAdmin().prepareAddBlock(block, indexName).get(); - assertTrue("Add block [" + block + "] to index [" + indexName + "] not acknowledged: " + response, response.isAcknowledged()); + assertTrue( + "Add block [" + block + "] to index [" + indexName + "] not acknowledged: " + response, + response.isAcknowledged() + ); assertIndexHasBlock(block, indexName); } catch (final ClusterBlockException e) { assertThat(e.blocks(), hasSize(1)); From 1334312cbd2a34bb225163d59e67d22b7e9c086d Mon Sep 17 00:00:00 2001 From: Artem Prigoda Date: Thu, 20 Feb 2025 20:35:17 +0100 Subject: [PATCH 3/3] Wrap assertAcked in assertBusy --- muted-tests.yml | 3 --- .../java/org/elasticsearch/blocks/SimpleBlocksIT.java | 8 +++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index 90ad056d4f881..b19abbbed40ef 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -268,9 +268,6 @@ tests: - class: org.elasticsearch.smoketest.SmokeTestMonitoringWithSecurityIT method: testHTTPExporterWithSSL issue: https://github.com/elastic/elasticsearch/issues/122220 -- class: org.elasticsearch.blocks.SimpleBlocksIT - method: testConcurrentAddBlock - issue: https://github.com/elastic/elasticsearch/issues/122324 - class: org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT method: test {yaml=reference/cat/health/cat-health-example} issue: https://github.com/elastic/elasticsearch/issues/122335 diff --git a/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java b/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java index 6ccc0066fa54a..b11861833a2ba 100644 --- a/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java +++ b/server/src/internalClusterTest/java/org/elasticsearch/blocks/SimpleBlocksIT.java @@ -405,15 +405,13 @@ public void testConcurrentAddBlock() throws InterruptedException, ExecutionExcep try { startInParallel(threadCount, i -> { try { - AddIndexBlockResponse response = indicesAdmin().prepareAddBlock(block, indexName).get(); - assertTrue( - "Add block [" + block + "] to index [" + indexName + "] not acknowledged: " + response, - response.isAcknowledged() - ); + assertBusy(() -> assertAcked(indicesAdmin().prepareAddBlock(block, indexName).get())); assertIndexHasBlock(block, indexName); } catch (final ClusterBlockException e) { assertThat(e.blocks(), hasSize(1)); assertTrue(e.blocks().stream().allMatch(b -> b.id() == block.getBlock().id())); + } catch (Exception e) { + throw new RuntimeException("Unable to ack an index block request", e); } }); assertIndexHasBlock(block, indexName);