Skip to content

Commit

Permalink
Concurrent Search Tasks Response Updates (update BWC versions) (opens…
Browse files Browse the repository at this point in the history
…earch-project#7889)

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
reta and github-actions[bot] committed Jun 2, 2023
1 parent b15ffc9 commit 1860d7d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@
- is_true: tasks.$task_id.resource_stats
- is_true: tasks.$task_id.resource_stats.total

---
"tasks_list test detailed":
- skip:
features: [arbitrary_key]
version: " - 2.0.99"
reason: resource_stats were introduced in 2.1.0

- do:
nodes.info: {}
- set:
nodes._arbitrary_key_: node_id

- do:
tasks.list: {}

- is_true: nodes
- is_true: nodes.$node_id.roles

- do:
tasks.list:
group_by: parents
detailed: true
- set:
tasks._arbitrary_key_: task_id

- is_true: tasks
- is_true: tasks.$task_id.resource_stats
- is_true: tasks.$task_id.resource_stats.total

---
"tasks_list headers":
- skip:
Expand All @@ -39,10 +68,11 @@
- match: { tasks.0.headers.X-Opaque-Id: "That is me" }

---
"tasks_list detailed":
"tasks_list detailed (with thread info)":
- skip:
version: " - 2.99.99"
reason: thread_info was introduced in 3.0.0
version: " - 2.8.99"
reason: thread_info was introduced in 2.9.0
features: [arbitrary_key]

- do:
tasks.list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public TaskResourceStats(Map<String, TaskResourceUsage> resourceUsage, TaskThrea
*/
public TaskResourceStats(StreamInput in) throws IOException {
resourceUsage = in.readMap(StreamInput::readString, TaskResourceUsage::readFromStream);
if (in.getVersion().onOrAfter(Version.V_3_0_0)) {
if (in.getVersion().onOrAfter(Version.V_2_9_0)) {
threadUsage = TaskThreadUsage.readFromStream(in);
} else {
// Initialize TaskThreadUsage in case it is not found in mixed cluster case
Expand All @@ -58,7 +58,7 @@ public TaskResourceStats(StreamInput in) throws IOException {
@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeMap(resourceUsage, StreamOutput::writeString, (stream, stats) -> stats.writeTo(stream));
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
if (out.getVersion().onOrAfter(Version.V_2_9_0)) {
threadUsage.writeTo(out);
}
}
Expand Down

0 comments on commit 1860d7d

Please sign in to comment.