TiDB Adding Index Causes Hang, Process Keeps Running and Cannot Be Terminated

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

Original topic: tidb加索引卡死,进程一直running,无法杀死进程

| username: TiDBer_8xw9Q7ml

When performing a create index operation on TiDB, the process got stuck. After manually closing the window, the process remained in the background. Then, using the command admin cancel ddl jobs 20038;, it showed that the process was in the “cancelling” state. However, when performing DDL operations on the database, all operations got stuck. Research indicated that this was because the process was still in the cancelling state, causing subsequent DDL operations to queue up. How can I completely kill this process?

| username: TIDB-Learner | Original post link

Have you tried using SHOW PROCESSLIST and then KILL id?

| username: forever | Original post link

There are unfinished DDL tasks before this, so the canceled DDLs are also in the queue. Just restart all TiDB server components.

| username: dba远航 | Original post link

This should be a large transaction, you can only wait.

| username: TiDBer_8xw9Q7ml | Original post link

I’ve tried, but I can’t kill it.

| username: TiDBer_8xw9Q7ml | Original post link

It has been running for several days and cannot be stopped.

| username: TiDBer_8xw9Q7ml | Original post link

How exactly do I operate it, please?

| username: tidb菜鸟一只 | Original post link

You should try restarting all TiDB server nodes…

| username: lemonade010 | Original post link

How much data is there? If the data volume is too large, could it be that the rollback time is also very long when a cancel occurs?

| username: TiDBer_8xw9Q7ml | Original post link

With just over 5,000 rows in the table, adding an index causes it to crash.

| username: zhanggame1 | Original post link

Restart the TiDB node.

| username: TiDBer_8xw9Q7ml | Original post link

tiup can specify restarting a component node: tiup cluster restart {cluster-name} -N {tidb-ip:port}
Is that correct?

| username: TiDBer_8xw9Q7ml | Original post link

Is XXX -R the name? Should tidb-test be written directly after it?

| username: forever | Original post link

-N is for node, -R is for role. You can refer to it.

| username: h5n1 | Original post link

First, check the table mysql.tidb_mdl_view to see if there are any blocking records.

| username: zhanggame1 | Original post link

xxx is the cluster name. -R is followed by roles such as tidb, tikv, pd, etc.

| username: TiDBer_8xw9Q7ml | Original post link

What should be added after -R? Is tidb enough?

| username: zhanggame1 | Original post link

Just add TiDB, the database access will be interrupted during the restart, find a time to run it yourself.

| username: TiDBer_8xw9Q7ml | Original post link

tiup cluster restart tidb-zhao -R tidb

| username: TiDBer_8xw9Q7ml | Original post link

Is that so?