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

tikv aborts txn: KeyTooLarge #23797

Closed
wjhuang2016 opened this issue Apr 1, 2021 · 3 comments
Closed

tikv aborts txn: KeyTooLarge #23797

wjhuang2016 opened this issue Apr 1, 2021 · 3 comments
Assignees
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. wontfix This issue will not be fixed.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Enable the new collation.

drop table if exists t;
create table t(a varchar(700) collate utf8mb4_unicode_ci, key (a));
insert into t values (repeat("", 700));
mysql> show create table t;
+-------+---------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                    |
+-------+---------------------------------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `a` varchar(700) DEFAULT NULL,
  KEY `a` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin |
+-------+---------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> drop table t;
Query OK, 0 rows affected (0.25 sec)

mysql> create table t(a varchar(700) collate utf8mb4_unicode_ci, key (a));
Query OK, 0 rows affected (0.11 sec)

mysql> insert into t values (repeat("", 700));
ERROR 1105 (HY000): tikv aborts txn: KeyTooLarge(14220, 4096)

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

No error.

3. What did you see instead (Required)

ERROR 1105 (HY000): tikv aborts txn: KeyTooLarge(14220, 4096)

4. What is your TiDB version? (Required)

master

@wjhuang2016 wjhuang2016 added the type/bug The issue is confirmed as a bug. label Apr 1, 2021
@tangenta
Copy link
Contributor

tangenta commented Apr 1, 2021

We also need to check the clustered primary key length:

create table t(a varchar(700) collate utf8mb4_unicode_ci, primary key (a) clustered);
insert into t values (repeat("", 700));
ERROR 1105 (HY000): tikv aborts txn: KeyTooLarge(14202, 4096)

The prefix of key(table ID, index ID...) and sort key length should also be considered too.

@tangenta tangenta self-assigned this Apr 1, 2021
@jebter jebter added the sig/transaction SIG:Transaction label Apr 2, 2021
@cfzjywxk cfzjywxk added sig/sql-infra SIG: SQL Infra and removed sig/transaction SIG:Transaction labels Aug 23, 2021
@wjhuang2016
Copy link
Member Author

Since it hits the TiKV's limit, it's expected to return an error.

@wjhuang2016 wjhuang2016 added the wontfix This issue will not be fixed. label Sep 22, 2021
@github-actions
Copy link

Please check whether the issue should be labeled with 'affects-x.y' or 'backport-x.y.z',
and then remove 'needs-more-info' label.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/major sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug. wontfix This issue will not be fixed.
Projects
None yet
Development

No branches or pull requests

5 participants