## モジュール 4: ADMIN PAUSE DDL を使用して、DDL タスクがデータベースの負荷に与える影響を回避します

### 手順 1. TiUP コントロールマシンに4つのターミナルで接続します

+ 以下のリンクをクリックして、演習用仮想マシンへの4つのSSH接続を開きます：
  + [ターミナル 1](ssh://monitor1-ssh#1)
  + [ターミナル 2](ssh://monitor1-ssh#2)
  + [ターミナル 3](ssh://monitor1-ssh#3)
  + [ターミナル 4](ssh://monitor1-ssh#4)

+ これで4つのアクティブなターミナルセッションが開かれます。

### 手順 2. `tiup bench` を使用して負荷を開始します

+ [ターミナル 1](ssh://monitor1-ssh#1) で、`tiup bench` を使用して、20 のセッションが同時にデータベースの 4 つの WAREHOUSE のデータにアクセスするシミュレーションを行い、持続時間は 15 分です。TiDB に対する TPC-C テストの方法については、以下をご参照ください：<https://docs.pingcap.com/ja/tidb/stable/benchmark-tidb-using-tpcc/>

> [!TIP]
> `手順 2` が開始された後は、15 分以内に `手順 4` の前の内容を完了してください。そうしないと、正確な結果が得られませんので注意してください。

  ```bash
  export PATH="$PATH:/home/ec2-user/.tiup/bin"
  tiup bench tpcc -H ${HOST_DB1_PRIVATE_IP},${HOST_DB2_PRIVATE_IP} -P 4000 -D tpcc --warehouses 4 --threads 20 --time 15m run
  ```

  ```output
  [Current] DELIVERY - Takes(s): 9.8, Count: 213, TPM: 1306.6, Sum(ms): 18520.5, Avg(ms): 87.0, 50th(ms): 79.7, 90th(ms): 134.2, 95th(ms): 151.0, 99th(ms): 243.3, 99.9th(ms): 302.0, Max(ms): 302.0
  [Current] NEW_ORDER - Takes(s): 9.8, Count: 2256, TPM: 13760.7, Sum(ms): 79851.6, Avg(ms): 35.4, 50th(ms): 29.4, 90th(ms): 62.9, 95th(ms): 79.7, 99th(ms): 109.1, 99.9th(ms): 151.0, Max(ms): 167.8
  [Current] ORDER_STATUS - Takes(s): 9.8, Count: 188, TPM: 1148.2, Sum(ms): 1647.7, Avg(ms): 8.8, 50th(ms): 7.9, 90th(ms): 13.6, 95th(ms): 16.3, 99th(ms): 24.1, 99.9th(ms): 24.1, Max(ms): 24.1
  [Current] PAYMENT - Takes(s): 9.9, Count: 2080, TPM: 12643.3, Sum(ms): 90919.6, Avg(ms): 43.7, 50th(ms): 37.7, 90th(ms): 88.1, 95th(ms): 104.9, 99th(ms): 142.6, 99.9th(ms): 167.8, Max(ms): 184.5
  [Current] STOCK_LEVEL - Takes(s): 9.7, Count: 183, TPM: 1130.6, Sum(ms): 4273.2, Avg(ms): 23.3, 50th(ms): 14.2, 90th(ms): 46.1, 95th(ms): 75.5, 99th(ms): 159.4, 99.9th(ms): 176.2, Max(ms): 176.2
  [Current] DELIVERY - Takes(s): 10.0, Count: 234, TPM: 1408.4, Sum(ms): 20728.7, Avg(ms): 88.6, 50th(ms): 71.3, 90th(ms): 142.6, 95th(ms): 167.8, 99th(ms): 285.2, 99.9th(ms): 335.5, Max(ms): 335.5
  ...
  ```

+ [Grafana dashbaord](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000)にログインし、受講者にはこの手順で開いているdashboardページを保持し、監視の時間範囲を最近5分または15分に設定し、更新頻度を5秒に変更することをお勧めします。

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

+ [Grafana dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000) で、`Home`に入り、次に`tidb-demo`を選択し、続いて`tidb-demo-TiDB-Summary`を選択します。`Query Summary`タブを開くと、その下にある`Duration`パネルはクライアントのネットワーク要求が TiDB に送信されてから、TiDB が要求を実行した後にクライアントに返されるまでの時間を示し、`Command Per Second`パネルにはコマンド実行結果の成功または失敗に応じて分類される、TiDBによって1秒あたりに処理されるコマンドの数です。`Duration` パネルおよび `Command Per Second` パネルを通じて、現在のデータベースの負荷が DDL タスクの影響を受けているかどうかを確認することができます。

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

+ 2 分間待つと、データベースの負荷処理時間が安定していることが確認でき、次のステップに進むことができます。

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

### 手順 3. テーブルにインデックスを追加し、列の属性を変更します

+ [ターミナル 2](ssh://monitor1-ssh#2)で、TiDBサーバーインスタンスに接続します。

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

  ```output
  mysql> 
  ```

+ テーブル `test.ddl_test3` にインデックスを追加し、`content` 列の属性を変更します。注意: コマンドが完了するまで待たないでください。

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

+ [ターミナル 3](ssh://monitor1-ssh#3)で、TiDBサーバーインスタンスに接続します。

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

  ```output
  mysql> 
  ```

+ テーブル `test.ddl_test4` にインデックスを追加し、`content` 列の属性を変更します。注意: コマンドが完了するまで待たないでください。本演習において、テーブル `test.ddl_test3` およびテーブル `test.ddl_test4` の `content` 列の属性を変更する操作は、約 4 分間かかりますので、4 分以内に `手順 4` を開始してください。そうしないと、正しい結果が得られない可能性があります。

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

+ 再度[Grafana dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000)に戻り、`tidb-demo-TiDB-Summary` の `Query Summary` タブでは、`Duration`が上昇し始めていることが確認でき、`Command Per Second` が下降し始めていることが確認できます。これは、データベースの負荷が DDL タスクの影響を受けており、ユーザー体験が低下する可能性があります。

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

### 手順 4. ADMIN PAUSE DDL を使用してDDLタスクを一時停止します

+ [ターミナル 4](ssh://monitor1-ssh#4)で、TiDBサーバーインスタンスに接続します。

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

  ```output
  mysql> 
  ```

+ コマンド `ADMIN SHOW DDL JOBS` を使用して、前の手順で実行されたDDLタスクの `JOB_ID` を見つけます。例では `JOB_ID` は `175` と `176`、`STATE` は `running` と `running` となり、該当するDDLタスクが実行中であることを示しています。なお、出力は例と異なる場合がありますので注意してください。

  ```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    |
  +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  |    175 | test    | ddl_test3  | modify column | write reorganization |         2 |      114 |         0 | 2025-07-27 04:44:56.336000 | 2025-07-27 04:44:56.386000 | NULL                       | running       |             |
  |    176 | test    | ddl_test4  | add index     | none                 |         2 |      116 |         0 | 2025-07-27 04:45:08.285000 | NULL                       | NULL                       | queueing      |             |
  |    174 | test    | ddl_test3  | add index     | public               |         2 |      114 |   4194304 | 2025-07-27 04:44:35.936000 | 2025-07-27 04:44:35.985000 | 2025-07-27 04:44:49.036000 | synced        | ingest, DXF |
  |    173 | test    | ddl_test2  | modify column | none                 |         2 |      112 |         0 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:36:30.036000 | rollback done |             |
  |    172 | test    | ddl_test2  | add index     | public               |         2 |      112 |   4194304 | 2025-07-27 04:34:35.636000 | 2025-07-27 04:34:35.685000 | 2025-07-27 04:34:45.486000 | synced        | ingest, DXF |
  |    171 | test    | ddl_test1  | modify column | public               |         2 |      110 |   4194304 | 2025-07-27 04:25:52.786000 | 2025-07-27 04:25:52.835000 | 2025-07-27 04:33:03.786000 | synced        |             |
  |    170 | test    | ddl_test1  | add index     | public               |         2 |      110 |   4194304 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:51.086000 | synced        | ingest, DXF |
  |    169 | tpcc    | item       | create table  | public               |       118 |      168 |         0 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.135000 | synced        |             |
  |    167 | tpcc    | stock      | create table  | public               |       118 |      162 |         0 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.636000 | synced        |             |
  |    161 | tpcc    | order_line | create table  | public               |       118 |      156 |         0 | 2025-07-27 04:22:39.036000 | 2025-07-27 04:22:39.086000 | 2025-07-27 04:22:39.086000 | synced        |             |
  |    155 | tpcc    | orders     | create table  | public               |       118 |      150 |         0 | 2025-07-27 04:22:38.536000 | 2025-07-27 04:22:38.536000 | 2025-07-27 04:22:38.585000 | synced        |             |
  |    149 | tpcc    | new_order  | create table  | public               |       118 |      144 |         0 | 2025-07-27 04:22:38.036000 | 2025-07-27 04:22:38.036000 | 2025-07-27 04:22:38.086000 | synced        |             |
  +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  12 rows in set (0.02 sec)
  ```

+ コマンド `ADMIN PAUSE DDL JOBS` とDDLタスクの `JOB_ID` を使用して、前のステップで実行されたDDLタスクを一時停止します。なお、以下のコード内の `JOB_ID` は受講者自身の環境に応じて指定する必要があり、`175` と `176` でない場合もありますので注意してください。

  ```sql
  ADMIN PAUSE DDL JOBS 175,176;
  ```

  ```output
  +--------+------------+
  | JOB_ID | RESULT     |
  +--------+------------+
  | 175    | successful |
  | 176    | successful |
  +--------+------------+
  2 rows in set (0.01 sec)
  ```

+ コマンド `ADMIN SHOW DDL JOBS` を使用してDDLタスクの状態を確認します。例では `JOB_ID` は `175` と `176`、`STATE` は `pausing` と `pausing` となり、既に一時停止していることを示しています。出力は例と異なる場合がありますので注意してください。

  ```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    |
  +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  |    175 | test    | ddl_test3  | modify column | write reorganization |         2 |      114 |         0 | 2025-07-27 04:44:56.336000 | 2025-07-27 04:44:56.386000 | NULL                       | pausing       |             |
  |    176 | test    | ddl_test4  | add index     | none                 |         2 |      116 |         0 | 2025-07-27 04:45:08.285000 | NULL                       | NULL                       | pausing       |             |
  |    174 | test    | ddl_test3  | add index     | public               |         2 |      114 |   4194304 | 2025-07-27 04:44:35.936000 | 2025-07-27 04:44:35.985000 | 2025-07-27 04:44:49.036000 | synced        | ingest, DXF |
  |    173 | test    | ddl_test2  | modify column | none                 |         2 |      112 |         0 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:36:30.036000 | rollback done |             |
  |    172 | test    | ddl_test2  | add index     | public               |         2 |      112 |   4194304 | 2025-07-27 04:34:35.636000 | 2025-07-27 04:34:35.685000 | 2025-07-27 04:34:45.486000 | synced        | ingest, DXF |
  |    171 | test    | ddl_test1  | modify column | public               |         2 |      110 |   4194304 | 2025-07-27 04:25:52.786000 | 2025-07-27 04:25:52.835000 | 2025-07-27 04:33:03.786000 | synced        |             |
  |    170 | test    | ddl_test1  | add index     | public               |         2 |      110 |   4194304 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:51.086000 | synced        | ingest, DXF |
  |    169 | tpcc    | item       | create table  | public               |       118 |      168 |         0 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.135000 | synced        |             |
  |    167 | tpcc    | stock      | create table  | public               |       118 |      162 |         0 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.636000 | synced        |             |
  |    161 | tpcc    | order_line | create table  | public               |       118 |      156 |         0 | 2025-07-27 04:22:39.036000 | 2025-07-27 04:22:39.086000 | 2025-07-27 04:22:39.086000 | synced        |             |
  |    155 | tpcc    | orders     | create table  | public               |       118 |      150 |         0 | 2025-07-27 04:22:38.536000 | 2025-07-27 04:22:38.536000 | 2025-07-27 04:22:38.585000 | synced        |             |
  |    149 | tpcc    | new_order  | create table  | public               |       118 |      144 |         0 | 2025-07-27 04:22:38.036000 | 2025-07-27 04:22:38.036000 | 2025-07-27 04:22:38.086000 | synced        |             |
  +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  12 rows in set (0.01 sec)
  ```

+ しばらく待った後、再度[Grafana dashboard](http://${LAB:HOST_MONITOR1_PUBLIC_IP}:3000)に戻り、`tidb-demo-TiDB-Summary` の `Query Summary` タブでは、`Duration` パネルが下降し、`Command Per Second` パネルが上昇し始めることが確認でき、データベースの負荷がもはや DDL タスクの影響を受けていないことを示しています。

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

+ [ターミナル 1](ssh://monitor1-ssh#1) で、TPC-C テストが完了するまで待つか、<kbd>Ctrl</kbd> + <kbd>C</kbd> を使用してテストを中止します。

  ```output
  ...
  [Summary] DELIVERY - Takes(s): 599.8, Count: 10974, TPM: 1097.8, Sum(ms): 1172026.8, Avg(ms): 106.9, 50th(ms): 92.3, 90th(ms): 176.2, 95th(ms): 218.1, 99th(ms): 335.5, 99.9th(ms): 671.1, Max(ms): 1342.2
  [Summary] NEW_ORDER - Takes(s): 599.8, Count: 124031, TPM: 12406.2, Sum(ms): 4598542.0, Avg(ms): 37.1, 50th(ms): 29.4, 90th(ms): 67.1, 95th(ms): 88.1, 99th(ms): 142.6, 99.9th(ms): 285.2, Max(ms): 1073.7
  [Summary] NEW_ORDER_ERR - Takes(s): 599.8, Count: 6, TPM: 0.6, Sum(ms): 166.6, Avg(ms): 27.8, 50th(ms): 23.1, 90th(ms): 37.7, 95th(ms): 60.8, 99th(ms): 60.8, 99.9th(ms): 60.8, Max(ms): 60.8
  [Summary] ORDER_STATUS - Takes(s): 599.8, Count: 10975, TPM: 1097.8, Sum(ms): 98169.0, Avg(ms): 8.9, 50th(ms): 7.9, 90th(ms): 14.2, 95th(ms): 17.8, 99th(ms): 29.4, 99.9th(ms): 65.0, Max(ms): 260.0
  [Summary] PAYMENT - Takes(s): 599.9, Count: 118543, TPM: 11856.6, Sum(ms): 5758996.8, Avg(ms): 48.6, 50th(ms): 39.8, 90th(ms): 96.5, 95th(ms): 117.4, 99th(ms): 167.8, 99.9th(ms): 302.0, Max(ms): 1040.2
  [Summary] PAYMENT_ERR - Takes(s): 599.9, Count: 9, TPM: 0.9, Sum(ms): 539.4, Avg(ms): 59.7, 50th(ms): 37.7, 90th(ms): 113.2, 95th(ms): 151.0, 99th(ms): 151.0, 99.9th(ms): 151.0, Max(ms): 151.0
  [Summary] STOCK_LEVEL - Takes(s): 599.7, Count: 11074, TPM: 1107.9, Sum(ms): 276158.1, Avg(ms): 24.9, 50th(ms): 21.0, 90th(ms): 44.0, 95th(ms): 52.4, 99th(ms): 79.7, 99.9th(ms): 142.6, Max(ms): 226.5
  [Summary] STOCK_LEVEL_ERR - Takes(s): 599.7, Count: 1, TPM: 0.1, Sum(ms): 4.1, Avg(ms): 3.9, 50th(ms): 4.2, 90th(ms): 4.2, 95th(ms): 4.2, 99th(ms): 4.2, 99.9th(ms): 4.2, Max(ms): 4.2
  tpmC: 12406.2, tpmTotal: 27566.3, efficiency: 24117.9%
  ```

### 手順 5. `ADMIN RESUME DDL` を使用してDDLタスクを再開します

+ [ターミナル 4](ssh://monitor1-ssh#4)で、TiDBサーバーインスタンスに接続します。

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

  ```output
  mysql> 
  ```

+ コマンド `ADMIN RESUME DDL JOBS` とDDLタスクの `JOB_ID` を使用して、前のステップで一時停止された2つのDDLタスクを再開します。なお、以下のコード内の `JOB_ID` は受講者自身の環境に応じて指定する必要があり、`175` と `176` でない場合もありますので注意してください。

  ```sql
  ADMIN RESUME DDL JOBS 175, 176;
  ```

  ```output
  +--------+------------+
  | JOB_ID | RESULT     |
  +--------+------------+
  | 175    | successful |
  | 176    | successful |
  +--------+------------+
  2 rows in set (0.00 sec)
  ```

+ コマンド `ADMIN SHOW DDL JOBS` を使用して2つのDDLタスクの状態を確認します。例では `JOB_ID` は `175` と `176`、`STATE` は `queueing` と `queueing` となり、既に再開されていることを示しています。出力は例と異なる場合がありので注意してください。

  ```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    |
  +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  |    175 | test    | ddl_test3  | modify column | write reorganization |         2 |      114 |         0 | 2025-07-27 04:44:56.336000 | 2025-07-27 04:44:56.386000 | NULL                       | queueing      |             |
  |    176 | test    | ddl_test4  | add index     | none                 |         2 |      116 |         0 | 2025-07-27 04:45:08.285000 | 2025-07-27 04:50:45.286000 | NULL                       | queueing      |             |
  |    174 | test    | ddl_test3  | add index     | public               |         2 |      114 |   4194304 | 2025-07-27 04:44:35.936000 | 2025-07-27 04:44:35.985000 | 2025-07-27 04:44:49.036000 | synced        | ingest, DXF |
  |    173 | test    | ddl_test2  | modify column | none                 |         2 |      112 |         0 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:36:30.036000 | rollback done |             |
  |    172 | test    | ddl_test2  | add index     | public               |         2 |      112 |   4194304 | 2025-07-27 04:34:35.636000 | 2025-07-27 04:34:35.685000 | 2025-07-27 04:34:45.486000 | synced        | ingest, DXF |
  |    171 | test    | ddl_test1  | modify column | public               |         2 |      110 |   4194304 | 2025-07-27 04:25:52.786000 | 2025-07-27 04:25:52.835000 | 2025-07-27 04:33:03.786000 | synced        |             |
  |    170 | test    | ddl_test1  | add index     | public               |         2 |      110 |   4194304 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:51.086000 | synced        | ingest, DXF |
  |    169 | tpcc    | item       | create table  | public               |       118 |      168 |         0 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.135000 | synced        |             |
  |    167 | tpcc    | stock      | create table  | public               |       118 |      162 |         0 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.636000 | synced        |             |
  |    161 | tpcc    | order_line | create table  | public               |       118 |      156 |         0 | 2025-07-27 04:22:39.036000 | 2025-07-27 04:22:39.086000 | 2025-07-27 04:22:39.086000 | synced        |             |
  |    155 | tpcc    | orders     | create table  | public               |       118 |      150 |         0 | 2025-07-27 04:22:38.536000 | 2025-07-27 04:22:38.536000 | 2025-07-27 04:22:38.585000 | synced        |             |
  |    149 | tpcc    | new_order  | create table  | public               |       118 |      144 |         0 | 2025-07-27 04:22:38.036000 | 2025-07-27 04:22:38.036000 | 2025-07-27 04:22:38.086000 | synced        |             |
  +--------+---------+------------+---------------+----------------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  12 rows in set (0.02 sec)
  ```

### 手順 6. DDLタスクの実行が終了するまで待ちます

+ [ターミナル 2](ssh://monitor1-ssh#2)で、DDLタスクの実行が終了するまで待ちます。

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

  Query OK, 0 rows affected (18 min 48.04 sec)
  ```

+ [ターミナル 3](ssh://monitor1-ssh#3)で、DDLタスクの実行が終了するまで待ちます。

  ```output
  Query OK, 0 rows affected (20 min 30.99 sec)

  Query OK, 0 rows affected (3 min 51.02 sec)
  ```

+ [ターミナル 4](ssh://monitor1-ssh#4) で，コマンド `ADMIN SHOW DDL JOBS` を使用して2つのDDLタスクの状態を確認します。例では `JOB_ID` は  `175` と `176`、`STATE` は `synced` と  となり、既に実行が完了していることを示しています。なお、出力は例と異なる場合がありますので注意してください。

  ```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    |
  +--------+---------+------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  |    177 | test    | ddl_test4  | modify column | public       |         2 |      116 |   7142699 | 2025-07-27 04:55:03.086000 | 2025-07-27 04:55:03.136000 | 2025-07-27 04:59:05.536000 | synced        |             |
  |    176 | test    | ddl_test4  | add index     | public       |         2 |      116 |   4194304 | 2025-07-27 04:45:08.285000 | 2025-07-27 04:50:45.286000 | 2025-07-27 04:54:51.086000 | synced        | ingest, DXF |
  |    175 | test    | ddl_test3  | modify column | public       |         2 |      114 |   4194304 | 2025-07-27 04:44:56.336000 | 2025-07-27 04:44:56.386000 | 2025-07-27 04:54:11.236000 | synced        |             |
  |    174 | test    | ddl_test3  | add index     | public       |         2 |      114 |   4194304 | 2025-07-27 04:44:35.936000 | 2025-07-27 04:44:35.985000 | 2025-07-27 04:44:49.036000 | synced        | ingest, DXF |
  |    173 | test    | ddl_test2  | modify column | none         |         2 |      112 |         0 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:34:49.586000 | 2025-07-27 04:36:30.036000 | rollback done |             |
  |    172 | test    | ddl_test2  | add index     | public       |         2 |      112 |   4194304 | 2025-07-27 04:34:35.636000 | 2025-07-27 04:34:35.685000 | 2025-07-27 04:34:45.486000 | synced        | ingest, DXF |
  |    171 | test    | ddl_test1  | modify column | public       |         2 |      110 |   4194304 | 2025-07-27 04:25:52.786000 | 2025-07-27 04:25:52.835000 | 2025-07-27 04:33:03.786000 | synced        |             |
  |    170 | test    | ddl_test1  | add index     | public       |         2 |      110 |   4194304 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:39.136000 | 2025-07-27 04:25:51.086000 | synced        | ingest, DXF |
  |    169 | tpcc    | item       | create table  | public       |       118 |      168 |         0 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.086000 | 2025-07-27 04:22:40.135000 | synced        |             |
  |    167 | tpcc    | stock      | create table  | public       |       118 |      162 |         0 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.586000 | 2025-07-27 04:22:39.636000 | synced        |             |
  +--------+---------+------------+---------------+--------------+-----------+----------+-----------+----------------------------+----------------------------+----------------------------+---------------+-------------+
  10 rows in set (0.01 sec)
  ```

+ 本モジュールはここで終了します。
