Skip to content

Commit b6aed72

Browse files
IT done
1 parent 8b0507c commit b6aed72

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

server/src/internalClusterTest/java/org/elasticsearch/index/engine/MergeWithLowDiskSpaceIT.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import org.elasticsearch.cluster.metadata.IndexMetadata;
1818
import org.elasticsearch.common.settings.Settings;
1919
import org.elasticsearch.common.util.concurrent.EsExecutors;
20+
import org.elasticsearch.index.IndexNotFoundException;
2021
import org.elasticsearch.indices.IndicesService;
2122
import org.elasticsearch.test.ESIntegTestCase;
2223
import org.elasticsearch.threadpool.ThreadPool;
@@ -25,6 +26,7 @@
2526
import java.util.Locale;
2627
import java.util.stream.IntStream;
2728

29+
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
2830
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
2931
import static org.hamcrest.Matchers.equalTo;
3032
import static org.hamcrest.Matchers.lessThan;
@@ -113,6 +115,34 @@ public void testShardCloseWhenDiskSpaceInsufficient() throws Exception {
113115
.toArray(IndexRequestBuilder[]::new)
114116
);
115117
}
118+
// now delete the index in this state, i.e. with merges enqueued
119+
assertAcked(indicesAdmin().prepareDelete(indexName).get());
120+
// index should be gone
121+
assertBusy(() -> {
122+
expectThrows(
123+
IndexNotFoundException.class,
124+
() -> indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(indexName).get()
125+
);
126+
});
127+
assertBusy(() -> {
128+
// merge thread pool should be done with the enqueue merge tasks
129+
NodesStatsResponse nodesStatsResponse = client().admin().cluster().prepareNodesStats().setThreadPool(true).get();
130+
assertThat(
131+
nodesStatsResponse.getNodes()
132+
.getFirst()
133+
.getThreadPool()
134+
.stats()
135+
.stream()
136+
.filter(s -> ThreadPool.Names.MERGE.equals(s.name()))
137+
.findAny()
138+
.get()
139+
.queue(),
140+
equalTo(0)
141+
);
142+
// and the merge executor should also report that merging id done now
143+
assertFalse(indicesService.getThreadPoolMergeExecutorService().isMergingBlockedDueToInsufficientDiskSpace());
144+
assertTrue(indicesService.getThreadPoolMergeExecutorService().allDone());
145+
});
116146
}
117147

118148
public void setTotalSpace(String dataNodeName, long totalSpace) {

0 commit comments

Comments
 (0)