Stuck on Index Creation in v7.1.1

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

Original topic: v7.1.1建索引卡住

| username: porpoiselxj

After upgrading to version v7.1.1, there are frequent issues with creating indexes getting stuck, and they remain stuck. After timing out and rolling back, trying to recreate the index still gets stuck (even creating an index on an empty table has the same issue).
I found that restarting the TiDB server allows the process to go through, and at this point, admin ddl jobs will show add index /* ingest */.
After a while, the issue of getting stuck reappears.

| username: xfworld | Original post link

It is indeed quite a headache :rofl:

| username: 花匠小林 | Original post link

Check if there is a /tmp/tidb/tmp_ddl-4000 directory on the corresponding server. If not, create it manually (authorization required). I have encountered this issue before, and SHOW ADMIN DDL can display the corresponding error information.

| username: porpoiselxj | Original post link

The phenomenon on my side is that I can’t see any error messages, and the status is always running.

| username: 有猫万事足 | Original post link

Is there anything in the metadata lock?
SELECT * FROM mysql.tidb_mdl_view

| username: Billmay表妹 | Original post link

The information provided is relatively limited. You need to check the logs of the TiDB where the DDL is located, and it would be best to include the goroutine information as well.

| username: 大飞哥online | Original post link

This is what I encountered before. See if it’s the same as yours. I reported a bug, not sure if it has been fixed.

| username: Billmay表妹 | Original post link

Or you can provide the result of querying the system table mysql.tidb_mdl_view. If the DDL is blocked by an uncommitted large transaction or long transaction, you can check if you can KILL the large transaction.

SELECT * FROM mysql.tidb_mdl_view\G
*************************** 1. row ***************************
    JOB_ID: 141
   DB_NAME: test
TABLE_NAME: t
     QUERY: ALTER TABLE t ADD INDEX idx(a)
SESSION ID: 2199023255957
  TxnStart: 08-30 16:35:41.313(435643624013955072)
SQL_DIGESTS: ["begin","select * from `t`"]
1 row in set (0.02 sec)
| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.