-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce BWC version for HotThreads.sort (#79583)
The sort by change has been merged in 7.x now and therefore we should make 8.0 use the same BWC version. Relates to #79392 and #79507 Co-authored-by: Nhat Nguyen <nhat.nguyen@elastic.co>
- Loading branch information
Showing
4 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
qa/mixed-cluster/src/test/java/org/elasticsearch/backwards/HotThreadsIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
package org.elasticsearch.backwards; | ||
|
||
import org.apache.http.util.EntityUtils; | ||
import org.elasticsearch.client.Request; | ||
import org.elasticsearch.client.Response; | ||
import org.elasticsearch.test.rest.ESRestTestCase; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
public class HotThreadsIT extends ESRestTestCase { | ||
|
||
public void testHotThreads() throws Exception { | ||
final IndexingIT.Nodes nodes = IndexingIT.buildNodeAndVersions(client()); | ||
assumeFalse("no new node found", nodes.getNewNodes().isEmpty()); | ||
assumeFalse("no bwc node found", nodes.getBWCNodes().isEmpty()); | ||
assumeTrue("new nodes are higher version than BWC nodes", | ||
nodes.getNewNodes().get(0).getVersion().compareTo(nodes.getBWCNodes().get(0).getVersion()) > 0); | ||
final Request request = new Request("GET", "/_nodes/hot_threads"); | ||
final Response response = client().performRequest(request); | ||
final String responseString = EntityUtils.toString(response.getEntity()); | ||
final String[] nodeResponses = responseString.split("::: "); | ||
int respondedNodes = 0; | ||
for (String nodeResponse : nodeResponses) { | ||
final String[] lines = nodeResponse.split("\n"); | ||
final String nodeId = lines[0].trim(); | ||
if (nodeId.isEmpty() == false) { | ||
respondedNodes++; | ||
} | ||
} | ||
assertThat(respondedNodes, equalTo(nodes.getNewNodes().size() + nodes.getBWCNodes().size())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/nodes.hot_threads/10_basic.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
"Nodes hot threads - CPU": | ||
- do: | ||
nodes.hot_threads: | ||
type: "cpu" | ||
- match: | ||
$body: | | ||
/Hot\ threads\ at/ | ||
--- | ||
"Nodes hot threads - CPU sort": | ||
- do: | ||
nodes.hot_threads: | ||
type: "cpu" | ||
sort: "cpu" | ||
- match: | ||
$body: | | ||
/Hot\ threads\ at/ | ||
--- | ||
"Nodes hot threads - WAIT": | ||
- do: | ||
nodes.hot_threads: | ||
type: "wait" | ||
- match: | ||
$body: | | ||
/Hot\ threads\ at/ | ||
--- | ||
"Nodes hot threads - BLOCK": | ||
- do: | ||
nodes.hot_threads: | ||
type: "block" | ||
- match: | ||
$body: | | ||
/Hot\ threads\ at/ | ||
--- | ||
"Nodes hot threads - MEM": | ||
- do: | ||
nodes.hot_threads: | ||
type: "mem" | ||
- match: | ||
$body: | | ||
/Hot\ threads\ at/ | ||
--- | ||
"Nodes hot threads - BAD": | ||
- do: | ||
catch: bad_request | ||
nodes.hot_threads: | ||
type: "gpu" | ||
- match: { status: 400 } | ||
- match: { error.type: illegal_argument_exception } | ||
- match: { error.reason: "type not supported [gpu]" } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters