Skip to content

Commit 91821c7

Browse files
authored
Fix bwc on main for threadpool wait time metric (#10004)
Signed-off-by: Jay Deng <[email protected]>
1 parent 443cfca commit 91821c7

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"Test cat thread_pool total_wait_time output":
22
- skip:
3-
version: " - 3.0.0"
4-
reason: thread_pool total_wait_time stats were introduced in V_3.0.0
3+
version: " - 2.10.99"
4+
reason: thread_pool total_wait_time stats were introduced in V_2.11.0
55

66
- do:
77
cat.thread_pool: {}
@@ -19,11 +19,10 @@
1919

2020
- match:
2121
$body: |
22-
/^ id \s+ name \s+ total_wait_time \s+ twt \n
23-
(\S+ \s+ search \s+ \d+s \s+ \d+ \n
24-
\S+ \s+ search_throttled \s+ \d+s \s+ \d+ \n
25-
\S+ \s+ index_searcher \s+ \d+s \s+ \d+ \n
26-
\S+ \s+ generic \s+ -1 \s+ -1 \n)+ $/
22+
/^ name \s+ total_wait_time \s+ twt \n
23+
(generic \s+ -1 \s+ -1 \n
24+
search \s+ \d*\.*\d*\D+ \s+ \d*\.*\d*\D+ \n
25+
search_throttled \s+ \d*\.*\d*\D+ \s+ \d*\.*\d*\D+ \n)+ $/
2726
2827
---
2928
"Test cat thread_pool output":

server/src/main/java/org/opensearch/threadpool/ThreadPoolStats.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Stats(StreamInput in) throws IOException {
8888
rejected = in.readLong();
8989
largest = in.readInt();
9090
completed = in.readLong();
91-
waitTimeNanos = in.getVersion().onOrAfter(Version.V_3_0_0) ? in.readLong() : -1;
91+
waitTimeNanos = in.getVersion().onOrAfter(Version.V_2_11_0) ? in.readLong() : -1;
9292
}
9393

9494
@Override
@@ -100,7 +100,7 @@ public void writeTo(StreamOutput out) throws IOException {
100100
out.writeLong(rejected);
101101
out.writeInt(largest);
102102
out.writeLong(completed);
103-
if (out.getVersion().onOrAfter(Version.V_3_0_0)) {
103+
if (out.getVersion().onOrAfter(Version.V_2_11_0)) {
104104
out.writeLong(waitTimeNanos);
105105
}
106106
}

0 commit comments

Comments
 (0)