pingcap/tidb

admin show ddl jobs output confusing with multiple jobs

Open

#23,494 opened on Mar 24, 2021

View on GitHub
 (4 comments) (0 reactions) (1 assignee)Go (6,186 forks)batch import
help wantedsig/sql-infratype/feature-request

Repository metrics

Stars
 (40,090 stars)
PR merge metrics
 (Avg merge 14d 4h) (346 merged PRs in 30d)

Description

Feature Request

Is your feature request related to a problem? Please describe:

Describe the feature you'd like:

I have 10 tables all trying to add an index concurrently (via sysbench):

mysql> show processlist;
+------+------+-----------+--------+---------+------+------------+--------------------------------+
| Id   | User | Host      | db     | Command | Time | State      | Info                           |
+------+------+-----------+--------+---------+------+------------+--------------------------------+
|   17 | root | localhost | sbtest | Query   |  672 | autocommit | CREATE INDEX k_9 ON sbtest9(k) |
|   19 | root | localhost | sbtest | Query   |  671 | autocommit | CREATE INDEX k_2 ON sbtest2(k) |
|   15 | root | localhost | sbtest | Query   |  672 | autocommit | CREATE INDEX k_8 ON sbtest8(k) |
|   23 | root | localhost | sbtest | Query   |  672 | autocommit | CREATE INDEX k_4 ON sbtest4(k) |
|   39 | root | localhost | NULL   | Query   |    0 | autocommit | show processlist               |
+------+------+-----------+--------+---------+------+------------+--------------------------------+
5 rows in set (0.00 sec)

mysql> admin show ddl jobs;
+--------+---------+------------+--------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE     | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | START_TIME          | END_TIME            | STATE   |
+--------+---------+------------+--------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------+
|     79 | sbtest  | sbtest9    | add index    | write reorganization |        51 |       64 |    591104 | 2021-03-23 19:44:28 | NULL                | running |
|     80 | sbtest  | sbtest4    | add index    | none                 |        51 |       62 |         0 | 2021-03-23 19:44:28 | NULL                | none    |
|     81 | sbtest  | sbtest8    | add index    | none                 |        51 |       61 |         0 | 2021-03-23 19:44:29 | NULL                | none    |
|     82 | sbtest  | sbtest2    | add index    | none                 |        51 |       58 |         0 | 2021-03-23 19:44:29 | NULL                | none    |
|     78 | sbtest  | sbtest3    | add index    | public               |        51 |       57 |   1000001 | 2021-03-23 19:44:28 | 2021-03-23 19:55:14 | synced  |
|     77 | sbtest  | sbtest7    | add index    | public               |        51 |       60 |   1000001 | 2021-03-23 19:44:28 | 2021-03-23 19:53:28 | synced  |
|     76 | sbtest  | sbtest6    | add index    | public               |        51 |       56 |   1000001 | 2021-03-23 19:44:28 | 2021-03-23 19:51:40 | synced  |
|     75 | sbtest  | sbtest5    | add index    | public               |        51 |       59 |   1000001 | 2021-03-23 19:44:28 | 2021-03-23 19:49:54 | synced  |
|     74 | sbtest  | sbtest1    | add index    | public               |        51 |       55 |   1000001 | 2021-03-23 19:44:26 | 2021-03-23 19:48:33 | synced  |
|     73 | sbtest  | sbtest10   | add index    | public               |        51 |       53 |   1000001 | 2021-03-23 19:44:24 | 2021-03-23 19:46:29 | synced  |
|     72 | sbtest  | sbtest9    | create table | public               |        51 |       64 |         0 | 2021-03-23 19:42:46 | 2021-03-23 19:42:47 | synced  |
|     71 | sbtest  | sbtest4    | create table | public               |        51 |       62 |         0 | 2021-03-23 19:42:46 | 2021-03-23 19:42:47 | synced  |
|     70 | sbtest  | sbtest8    | create table | public               |        51 |       61 |         0 | 2021-03-23 19:42:46 | 2021-03-23 19:42:47 | synced  |
|     69 | sbtest  | sbtest7    | create table | public               |        51 |       60 |         0 | 2021-03-23 19:42:46 | 2021-03-23 19:42:47 | synced  |
+--------+---------+------------+--------------+----------------------+-----------+----------+-----------+---------------------+---------------------+---------+
14 rows in set (0.00 sec)

There are two confusing parts to this output:

  • START_TIME is the time the job was first created, not the time it actually started (because of queueing).
  • The STATE of none for the queued jobs would be easier to understand if it said "queueing" or "blocked".

Describe alternatives you've considered:

These are not technically bugs. They should in theory be improved when concurrent DDL is possible, but even with concurrent I expect there will be some maximum concurrency and hence improving still helps.

Teachability, Documentation, Adoption, Migration Strategy:

N/A

Contributor guide