## Module 2: Using ADMIN PAUSE DDL and ADMIN RESUME DDL

Some DDL jobs can take a considerable amount of time to execute and may generate significant CPU and IO workload, such as adding indexes or modifying column attributes to large tables. Using the ADMIN PAUSE/RESUME DDL command can help users to pause or resume ongoing DDL jobs, thereby preventing their prolonged execution from impacting the database workload and other maintenance activities.

### Step 1.  Connect to the TiUP control machine with two terminals

+ Open two SSH connections to your lab virtual machine, by clicking:
  + [Terminal 1](ssh://monitor1-ssh#1)
  + [Terminal 2](ssh://monitor1-ssh#2)

+ You will now have two active terminal sessions.

### Step 2. Add index to table and modify column attributes

+ Log in to the [Grafana Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000). Participants are encouraged to keep the monitoring pages open from this step and set the monitoring time range to the last 5 or 15 minutes, while changing the refresh rate to 5 seconds.

  ![70%](https://lab-static.pingcap.com/images/2025/7/26/9c787410ab425dd7eb7e7297cc46711ec63ccc22.png)

+ To monitor the CPU and IO workload on TiKV during DDL job execution, log in to [Grafana Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000), navigate to `Home`, then select `tidb-demo`, and subsequently choose `tidb-demo-TiKV-Details`. Open the `Cluster` tab, where you will find the `CPU` panel displaying the CPU usage for each TiKV node, and the `IO utilization` panel showing the IO usage for each node.

  ![70%](https://lab-static.pingcap.com/images/2025/7/26/4731b3d2183b8d351eae72b449cb547bf23f52ec.png)

+ On [Terminal 1](ssh://monitor1-ssh#1), connect to the TiDB server instance.

  ```bash
  mysql -h ${HOST_TIPROXY1_PRIVATE_IP} --port 6000 -u root
  ```

  ```output
  mysql> 
  ```

> [!TIP]
> Please note that the time interval between the commands in `Step 2` and `Step 3` should not exceed 1 minute, as this may lead to unexpected results.

+ Add an index to the table `test.ddl_test1` and modify the attributes of the `content` column. Please note: Do not wait for this command to finish.

  ```sql
  ALTER TABLE test.ddl_test1 ADD INDEX idx_content_updated_at(content, updated_at);ALTER TABLE test.ddl_test1 MODIFY `content` VARCHAR(32) DEFAULT '0000000000' COMMENT 'content';
  ```

+ Return to [Grafana Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000)，In the `Cluster` tab of `tidb-demo-TiKV-Details`, you can see that the `CPU` and `IO utilization` of each TiKV node starts to rise. This indicates that the DDL job is utilizing `CPU` and `IO` resources, which may impact the existing business workload.

  ![70%](https://lab-static.pingcap.com/images/2025/7/26/b5aaf6accffbf68dabd122ece7f53e193a16418d.png)

+ In this practice, the operation to modify the `content` column of the table `test.ddl_test1` is expected to take approximately 3 minutes, so please begin 'Step 3' within this time frame to ensure accurate results.

### Step 3. Pause DDL jobs using `ADMIN PAUSE DDL` command

+ On [Terminal 2](ssh://monitor1-ssh#2), connect to the TiDB server instance.

  ```bash
  mysql -h ${HOST_TIPROXY1_PRIVATE_IP} --port 6000 -u root
  ```

  ```output
  mysql> 
  ```

+ Use the command `ADMIN SHOW DDL JOBS` to find the `JOB_ID` of the DDL job executed in the previous step. In the example, the `JOB_ID` is `119`, `DB_NAME` is `test`, `TABLE_NAME` is `ddl_test1`, `JOB_TYPE` is `modify column`, `SCHEMA_STATE` is `write reorganization`, and `STATE` is `running`, indicating that the DDL job is currently in progress. Please note that your output may differ from the example provided.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE   | COMMENTS    |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  |    119 | test    | ddl_test1             | modify column | write reorganization |         2 |      110 |         0 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | NULL                       | running |             |
  |    118 | test    | ddl_test1             | add index     | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced  | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public               |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced  |             |
  |    115 | test    | ddl_test3             | create table  | public               |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced  |             |
  |    113 | test    | ddl_test2             | create table  | public               |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced  |             |
  |    111 | test    | ddl_test1             | create table  | public               |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced  |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public               |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced  |             |
  |    107 | mysql   | index_advisor_results | create table  | public               |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced  |             |
  |    105 | sys     | schema_unused_indexes | create view   | public               |       102 |      104 |         0 | 2025-07-26 03:22:35.722000 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.772000 | synced  |             |
  |    103 | sys     |                       | create schema | public               |       102 |        0 |         0 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.722000 | synced  |             |
  |    101 | mysql   | tidb_pitr_id_map      | create table  | public               |         1 |      100 |         0 | 2025-07-26 03:22:35.622000 | 2025-07-26 03:22:35.622000 | 2025-07-26 03:22:35.673000 | synced  |             |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  11 rows in set (0.01 sec)
  ```

+ Use the command `ADMIN PAUSE DDL JOBS` along with the `JOB_ID` of the DDL job executed in the previous step to pause it. Please note that the `JOB_ID` in the code below needs to be specified according to the your environment and may not be `119`.

  ```sql
  ADMIN PAUSE DDL JOBS 119;
  ```

  ```output
  +--------+------------+
  | JOB_ID | RESULT     |
  +--------+------------+
  | 119    | successful |
  +--------+------------+
  1 row in set (0.01 sec)
  ```

+ Use the command `ADMIN SHOW DDL JOBS` to check the status of the DDL job. In the example, the `JOB_ID` is `119`, and `STATE` is `pausing`, indicating that it has been paused. Please note that your output may differ from the example provided.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE   | COMMENTS    |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  |    119 | test    | ddl_test1             | modify column | write reorganization |         2 |      110 |         0 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | NULL                       | pausing |             |
  |    118 | test    | ddl_test1             | add index     | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced  | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public               |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced  |             |
  |    115 | test    | ddl_test3             | create table  | public               |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced  |             |
  |    113 | test    | ddl_test2             | create table  | public               |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced  |             |
  |    111 | test    | ddl_test1             | create table  | public               |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced  |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public               |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced  |             |
  |    107 | mysql   | index_advisor_results | create table  | public               |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced  |             |
  |    105 | sys     | schema_unused_indexes | create view   | public               |       102 |      104 |         0 | 2025-07-26 03:22:35.722000 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.772000 | synced  |             |
  |    103 | sys     |                       | create schema | public               |       102 |        0 |         0 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.722000 | synced  |             |
  |    101 | mysql   | tidb_pitr_id_map      | create table  | public               |         1 |      100 |         0 | 2025-07-26 03:22:35.622000 | 2025-07-26 03:22:35.622000 | 2025-07-26 03:22:35.673000 | synced  |             |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  11 rows in set (0.00 sec)
  ```

+ Return to [Grafana Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000), in the `Cluster` tab of `tidb-demo-TiKV-Details`, you can see that the `CPU` and `IO utilization` of each TiKV node starts to decline.

  ![70%](https://lab-static.pingcap.com/images/2025/7/26/dee7ff1ce503ddbf13526726bcae55df17df956d.png)

### Step 4. Resume DDL jobs using `ADMIN RESUME DDL` command

+ On [Terminal 2](ssh://monitor1-ssh#2), connect to the TiDB server instance.

  ```bash
  mysql -h ${HOST_TIPROXY1_PRIVATE_IP} --port 6000 -u root
  ```

  ```output
  mysql> 
  ```

+ Use the command `ADMIN RESUME DDL JOBS` along with the `JOB_ID` of the DDL job that was paused in the previous step to resume it. Please note that the `JOB_ID` in the command below needs to be specified according to your environment and may not be `119`.

  ```sql
  ADMIN RESUME DDL JOBS 119;
  ```

  ```output
  +--------+------------+
  | JOB_ID | RESULT     |
  +--------+------------+
  | 119    | successful |
  +--------+------------+
  1 row in set (0.01 sec)
  ```

+ Use the command `ADMIN SHOW DDL JOBS` to check the status of the DDL job. In the output, the `JOB_ID` is `119`, and `STATE` is `queueing`, indicating that it has resumed running. Please note that your output may differ from the example provided. Wait for the DDL job to complete.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+----------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE    | COMMENTS    |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+----------+-------------+
  |    119 | test    | ddl_test1             | modify column | write reorganization |         2 |      110 |         0 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | NULL                       | queueing |             |
  |    118 | test    | ddl_test1             | add index     | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced   | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public               |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced   |             |
  |    115 | test    | ddl_test3             | create table  | public               |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced   |             |
  |    113 | test    | ddl_test2             | create table  | public               |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced   |             |
  |    111 | test    | ddl_test1             | create table  | public               |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced   |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public               |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced   |             |
  |    107 | mysql   | index_advisor_results | create table  | public               |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced   |             |
  |    105 | sys     | schema_unused_indexes | create view   | public               |       102 |      104 |         0 | 2025-07-26 03:22:35.722000 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.772000 | synced   |             |
  |    103 | sys     |                       | create schema | public               |       102 |        0 |         0 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.722000 | synced   |             |
  |    101 | mysql   | tidb_pitr_id_map      | create table  | public               |         1 |      100 |         0 | 2025-07-26 03:22:35.622000 | 2025-07-26 03:22:35.622000 | 2025-07-26 03:22:35.673000 | synced   |             |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+----------+-------------+
  11 rows in set (0.02 sec)
  ```

+ Return to [Grafana Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000), in the `Cluster` tab of `tidb-demo-TiKV-Details`, you can see that the `CPU` and `IO utilization` of each TiKV node starts to rise.

  ![70%](https://lab-static.pingcap.com/images/2025/7/26/bf4c1b298d4d416169b0758365a7ec5023c0fcf2.png)

### Step 5. Wait for the DDL job to complete

+ On [Terminal 1](ssh://monitor1-ssh#1), wait for the DDL job to complete.

  ```output
  Query OK, 0 rows affected (12.02 sec)

  Query OK, 0 rows affected (4 min 42.02 sec)
  ```

+ On [Terminal 2](ssh://monitor1-ssh#2), use the command `ADMIN SHOW DDL JOBS` to check the status of the DDL job. In the example, the `JOB_ID` is `119`, and `STATE` is `synced`, indicating that it has completed execution. Please note that your output may differ from the example provided.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+--------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE  | COMMENTS    |
  +--------+---------+-----------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+--------+-------------+
  |    119 | test    | ddl_test1             | modify column | public       |         2 |      110 |   4194304 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | 2025-07-26 04:25:44.122000 | synced |             |
  |    118 | test    | ddl_test1             | add index     | public       |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public       |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced |             |
  |    115 | test    | ddl_test3             | create table  | public       |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced |             |
  |    113 | test    | ddl_test2             | create table  | public       |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced |             |
  |    111 | test    | ddl_test1             | create table  | public       |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public       |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced |             |
  |    107 | mysql   | index_advisor_results | create table  | public       |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced |             |
  |    105 | sys     | schema_unused_indexes | create view   | public       |       102 |      104 |         0 | 2025-07-26 03:22:35.722000 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.772000 | synced |             |
  |    103 | sys     |                       | create schema | public       |       102 |        0 |         0 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.673000 | 2025-07-26 03:22:35.722000 | synced |             |
  +--------+---------+-----------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+--------+-------------+
  10 rows in set (0.00 sec)
  ```

+ Return to [Grafana Dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000), in the `Cluster` tab of `tidb-demo-TiKV-Details`, you can see that the `CPU` and `IO utilization` of each TiKV node starts to decline.

  ![70%](https://lab-static.pingcap.com/images/2025/7/26/c9b18218778b0185dc6275b6938ca41b30d9a8b6.png)

+ Use the command `ADMIN PAUSE DDL JOBS` along with the `JOB_ID` of the DDL job to pause the DDL job executed in the previous step again. You may encounter the error `error: [ddl:8224] DDL Job:119 not found`. Please note that your output may differ from the example provided.

  ```sql
  ADMIN PAUSE DDL JOBS 119;
  ```

  ```output
  +--------+----------------------------------------+
  | JOB_ID | RESULT                                 |
  +--------+----------------------------------------+
  | 119    | error: [ddl:8224]DDL Job:119 not found |
  +--------+----------------------------------------+
  1 row in set (0.00 sec)
  ```

### Step 6. Cancel DDL jobs using ADMIN CANCEL DDL command

> [!TIP]
> Please be aware that the time interval between executing each command in this step should not exceed 1 minute, as this may lead to unexpected results.

+ On [Terminal 1](ssh://monitor1-ssh#1), add index to table `test.ddl_test2` and modify column attributes. Please note: Do not wait for this command to finish.

  ```sql
  ALTER TABLE test.ddl_test2 ADD INDEX idx_content_updated_at(content, updated_at);ALTER TABLE test.ddl_test2 MODIFY `content` VARCHAR(32) DEFAULT '0000000000' COMMENT 'content';
  ```

+ 在[Terminal 2](ssh://monitor1-ssh#2) 上，Use the command `ADMIN SHOW DDL JOBS` to check the status of the DDL job that has just started executing. In the example, the `JOB_ID` is `121`, and `STATE` is `running`, indicating that it is currently in progress. Please note that your output may differ from the example provided.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE   | COMMENTS    |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  |    121 | test    | ddl_test2             | modify column | write reorganization |         2 |      112 |         0 | 2025-07-26 04:47:03.372000 | 2025-07-26 04:47:03.423000 | NULL                       | running |             |
  |    120 | test    | ddl_test2             | add index     | public               |         2 |      112 |   4194304 | 2025-07-26 04:46:38.423000 | 2025-07-26 04:46:38.472000 | 2025-07-26 04:46:49.472000 | synced  | ingest, DXF |
  |    119 | test    | ddl_test1             | modify column | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | 2025-07-26 04:25:44.122000 | synced  |             |
  |    118 | test    | ddl_test1             | add index     | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced  | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public               |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced  |             |
  |    115 | test    | ddl_test3             | create table  | public               |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced  |             |
  |    113 | test    | ddl_test2             | create table  | public               |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced  |             |
  |    111 | test    | ddl_test1             | create table  | public               |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced  |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public               |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced  |             |
  |    107 | mysql   | index_advisor_results | create table  | public               |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced  |             |
  |    105 | sys     | schema_unused_indexes | create view   | public               |       102 |      104 |         0 | 2025-07-26 03:22:35.722000 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.772000 | synced  |             |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------+-------------+
  11 rows in set (0.01 sec)
  ```

+ On [Terminal 2](ssh://monitor1-ssh#2), use the command `ADMIN CANCEL DDL JOBS` to cancel the DDL job that has just started executing. Please note that your `JOB_ID` may differ from the example provided.

  ```sql
  ADMIN CANCEL DDL JOBS 121;
  ```

  ```output
  +--------+------------+
  | JOB_ID | RESULT     |
  +--------+------------+
  | 121    | successful |
  +--------+------------+
  1 row in set (0.01 sec)
  ```

+ On [Terminal 2](ssh://monitor1-ssh#2), use the command `ADMIN SHOW DDL JOBS` to check the status of the DDL job that has just been canceled. In the example, the `JOB_ID` is `121`, and `STATE` is `cancelling`, indicating that it is in the process of being canceled. Please note that your output may differ from the example provided.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+------------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE         | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE      | COMMENTS    |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+------------+-------------+
  |    121 | test    | ddl_test2             | modify column | write reorganization |         2 |      112 |         0 | 2025-07-26 04:47:03.372000 | 2025-07-26 04:47:03.423000 | NULL                       | cancelling |             |
  |    120 | test    | ddl_test2             | add index     | public               |         2 |      112 |   4194304 | 2025-07-26 04:46:38.423000 | 2025-07-26 04:46:38.472000 | 2025-07-26 04:46:49.472000 | synced     | ingest, DXF |
  |    119 | test    | ddl_test1             | modify column | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | 2025-07-26 04:25:44.122000 | synced     |             |
  |    118 | test    | ddl_test1             | add index     | public               |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced     | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public               |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced     |             |
  |    115 | test    | ddl_test3             | create table  | public               |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced     |             |
  |    113 | test    | ddl_test2             | create table  | public               |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced     |             |
  |    111 | test    | ddl_test1             | create table  | public               |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced     |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public               |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced     |             |
  |    107 | mysql   | index_advisor_results | create table  | public               |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced     |             |
  |    105 | sys     | schema_unused_indexes | create view   | public               |       102 |      104 |         0 | 2025-07-26 03:22:35.722000 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.772000 | synced     |             |
  +--------+---------+-----------------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+------------+-------------+
  11 rows in set (0.01 sec)
  ```

+ On [Terminal 2](ssh://monitor1-ssh#2), wait for 1 minute and repeatedly execute the command `ADMIN SHOW DDL JOBS` to check the status of the DDL job that has just been canceled. In the example, the `JOB_ID` is `121`, and `STATE` is `rollback done`, indicating that the job has been successfully canceled. Please note that your output may differ from the example provided.

  ```sql
  ADMIN SHOW DDL JOBS;
  ```

  ```output
  +--------+---------+-----------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  | JOB_ID | DB_NAME | TABLE_NAME            | JOB_TYPE      | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME                | START_TIME                 | END_TIME                   | STATE         | COMMENTS    |
  +--------+---------+-----------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  |    121 | test    | ddl_test2             | modify column | none         |         2 |      112 |         0 | 2025-07-26 04:47:03.372000 | 2025-07-26 04:47:03.423000 | 2025-07-26 04:48:39.472000 | rollback done |             |
  |    120 | test    | ddl_test2             | add index     | public       |         2 |      112 |   4194304 | 2025-07-26 04:46:38.423000 | 2025-07-26 04:46:38.472000 | 2025-07-26 04:46:49.472000 | synced        | ingest, DXF |
  |    119 | test    | ddl_test1             | modify column | public       |         2 |      110 |   4194304 | 2025-07-26 04:01:29.723000 | 2025-07-26 04:01:29.772000 | 2025-07-26 04:25:44.122000 | synced        |             |
  |    118 | test    | ddl_test1             | add index     | public       |         2 |      110 |   4194304 | 2025-07-26 04:01:10.173000 | 2025-07-26 04:01:10.222000 | 2025-07-26 04:01:21.222000 | synced        | ingest, DXF |
  |    117 | test    | ddl_test4             | create table  | public       |         2 |      116 |         0 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.423000 | 2025-07-26 03:28:36.473000 | synced        |             |
  |    115 | test    | ddl_test3             | create table  | public       |         2 |      114 |         0 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.423000 | 2025-07-26 03:28:35.423000 | synced        |             |
  |    113 | test    | ddl_test2             | create table  | public       |         2 |      112 |         0 | 2025-07-26 03:28:35.322000 | 2025-07-26 03:28:35.373000 | 2025-07-26 03:28:35.373000 | synced        |             |
  |    111 | test    | ddl_test1             | create table  | public       |         2 |      110 |         0 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.272000 | 2025-07-26 03:28:35.322000 | synced        |             |
  |    109 | mysql   | tidb_kernel_options   | create table  | public       |         1 |      108 |         0 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | 2025-07-26 03:22:35.872000 | synced        |             |
  |    107 | mysql   | index_advisor_results | create table  | public       |         1 |      106 |         0 | 2025-07-26 03:22:35.772000 | 2025-07-26 03:22:35.823000 | 2025-07-26 03:22:35.823000 | synced        |             |
  +--------+---------+-----------------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  10 rows in set (0.01 sec)
  ```

+ On [Terminal 1](ssh://monitor1-ssh#1), you can find that the DDL operation to modify the `content` column attributes of the table `test.ddl_test2` has been canceled and cannot be restored.

  ```output
  Query OK, 0 rows affected (10.47 sec)

  ERROR 8214 (HY000): Cancelled DDL job
  ```

+ This is the end of Module 2.
