From 3ad1783a4170e56cd69e2273b279e70ec3917580 Mon Sep 17 00:00:00 2001 From: Henning Andersen <33268011+henningandersen@users.noreply.github.com> Date: Tue, 25 Feb 2020 15:53:46 +0100 Subject: [PATCH] Delete by query test on low free disk block (#52759) The block setup by the test could be released by the nodes cluster info thread before the disk threshold decider was disabled, now disable decider first. --- .../index/reindex/DeleteByQueryBasicTests.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java index 6a8aad210a1..350fe794a77 100644 --- a/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java +++ b/modules/reindex/src/test/java/org/elasticsearch/index/reindex/DeleteByQueryBasicTests.java @@ -245,6 +245,10 @@ public class DeleteByQueryBasicTests extends ReindexTestCase { // so we should test both case of disk allocation decider is enabled and disabled boolean diskAllocationDeciderEnabled = randomBoolean(); try { + if (diskAllocationDeciderEnabled == false) { + // Disable the disk allocation decider to ensure the read_only_allow_delete block cannot be released + setDiskAllocationDeciderEnabled(false); + } // When a read_only_allow_delete block is set on the index, // it will trigger a retry policy in the delete by query request because the rest status of the block is 429 enableIndexBlock("test", SETTING_READ_ONLY_ALLOW_DELETE); @@ -259,8 +263,6 @@ public class DeleteByQueryBasicTests extends ReindexTestCase { assertThat(deleteByQuery().source("test").filter(QueryBuilders.matchAllQuery()).refresh(true).get(), matcher().deleted(docs)); } else { - // Disable the disk allocation decider to ensure the read_only_allow_delete block cannot be released - setDiskAllocationDeciderEnabled(false); // The delete by query request will not be executed successfully because the block cannot be released assertThat(deleteByQuery().source("test").filter(QueryBuilders.matchAllQuery()).refresh(true) .setMaxRetries(2).setRetryBackoffInitialTime(TimeValue.timeValueMillis(50)).get(),