Unable to Create Index in TiDB 6.3

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

Original topic: tidb6.3无法创建索引

| username: tidb狂热爱好者

[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.

| username: tidb狂热爱好者 | Original post link

±-------±--------±-------------------±----------±-------------±----------±---------±----------±--------------------±--------------------±--------------------±--------------+
| 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 |

| username: BraveChen | Original post link

I think you just canceled this index task, and it is currently rolling back.

| username: BraveChen | Original post link

Try changing the index name slightly to see if you can create a new index.

| username: tidb狂热爱好者 | Original post link

This issue is related to the table. I found that other tables are normal.

| username: tidb狂热爱好者 | Original post link

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.

| username: forever | Original post link

Why doesn’t the above one open up? :joy:

| username: TiDBer_muzijiang | Original post link

The information provided is a bit limited. How long has it been stuck, and how large is the table?

| username: tidb狂热爱好者 | Original post link

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.

| username: tidb狂热爱好者 | Original post link

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.

| username: tidb狂热爱好者 | Original post link

Later, I found that I couldn’t create an index. After re-importing the table, it worked fine.

| username: tidb狂热爱好者 | Original post link

This bug is really amazing.

| username: tidb狂热爱好者 | Original post link

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.

| username: h5n1 | Original post link

admin show ddl jobs 99999 where table_name=‘co_trade_e’ to check the DDL on the table where you created the index.