Canceling Execution of DDL Stuck

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 取消执行DDL卡死

| username: 飞翔的草莓

[TiDB Usage Environment]
Production Environment

[TiDB Version]
7.5.0

[Reproduction Path]
Adding an index to a data table using DBeaver

[Encountered Issue: Symptoms and Impact]
Occasionally, the process freezes when adding an index to a data table. After canceling the task using the ADMIN CANCEL DDL JOB and KILL TIDB QUERY commands, it indicates success, but the process remains in a canceling state.

[Resource Configuration]
Navigate to TiDB Dashboard - Cluster Info - Hosts and take a screenshot of this page

[Attachments: Screenshots/Logs/Monitoring]

| username: DBAER | Original post link

I see the version is 7.5. Adding an index might be causing an MDL lock. You can check it out here:

| username: zhaokede | Original post link

According to the documentation, you need to kill this lock process.

| username: Jasper | Original post link

You can try restarting the DDL owner, refer to this link: SQL 操作常见问题 | PingCAP 文档中心

| username: 友利奈绪 | Original post link

Try killing the process lock first.

| username: kkpeter | Original post link

I have encountered this problem before. If there are multiple TiDB nodes, stop the other nodes leaving only one node, and then restart this node.

| username: 飞翔的草莓 | Original post link

I found the process ID, but I can’t kill it.

| username: 飞翔的草莓 | Original post link

In a production environment, you can’t just restart randomly…

| username: TIDB-Learner | Original post link

  1. Is the data large? If it is, please be patient.
  2. Generally, the time taken is proportional to the size of the data.
  3. Creating takes time, and canceling and rolling back also take time. Be cautious with reverse operations.
  4. Operations like cancel and kill can also accelerate heartbeat and hormone secretion.
| username: Jellybean | Original post link

  1. Execute admin show ddl jobs; to check the cluster’s DDL task queue.
  2. Confirm whether the first task is a DDL task for adding an index to a large table.
| username: zhanggame1 | Original post link

Use tiup to restart all TiDB servers.

| username: yytest | Original post link

Try restarting it.

| username: TiDBer_0p0BD6le | Original post link

If CANCEL can be executed successfully, it is not an MDL issue. You can check the current DDL queue and the status of the currently running DDL before making a judgment.