title | summary |
---|---|
CANCEL TRAFFIC JOBS |
An overview of the usage of CANCEL TRAFFIC JOBS for the TiDB database. |
TiDB v9.0.0 introduces the CANCEL TRAFFIC JOBS
syntax, which is used to cancel all traffic capture or replay jobs being executed by TiProxy in the cluster. This operation requires the following privileges:
- To cancel traffic capture jobs, you need the
SUPER
orTRAFFIC_CAPTURE_ADMIN
privilege. - To cancel traffic replay jobs, you need the
SUPER
orTRAFFIC_REPLAY_ADMIN
privilege.
TrafficStmt ::=
"CANCEL" "TRAFFIC" "JOBS"
Assume that there are currently two TiProxy instances capturing traffic:
SHOW TRAFFIC JOBS;
+----------------------------+----------+----------------+---------+----------+---------+-------------+----------------------------------------------------------------------------+
| START_TIME | END_TIME | INSTANCE | TYPE | PROGRESS | STATUS | FAIL_REASON | PARAMS |
+----------------------------+----------+----------------+---------+----------+---------+-------------+----------------------------------------------------------------------------+
| 2024-12-17 10:54:41.000000 | | 10.1.0.10:3080 | capture | 45% | running | | OUTPUT="/tmp/traffic", DURATION="90m", COMPRESS=true, ENCRYPTION_METHOD="" |
| 2024-12-17 10:54:41.000000 | | 10.1.0.11:3080 | capture | 45% | running | | OUTPUT="/tmp/traffic", DURATION="90m", COMPRESS=true, ENCRYPTION_METHOD="" |
+----------------------------+----------+----------------+---------+----------+---------+-------------+----------------------------------------------------------------------------+
2 rows in set (0.01 sec)
Cancel the current jobs:
CANCEL TRAFFIC JOBS;
Query OK, 0 rows affected (0.13 sec)
Check the jobs again and it shows that the jobs have been canceled:
SHOW TRAFFIC JOBS;
+----------------------------+----------------------------+----------------+---------+----------+----------+------------------+----------------------------------------------------------------------------+
| START_TIME | END_TIME | INSTANCE | TYPE | PROGRESS | STATUS | FAIL_REASON | PARAMS |
+----------------------------+----------------------------+----------------+---------+----------+----------+------------------+----------------------------------------------------------------------------+
| 2024-12-17 10:54:41.000000 | 2024-12-17 11:34:42.000000 | 10.1.0.10:3080 | capture | 45% | canceled | manually stopped | OUTPUT="/tmp/traffic", DURATION="90m", COMPRESS=true, ENCRYPTION_METHOD="" |
| 2024-12-17 10:54:41.000000 | 2024-12-17 11:34:42.000000 | 10.1.0.11:3080 | capture | 45% | canceled | manually stopped | OUTPUT="/tmp/traffic", DURATION="90m", COMPRESS=true, ENCRYPTION_METHOD="" |
+----------------------------+----------------------------+----------------+---------+----------+----------+------------------+----------------------------------------------------------------------------+
2 rows in set (0.01 sec)
This statement is a TiDB extension to MySQL syntax.