Skip to content

Commit

Permalink
Delete by query test on low free disk block (#52759)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
henningandersen authored Feb 25, 2020
1 parent ef88f77 commit 5ca628a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ public void testDeleteByQueryOnReadOnlyAllowDeleteIndex() throws Exception {
// 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);
Expand All @@ -259,8 +263,6 @@ public void testDeleteByQueryOnReadOnlyAllowDeleteIndex() throws Exception {
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(),
Expand Down

0 comments on commit 5ca628a

Please sign in to comment.