Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: tidb6.3无法创建索引
[TiDB Usage Environment] Production Environment / Testing / PoC
[TiDB Version]
Upgraded from 6.2 to 6.3
[Encountered Problem]
Unable to create an index in TiDB, always reporting an error
MySQL [futures]> create index idx_ctime_bid_id_ask_id on co_trade_e(bid_id, ask_id);
ERROR 8214 (HY000): Cancelled DDL job
MySQL [futures]>
[Reproduction Path] Operations performed that led to the problem
[Problem Phenomenon and Impact]
[Attachments]
Please provide the version information of each component, such as cdc/tikv, which can be obtained by executing cdc version/tikv-server --version.
±-------±--------±-------------------±----------±-------------±----------±---------±----------±--------------------±--------------------±--------------------±--------------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME | START_TIME | END_TIME | STATE |
±-------±--------±-------------------±----------±-------------±----------±---------±----------±--------------------±--------------------±--------------------±--------------+
| 2710 | futures | co_trade_e | add index | none | 1770 | 1852 | 0 | 2022-10-14 10:19:57 | 2022-10-14 10:19:57 | 2022-10-14 10:20:05 | rollback done |
I think you just canceled this index task, and it is currently rolling back.
Try changing the index name slightly to see if you can create a new index.
This issue is related to the table. I found that other tables are normal.
Clinic Service This is the diagnostic information.
You can check the TiDB logs for the corresponding Region’s “switch region peer to next due to send request fail” to investigate the root cause of the send failure, or refer to TiDB 集群问题导图 | PingCAP 文档中心 to check if there is a TiKV leader drop issue.
Let me investigate this issue.
Why doesn’t the above one open up?
The information provided is a bit limited. How long has it been stuck, and how large is the table?
I have been unable to create an index consistently. Some tables can have indexes created, while others cannot. I feel it might be due to incomplete data synchronization. However, there are no prompts or error messages.
Later, I found that the TiDB server logs could not be written. The directory permissions were set to root. After correcting it, I restarted the server.
Later, I found that I couldn’t create an index. After re-importing the table, it worked fine.
This bug is really amazing.
I think the problem is that the tidb-server
process is not running. You can check the status of the tidb-server
process using the ps
command or by checking the log files. If the process is not running, you can try to start it manually using the systemctl start tidb-server
command or by using the tidb-server
binary directly.
admin show ddl jobs 99999 where table_name=‘co_trade_e’ to check the DDL on the table where you created the index.