Skip to content

Data inconsistency in non clustered PK after load data ...replace into ... #56408

@fzzf678

Description

@fzzf678

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

➜  ~ cat /Users/fanzhou/a.csv
1|aa|beijing
1|aa|beijing
1|aa|beijing
1|aa|beijing
2|bb|shanghai
2|bb|shanghai
2|bb|shanghai
3|cc|guangzhou
mysql> create table a(id int, name varchar(20), addr varchar(100), primary key (id) nonclustered);
Query OK, 0 rows affected (0.02 sec)

mysql> load data local infile '/Users/fanzhou/a.csv' replace into table a fields terminated by '|' escaped by '' lines terminated by '\n';
Query OK, 13 rows affected (0.01 sec)
Records: 8  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select count(*) from a;
+----------+
| count(*) |
+----------+
|        3 |
+----------+
1 row in set (0.01 sec)

mysql> select count(*) from a use index();
+----------+
| count(*) |
+----------+
|        8 |
+----------+
1 row in set (0.01 sec)

mysql> admin check table a;
ERROR 8223 (HY000): data inconsistency in table: a, index: PRIMARY, handle: 3, index-values:"" != record-values:"handle: 3, values: [KindInt64 1]"

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

Data consistent, No error

3. What did you see instead (Required)

Data Inconsistency

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.component/ddlThis issue is related to DDL of TiDB.impact/inconsistencyincorrect/inconsistency/inconsistentreport/customerCustomers have encountered this bug.severity/majortype/bugThe issue is confirmed as a bug.type/regression

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions