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:
David Turner 2018-11-15 08:25:09 +00:00 committed by GitHub
parent c9b4ef0dfd
commit 928ab6a5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -113,7 +113,7 @@ public class HotThreads {
methodName.equals("select")) {
return true;
}
if (className.equals("org.elasticsearch.threadpool.ThreadPool$EstimatedTimeThread") &&
if (className.equals("org.elasticsearch.threadpool.ThreadPool$CachedTimeThread") &&
methodName.equals("run")) {
return true;
}

View File

@ -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.common.unit.TimeValue;
import org.elasticsearch.test.ESIntegTestCase;
import org.hamcrest.Matcher;
import java.util.Map;
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.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.not;
public class HotThreadsIT extends ESIntegTestCase {
@ -135,9 +138,13 @@ public class HotThreadsIT extends ESIntegTestCase {
builder.setThreads(Integer.MAX_VALUE);
NodesHotThreadsResponse response = builder.execute().get();
final Matcher<String> containsCachedTimeThreadRunMethod
= containsString("org.elasticsearch.threadpool.ThreadPool$CachedTimeThread.run");
int totSizeAll = 0;
for (NodeHotThreads node : response.getNodesMap().values()) {
totSizeAll += node.getHotThreads().length();
assertThat(node.getHotThreads(), containsCachedTimeThreadRunMethod);
}
// Second time, do ignore idle threads:
@ -151,6 +158,7 @@ public class HotThreadsIT extends ESIntegTestCase {
int totSizeIgnoreIdle = 0;
for (NodeHotThreads node : response.getNodesMap().values()) {
totSizeIgnoreIdle += node.getHotThreads().length();
assertThat(node.getHotThreads(), not(containsCachedTimeThreadRunMethod));
}
// The filtered stacks should be smaller than unfiltered ones: