diff --git a/docs/reference/cat/thread_pool.asciidoc b/docs/reference/cat/thread_pool.asciidoc index 163a729e51cc3..bfc5ca415c3ba 100644 --- a/docs/reference/cat/thread_pool.asciidoc +++ b/docs/reference/cat/thread_pool.asciidoc @@ -113,14 +113,15 @@ in the table below. |Field Name |Alias |Description |`type` |`t` |The current (*) type of thread pool (`fixed` or `scaling`) |`active` |`a` |The number of active threads in the current thread pool -|`size` |`s` |The number of threads in the current thread pool +|`pool_size` |`psz` |The number of threads in the current thread pool |`queue` |`q` |The number of tasks in the queue for the current thread pool |`queue_size` |`qs` |The maximum number of tasks permitted in the queue for the current thread pool |`rejected` |`r` |The number of tasks rejected by the thread pool executor |`largest` |`l` |The highest number of active threads in the current thread pool |`completed` |`c` |The number of tasks completed by the thread pool executor -|`min` |`mi` |The configured minimum number of active threads allowed in the current thread pool -|`max` |`ma` |The configured maximum number of active threads allowed in the current thread pool +|`core` |`cr` |The configured core number of active threads allowed in the current thread pool +|`max` |`mx` |The configured maximum number of active threads allowed in the current thread pool +|`size` |`sz` |The configured fixed number of active threads allowed in the current thread pool |`keep_alive` |`k` |The configured keep alive time for threads |======================================================================= diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yml index 9cd970341412a..bb16ae391c46d 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/cat.thread_pool/10_basic.yml @@ -1,6 +1,10 @@ --- "Test cat thread_pool output": + - skip: + version: " - 6.99.99" + reason: this API was changed in a backwards-incompatible fashion in 7.0.0 so we need to skip in a mixed cluster + - do: cat.thread_pool: {} @@ -46,25 +50,25 @@ - do: cat.thread_pool: thread_pool_patterns: bulk - h: id,name,type,active,size,queue,queue_size,rejected,largest,completed,min,max,keep_alive + h: id,name,type,active,pool_size,queue,queue_size,rejected,largest,completed,core,max,size,keep_alive v: true - match: $body: | - /^ id \s+ name \s+ type \s+ active \s+ size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ min \s+ max \s+ keep_alive \n - (\S+ \s+ bulk \s+ fixed \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \S* \n)+ $/ + /^ id \s+ name \s+ type \s+ active \s+ pool_size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ core \s+ max \s+ size \s+ keep_alive \n + (\S+ \s+ bulk \s+ fixed \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \d* \s+ \S* \n)+ $/ - do: cat.thread_pool: thread_pool_patterns: fetch* - h: id,name,type,active,size,queue,queue_size,rejected,largest,completed,min,max,keep_alive + h: id,name,type,active,pool_size,queue,queue_size,rejected,largest,completed,core,max,size,keep_alive v: true - match: $body: | - /^ id \s+ name \s+ type \s+ active \s+ size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ min \s+ max \s+ keep_alive \n - (\S+ \s+ fetch_shard_started \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \S* \n - \S+ \s+ fetch_shard_store \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \S* \n)+ $/ + /^ id \s+ name \s+ type \s+ active \s+ pool_size \s+ queue \s+ queue_size \s+ rejected \s+ largest \s+ completed \s+ core \s+ max \s+ size \s+ keep_alive \n + (\S+ \s+ fetch_shard_started \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \d* \s+ \S* \n + \S+ \s+ fetch_shard_store \s+ scaling \s+ \d+ \s+ \d+ \s+ \d+ \s+ (-1|\d+) \s+ \d+ \s+ \d+ \s+ \d+ \s+ \d* \s+ \d* \s+ \d* \s+ \S* \n)+ $/ - do: cat.thread_pool: diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index 0e0f4fe8c155d..3df270c8f6c80 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -124,14 +124,15 @@ protected Table getTableWithHeader(final RestRequest request) { table.addCell("name", "default:true;alias:n;desc:thread pool name"); table.addCell("type", "alias:t;default:false;desc:thread pool type"); table.addCell("active", "alias:a;default:true;text-align:right;desc:number of active threads"); - table.addCell("size", "alias:s;default:false;text-align:right;desc:number of threads"); + table.addCell("pool_size", "alias:psz;default:false;text-align:right;desc:number of threads"); table.addCell("queue", "alias:q;default:true;text-align:right;desc:number of tasks currently in queue"); table.addCell("queue_size", "alias:qs;default:false;text-align:right;desc:maximum number of tasks permitted in queue"); table.addCell("rejected", "alias:r;default:true;text-align:right;desc:number of rejected tasks"); table.addCell("largest", "alias:l;default:false;text-align:right;desc:highest number of seen active threads"); table.addCell("completed", "alias:c;default:false;text-align:right;desc:number of completed tasks"); - table.addCell("min", "alias:mi;default:false;text-align:right;desc:minimum number of threads"); - table.addCell("max", "alias:ma;default:false;text-align:right;desc:maximum number of threads"); + table.addCell("core", "alias:cr;default:false;text-align:right;desc:core number of threads in a scaling thread pool"); + table.addCell("max", "alias:mx;default:false;text-align:right;desc:maximum number of threads in a scaling thread pool"); + table.addCell("size", "alias:sz;default:false;text-align:right;desc:number of threads in a fixed thread pool"); table.addCell("keep_alive", "alias:ka;default:false;text-align:right;desc:thread keep alive time"); table.endHeaders(); return table; @@ -201,8 +202,9 @@ private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoR Long maxQueueSize = null; String keepAlive = null; - Integer minThreads = null; - Integer maxThreads = null; + Integer core = null; + Integer max = null; + Integer size = null; if (poolInfo != null) { if (poolInfo.getQueueSize() != null) { @@ -211,11 +213,15 @@ private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoR if (poolInfo.getKeepAlive() != null) { keepAlive = poolInfo.getKeepAlive().toString(); } - if (poolInfo.getMin() >= 0) { - minThreads = poolInfo.getMin(); - } - if (poolInfo.getMax() >= 0) { - maxThreads = poolInfo.getMax(); + + if (poolInfo.getThreadPoolType() == ThreadPool.ThreadPoolType.SCALING) { + assert poolInfo.getMin() >= 0; + core = poolInfo.getMin(); + assert poolInfo.getMax() > 0; + max = poolInfo.getMax(); + } else { + assert poolInfo.getMin() == poolInfo.getMax() && poolInfo.getMax() > 0; + size = poolInfo.getMax(); } } @@ -228,8 +234,9 @@ private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoR table.addCell(poolStats == null ? null : poolStats.getRejected()); table.addCell(poolStats == null ? null : poolStats.getLargest()); table.addCell(poolStats == null ? null : poolStats.getCompleted()); - table.addCell(minThreads); - table.addCell(maxThreads); + table.addCell(core); + table.addCell(max); + table.addCell(size); table.addCell(keepAlive); table.endRow();