Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to create index with distribute framework after import data via lightning #45652

Closed
GMHDBJD opened this issue Jul 28, 2023 · 3 comments · Fixed by #45679
Closed

Failed to create index with distribute framework after import data via lightning #45652

GMHDBJD opened this issue Jul 28, 2023 · 3 comments · Fixed by #45679
Assignees
Labels
affects-7.2 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@GMHDBJD
Copy link
Contributor

GMHDBJD commented Jul 28, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

 gmhdbjd@gmhdbjd  ~/code/tidb/bin   master  ./tidb-lightning -c cfg.toml
Verbose debug logs will be written to tidb-lightning.log

tidb lightning exit successfully
 gmhdbjd@gmhdbjd  ~/code/tidb/bin   master  mysql -uroot -h127.0.0.1 -P4000
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 17
Server version: 5.7.25-TiDB-v7.3.0-alpha TiDB Server (Apache License 2.0) Community Edition, MySQL 8.0 compatible

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set global tidb_enable_dist_task=1;
Query OK, 0 rows affected (0.03 sec)

mysql> use db;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from tb;
+------+------+
| id   | msg  |
+------+------+
|    1 | 1    |
+------+------+
1 row in set (0.00 sec)

mysql> show config where type = 'tikv' && name = 'storage.engine';
+------+-----------------+----------------+---------+
| Type | Instance        | Name           | Value   |
+------+-----------------+----------------+---------+
| tikv | 127.0.0.1:20160 | storage.engine | raft-kv |
+------+-----------------+----------------+---------+
1 row in set (0.01 sec)

mysql> create index idx on tb(id);



2. What did you expect to see? (Required)

create index succeed

3. What did you see instead (Required)


[2023/07/28 15:33:51.366 +08:00] [WARN] [dispatcher.go:379] ["gen dist-plan failed"] [error="PD returned no region, startKey: \"74800000000000006C5F728000000000000001\", endKey: \"74800000000000006C5F728000000000000001\", limit: 128"]

4. What is your TiDB version? (Required)

master

@GMHDBJD GMHDBJD added the type/bug The issue is confirmed as a bug. label Jul 28, 2023
@GMHDBJD
Copy link
Contributor Author

GMHDBJD commented Jul 28, 2023

Errors will only occur when there is only one row

@jiyfhust
Copy link
Contributor

/assign

@jiyfhust
Copy link
Contributor

It seems:
https://github.com/pingcap/tidb/blob/06ea55d0c5b90c1451690951856e595d2290a55c/ddl/reorg.go#L736C30-L736C30
because there is only one record,the return value start is same with end.As The error message shows:
startKey: "74800000000000006C5F728000000000000001"
endKey: "74800000000000006C5F728000000000000001"

The pd client api will get regions by range [startKey, endKey), not [startKey, endKey],
if the range of the region which has the record start with the same value with startKey,
then it will return no region.
https://github.com/tikv/pd/blob/fe52361cf48a7f5ed8c69bcd02db77e25162f207/pkg/core/region.go#L1506C3-L1506C3

then error occurrs.

@ti-chi-bot ti-chi-bot bot added may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Jul 31, 2023
@tangenta tangenta added affects-7.2 and removed may-affects-5.2 This bug maybe affects 5.2.x versions. may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 labels Aug 1, 2023
ti-chi-bot bot pushed a commit that referenced this issue Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-7.2 severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants