mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-26 06:46:10 +00:00
Suppress CachedTimeThread in hot threads output (#35558)
In #23175 we renamed `ThreadPool$EstimatedTimeThread` to `ThreadPool$CachedTimeThread` but did not update the corresponding entry in `HotThreads#isIdleThread`. This commit addresses this.
This commit is contained in:
parent
c9b4ef0dfd
commit
928ab6a5b1
@ -113,7 +113,7 @@ public class HotThreads {
|
|||||||
methodName.equals("select")) {
|
methodName.equals("select")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (className.equals("org.elasticsearch.threadpool.ThreadPool$EstimatedTimeThread") &&
|
if (className.equals("org.elasticsearch.threadpool.ThreadPool$CachedTimeThread") &&
|
||||||
methodName.equals("run")) {
|
methodName.equals("run")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsReq
|
|||||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
|
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
import org.elasticsearch.test.ESIntegTestCase;
|
import org.elasticsearch.test.ESIntegTestCase;
|
||||||
|
import org.hamcrest.Matcher;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@ -38,7 +39,9 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitC
|
|||||||
import static org.hamcrest.CoreMatchers.equalTo;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.hamcrest.CoreMatchers.is;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
import static org.hamcrest.CoreMatchers.notNullValue;
|
import static org.hamcrest.CoreMatchers.notNullValue;
|
||||||
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.hamcrest.Matchers.lessThan;
|
import static org.hamcrest.Matchers.lessThan;
|
||||||
|
import static org.hamcrest.Matchers.not;
|
||||||
|
|
||||||
public class HotThreadsIT extends ESIntegTestCase {
|
public class HotThreadsIT extends ESIntegTestCase {
|
||||||
|
|
||||||
@ -135,9 +138,13 @@ public class HotThreadsIT extends ESIntegTestCase {
|
|||||||
builder.setThreads(Integer.MAX_VALUE);
|
builder.setThreads(Integer.MAX_VALUE);
|
||||||
NodesHotThreadsResponse response = builder.execute().get();
|
NodesHotThreadsResponse response = builder.execute().get();
|
||||||
|
|
||||||
|
final Matcher<String> containsCachedTimeThreadRunMethod
|
||||||
|
= containsString("org.elasticsearch.threadpool.ThreadPool$CachedTimeThread.run");
|
||||||
|
|
||||||
int totSizeAll = 0;
|
int totSizeAll = 0;
|
||||||
for (NodeHotThreads node : response.getNodesMap().values()) {
|
for (NodeHotThreads node : response.getNodesMap().values()) {
|
||||||
totSizeAll += node.getHotThreads().length();
|
totSizeAll += node.getHotThreads().length();
|
||||||
|
assertThat(node.getHotThreads(), containsCachedTimeThreadRunMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Second time, do ignore idle threads:
|
// Second time, do ignore idle threads:
|
||||||
@ -151,6 +158,7 @@ public class HotThreadsIT extends ESIntegTestCase {
|
|||||||
int totSizeIgnoreIdle = 0;
|
int totSizeIgnoreIdle = 0;
|
||||||
for (NodeHotThreads node : response.getNodesMap().values()) {
|
for (NodeHotThreads node : response.getNodesMap().values()) {
|
||||||
totSizeIgnoreIdle += node.getHotThreads().length();
|
totSizeIgnoreIdle += node.getHotThreads().length();
|
||||||
|
assertThat(node.getHotThreads(), not(containsCachedTimeThreadRunMethod));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The filtered stacks should be smaller than unfiltered ones:
|
// The filtered stacks should be smaller than unfiltered ones:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user