Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@

import java.util.Collection;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.LongAdder;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.xpack.esql.EsqlTestUtils.as;
import static org.elasticsearch.xpack.esql.EsqlTestUtils.getValuesList;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.hasSize;

public class DataNodeRequestSenderIT extends AbstractEsqlIntegTestCase {
Expand All @@ -52,17 +50,19 @@ public void testSearchWhileRelocating() throws InterruptedException {

// start background searches
var stopped = new AtomicBoolean(false);
var queries = new LongAdder();
var threads = new Thread[randomIntBetween(1, 5)];
for (int i = 0; i < threads.length; i++) {
threads[i] = new Thread(() -> {
while (stopped.get() == false) {
try (EsqlQueryResponse resp = run("FROM index-1")) {
assertThat(getValuesList(resp), hasSize(docs));
} catch (Exception | AssertionError e) {
logger.warn("Query failed with exception", e);
stopped.set(true);
throw e;
}
queries.increment();
}
});
}, "testSearchWhileRelocating");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it help to have the i in the name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it is not to important as long as we can identify this is the the source of the threads if they ever picked up by leak detector

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although, there is no disadvantage in having it, will add shortly.

}
for (Thread thread : threads) {
thread.start();
Expand Down Expand Up @@ -93,7 +93,6 @@ public void testSearchWhileRelocating() throws InterruptedException {
.prepareUpdateSettings(TEST_REQUEST_TIMEOUT, TEST_REQUEST_TIMEOUT)
.setPersistentSettings(Settings.builder().putNull("cluster.routing.allocation.exclude._name"))
.get();
assertThat(queries.sum(), greaterThan((long) threads.length));
}

public void testRetryOnShardMovement() {
Expand Down