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

Using set as primary key results in inconsistent index #32302

Closed
ekexium opened this issue Feb 14, 2022 · 0 comments · Fixed by #32308 or #32372
Closed

Using set as primary key results in inconsistent index #32302

ekexium opened this issue Feb 14, 2022 · 0 comments · Fixed by #32308 or #32372
Assignees
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. severity/critical type/bug The issue is confirmed as a bug.

Comments

@ekexium
Copy link
Contributor

ekexium commented Feb 14, 2022

Bug Report

The case breaks the br integration test.

1. Minimal reproduce step (Required)

First turn off the mutation checker because it will find the inconsistency and abort the statement.

MySQL root@127.0.0.1:test> set @@tidb_enable_mutation_checker = 0;
Query OK, 0 rows affected
Time: 0.000s

MySQL root@127.0.0.1:test> CREATE TABLE `enum-set` (`set` SET(
                        -> 'x00','x01','x02','x03','x04','x05','x06','x07','x08','x09','x10','x11','x12','x13','x14','x15',
                        -> 'x16','x17','x18','x19','x20','x21','x22','x23','x24','x25','x26','x27','x28','x29','x30','x31',
                        -> 'x32','x33','x34','x35','x36','x37','x38','x39','x40','x41','x42','x43','x44','x45','x46','x47',
                        -> 'x48','x49','x50','x51','x52','x53','x54','x55','x56','x57','x58','x59','x60','x61','x62','x63'
                        -> ) NOT NULL PRIMARY KEY);
Query OK, 0 rows affected
Time: 0.110s

MySQL root@127.0.0.1:test> INSERT INTO `enum-set` VALUES("x00,x59");
Query OK, 1 row affected
Time: 0.007s

MySQL root@127.0.0.1:test> select `set` from `enum-set` where `set` like '%x00';
+-----+
| set |
+-----+
+-----+
0 rows in set
Time: 0.008s

MySQL root@127.0.0.1:test> select `set` from `enum-set` use index(PRIMARY);
+-----+
| set |
+-----+
| x59 |
+-----+
1 row in set
Time: 0.005s

MySQL root@127.0.0.1:test> select `set` from `enum-set` use index();
+---------+
| set     |
+---------+
| x00,x59 |
+---------+
1 row in set
Time: 0.008s

MySQL root@127.0.0.1:test> admin check table `enum-set`;
(8134, 'data inconsistency in table: enum-set, index: PRIMARY, col: set, handle: "1", index-values:"KindMysqlSet x59" != record-values:"KindMysqlSet x00,x59", compare err:<nil>')

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

Consistent results.

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

master.

tidb_version() | Release Version: v5.5.0-alpha-238-gf949e01e0b-dirty
Edition: Community
Git Commit Hash: f949e01e0b20cd74842558b42fa0bfa255146c0b
Git Branch: master
UTC Build Time: 2022-02-14 03:18:12
GoVersion: go1.17.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@ekexium ekexium added the type/bug The issue is confirmed as a bug. label Feb 14, 2022
@ekexium ekexium added affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. severity/critical labels Feb 14, 2022
ekexium added a commit to ti-srebot/tidb that referenced this issue Feb 24, 2022
ekexium added a commit to ti-srebot/tidb that referenced this issue Feb 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. affects-5.1 This bug affects 5.1.x versions. affects-5.2 This bug affects 5.2.x versions. affects-5.3 This bug affects 5.3.x versions. affects-5.4 This bug affects the 5.4.x(LTS) versions. severity/critical type/bug The issue is confirmed as a bug.
Projects
None yet
1 participant