pingcap / pingcap/tidb

`show analyze status` not show the running jobs

Open
#48,822 0 comments 0 reactions 1 assignee Claimed by @hawkingrei View on GitHub
component/statistics severity/moderate sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
1. analyze some tables

### 2. What did you expect to see? (Required)
show analyze can show enough jobs
### 3. What did you see instead (Required)
All of show analyze status return jobs are finished state, but acctlly there are some running jobs can not show
```sql
[11:54:52]TiDB root:db0ios> select * from mysql.analyze_jobs where state = "running"
+------+---------------------+--------------+------------+----------------+-------------------------------------------------+----------------+---------------------+----------+---------+-------------+-----------------------------------------------------------------------------+------------+
| id | update_time | table_schema | table_name | partition_name | job_info | processed_rows | start_time | end_time | state | fail_reason | instance | process_id |
+------+---------------------+--------------+------------+----------------+-------------------------------------------------+----------------+---------------------+----------+---------+-------------+-----------------------------------------------------------------------------+------------+
| 8494 | 2023-11-21 21:06:14 | db0ios | table0ios | | merge global stats for db0ios.table0ios columns | 0 | 2023-11-21 21:06:14 | | running | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | 3116371600 |
+------+---------------------+--------------+------------+----------------+-------------------------------------------------+----------------+---------------------+----------+---------+-------------+-----------------------------------------------------------------------------+------------+
1 row in set
Time: 0.071s
[11:55:04]TiDB root:db0ios> show analyze status where state = "running";
+--------------+------------+----------------+----------+----------------+------------+----------+-------+-------------+----------+------------+-------------------+----------+----------------------+
| Table_schema | Table_name | Partition_name | Job_info | Processed_rows | Start_time | End_time | State | Fail_reason | Instance | Process_ID | Remaining_seconds | Progress | Estimated_total_rows |
+--------------+------------+----------------+----------+----------------+------------+----------+-------+-------------+----------+------------+-------------------+----------+----------------------+
+--------------+------------+----------------+----------+----------------+------------+----------+-------+-------------+----------+------------+-------------------+----------+----------------------+
0 rows in set
Time: 0.066s
[12:00:09]TiDB root:db0ios> show analyze status;
+--------------+------------+----------------+---------------------------------------------------------------------------------------------+----------------+---------------------+---------------------+----------+-------------+-----------------------------------------------------------------------------+------------+-------------------+----------+----------------------+
| Table_schema | Table_name | Partition_name | Job_info | Processed_rows | Start_time | End_time | State | Fail_reason | Instance | Process_ID | Remaining_seconds | Progress | Estimated_total_rows |
+--------------+------------+----------------+---------------------------------------------------------------------------------------------+----------------+---------------------+---------------------+----------+-------------+-----------------------------------------------------------------------------+------------+-------------------+----------+----------------------+
| tpcc | district | | auto analyze table all columns with 256 buckets, 500 topn, 0.007728488512194344 samplerate | 10000 | 2023-11-23 11:29:32 | 2023-11-23 11:29:33 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | warehouse | | auto analyze table all columns with 256 buckets, 500 topn, 0.006793810566821204 samplerate | 1000 | 2023-11-23 11:29:29 | 2023-11-23 11:29:30 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | district | | auto analyze table all columns with 256 buckets, 500 topn, 0.007719173583217735 samplerate | 10000 | 2023-11-23 11:28:32 | 2023-11-23 11:28:33 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | warehouse | | auto analyze table all columns with 256 buckets, 500 topn, 0.006760641080043962 samplerate | 1000 | 2023-11-23 11:28:29 | 2023-11-23 11:28:30 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | district | | auto analyze table all columns with 256 buckets, 500 topn, 0.007722704653861427 samplerate | 10000 | 2023-11-23 11:27:32 | 2023-11-23 11:27:33 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | warehouse | | auto analyze table all columns with 256 buckets, 500 topn, 0.006768807673625783 samplerate | 1000 | 2023-11-23 11:27:29 | 2023-11-23 11:27:30 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | district | | auto analyze table all columns with 256 buckets, 500 topn, 0.0077222784489896406 samplerate | 10000 | 2023-11-23 11:26:29 | 2023-11-23 11:26:30 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | warehouse | | auto analyze table all columns with 256 buckets, 500 topn, 0.006768807673625783 samplerate | 1000 | 2023-11-23 11:26:26 | 2023-11-23 11:26:27 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
...
-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | warehouse | | auto analyze table all columns with 256 buckets, 500 topn, 0.006774914136996532 samplerate | 1000 | 2023-11-23 11:16:29 | 2023-11-23 11:16:30 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | district | | auto analyze table all columns with 256 buckets, 500 topn, 0.007706328467763041 samplerate | 10000 | 2023-11-23 11:15:29 | 2023-11-23 11:15:30 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
| tpcc | warehouse | | auto analyze table all columns with 256 buckets, 500 topn, 0.006766520052717506 samplerate | 1000 | 2023-11-23 11:15:26 | 2023-11-23 11:15:27 | finished | | tc-tidb-0.tc-tidb-peer.partition-analyze-test-10w-tps-4620753-1-86.svc:4000 | | | | |
+--------------+------------+----------------+---------------------------------------------------------------------------------------------+----------------+---------------------+---------------------+----------+-------------+-----------------------------------------------------------------------------+------------+-------------------+----------+----------------------+
30 rows in set
```
### 4. What is your TiDB version? (Required)
v7.5.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.