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

More than one row with the same primary key when inject duplicate network chaos #59672

Closed
yanghy233 opened this issue Feb 20, 2025 · 2 comments
Closed
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. type/bug The issue is confirmed as a bug.

Comments

@yanghy233
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Deploy 5 tikv nodes, 3 pd nodes and 1 tidb node in K8S.

  1. running transaction workload.
  2. one thread execute: alter table table2 add partition partitions 1;
  3. inject duplicate network chaos.
  4. network chaos recovery before the transaction workload finish.
  5. admin check table but failed.

more details can get from the following files.

admin_check_inconsistency_8223.zip

in zip:

  • schema_and_init_data: initial schema, state and data.
  • transaction_workload: execute concurrently.
  • ddl_sequence: DDL threads execute during transaction workload.
  • fault_injection: inject network partition.
  • logs: tidb and tikv logs.

table2 schema:

Mysql > show create table table2;
CREATE TABLE `table2` (
  `pkId` int DEFAULT NULL,
  `pkAttr0` int NOT NULL,
  `commonAttr0_0` varchar(10) DEFAULT NULL,
  `commonAttr1_0` double(10,2) DEFAULT NULL,
  `commonAttr2_0` double(10,2) DEFAULT NULL,
  `commonAttr3_0` double(10,2) DEFAULT NULL,
  `commonAttr4_0` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`pkAttr0`) /*T![clustered_index] NONCLUSTERED */,
  KEY `table2index_pk` (`pkAttr0`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
PARTITION BY KEY (`pkAttr0`) PARTITIONS 3

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

After all workloads:

mysql> admin check table table2;
-- ok

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

mysql> select * from table2 order by `pkId`;
-- ok (59 rows)

3. What did you see instead (Required)

After all workloads:

mysql> admin check table table2;
-- ERROR 8223 (HY000): data inconsistency in table: table2, index: table2index_pk, handle: 4, index-values:"" != record-values:"handle: 4, values: [KindInt64 30]"

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


mysql> select * from table2 order by `pkId`;
+------+---------+---------------+---------------+---------------+---------------+---------------+
| pkId | pkAttr0 | commonAttr0_0 | commonAttr1_0 | commonAttr2_0 | commonAttr3_0 | commonAttr4_0 |
+------+---------+---------------+---------------+---------------+---------------+---------------+
|    0 |       2 | 4nK           |         76207 |         97502 |         67429 | QE            |
|    1 |      10 | pkhk          |         76207 |         90866 |         73900 | 3Ni           |
|    2 |      22 | e             |         97502 |         88646 |         97502 | hBabmg        |
|    3 |      30 | qvgFxY        |         93435 |         90866 |         44734 | WJ            |
|    4 |      34 | PR            |         44734 |         88646 |         44734 | R             |
|    5 |      42 | oK            |         90866 |         76207 |         93435 | Fc            |
|    6 |      54 | VhyZaiy       |         73900 |         76207 |         67429 | wy            |
|    7 |      62 | yth           |         73900 |         44734 |         87303 | Vt            |
|    7 |      62 | yth           |         73900 |         44734 |         88646 | WJ            |
|    8 |      66 | s             |         93435 |         73900 |         93435 | uLP           |
|    9 |      78 | qvgFxY        |         93435 |         73900 |         93435 | Bf3kp         |
|   10 |      86 | 3Ni           |         87303 |         57954 |         93435 | HtRDL         |
|   11 |      90 | oK            |         73900 |         73900 |         73900 | oK            |
|   12 |      98 | aEFcA         |         44734 |         44734 |         44734 | aEFcA         |
|   13 |     110 | OLjp          |         90866 |         90866 |         90866 | OLjp          |
|   14 |     118 | y53sxwi       |         90866 |         90866 |         90866 | y53sxwi       |
|   15 |     122 | pnt           |         73900 |         73900 |         73900 | pnt           |
|   16 |     132 | OLjp          |         97502 |         97502 |         97502 | OLjp          |
|   17 |     140 | feL           |         90866 |         90866 |         90866 | feL           |
|   18 |     148 | zsb2Hc        |         67429 |         67429 |         67429 | zsb2Hc        |
|   19 |     156 | Tf6Gahh       |         90866 |         90866 |         90866 | Tf6Gahh       |
|   20 |     164 | 4PyRD         |         73900 |         73900 |         73900 | 4PyRD         |
|   21 |     172 | Zv3XV         |         76207 |         76207 |         76207 | Zv3XV         |
|   22 |     180 | KNMs          |         76207 |         76207 |         76207 | KNMs          |
|   23 |     188 | SiL           |         97502 |         97502 |         97502 | SiL           |
|   24 |     196 | L1N           |         87303 |         87303 |         87303 | L1N           |
|   25 |     204 | gbhO1         |         93435 |         93435 |         93435 | gbhO1         |
|   26 |     212 | 3ps           |         57954 |         57954 |         57954 | 3ps           |
|   27 |     220 | ptV           |         44734 |         44734 |         44734 | ptV           |
|   28 |     228 | wy            |         88646 |         88646 |         88646 | wy            |
|   29 |     236 | GROdUf        |         93435 |         93435 |         93435 | GROdUf        |
|   30 |     244 | W             |         88646 |         88646 |         88646 | W             |
|   31 |     252 | qvgFxY        |         44734 |         44734 |         44734 | qvgFxY        |
|   32 |     261 | Zi            |         73900 |         73900 |         73900 | Zi            |
|   33 |     267 | NHznGQ        |         76207 |         76207 |         76207 | NHznGQ        |
|   34 |     275 | HCEVBD        |         88646 |         88646 |         88646 | HCEVBD        |
|   35 |     283 | oK            |         44734 |         44734 |         44734 | oK            |
|   36 |     293 | KnKyl         |         73900 |         73900 |         73900 | KnKyl         |
|   37 |     299 | r             |         57954 |         57954 |         57954 | r             |
|   38 |     307 | V2hd          |         76207 |         76207 |         76207 | V2hd          |
|   39 |     317 | KnKyl         |         44734 |         44734 |         44734 | KnKyl         |
|   40 |     324 | KNMs          |         76207 |         76207 |         76207 | KNMs          |
|   41 |     332 | dhXw1         |         87303 |         87303 |         87303 | dhXw1         |
|   42 |     339 | NFCL          |         87303 |         87303 |         87303 | NFCL          |
|   43 |     348 | OLjp          |         97502 |         97502 |         97502 | OLjp          |
|   44 |     356 | eFi           |         67429 |         67429 |         67429 | eFi           |
|   45 |     364 | PR            |         73900 |         73900 |         73900 | PR            |
|   46 |     372 | HCEVBD        |         57954 |         57954 |         57954 | HCEVBD        |
|   47 |     380 | JA            |         97502 |         97502 |         97502 | JA            |
|   48 |     387 | FkQqdB3       |         57954 |         57954 |         57954 | FkQqdB3       |
|   49 |     395 | Qopt          |         76207 |         76207 |         76207 | Qopt          |
|   50 |     405 | y53sxwi       |         90866 |         90866 |         90866 | y53sxwi       |
|   51 |     413 | hBabmg        |         57954 |         57954 |         57954 | hBabmg        |
|   52 |     419 | VrzRXw        |         57954 |         57954 |         57954 | VrzRXw        |
|   53 |     427 | ptV           |         73900 |         73900 |         73900 | ptV           |
|   54 |     437 | uLP           |         97502 |         97502 |         97502 | uLP           |
|   55 |     445 | Bf3kp         |         44734 |         44734 |         44734 | Bf3kp         |
|   56 |     450 | I4y           |         44734 |         44734 |         44734 | I4y           |
|   57 |     462 | pkhk          |         76207 |         76207 |         76207 | pkhk          |
|   58 |     469 | s             |         44734 |         44734 |         44734 | s             |
|   59 |     475 | Tx            |         73900 |         73900 |         73900 | Tx            |
+------+---------+---------------+---------------+---------------+---------------+---------------+
61 rows in set (0.00 sec)

Count(*) returns 59 rows;

But select * returns 61 rows;

More than one row of columns with the same primary key (pkAttr0).

such as: pkAttr0 = 62

4. What is your TiDB version? (Required)

TiDB v8.5.0

select tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()
   |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.5.0
Edition: Community
Git Commit Hash: d13e52ed6e22cc5789bed7c64c861578cd2ed55b
Git Branch: HEAD
UTC Build Time: 2024-12-18 02:26:06
GoVersion: go1.23.3
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
@yanghy233 yanghy233 added the type/bug The issue is confirmed as a bug. label Feb 20, 2025
@yanghy233
Copy link
Author

/label affects-8.5

@ti-chi-bot ti-chi-bot bot added the affects-8.5 This bug affects the 8.5.x(LTS) versions. label Feb 20, 2025
@yanghy233 yanghy233 changed the title More than one row of columns with the same primary key when fault inject recovery More than one row with the same primary key when inject duplicate network chaos Feb 20, 2025
@Defined2014
Copy link
Contributor

Maybe dup with #58692, could you use v8.5.1 to retest it. I will close this issue firstly. If it's not fixed, please feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-8.5 This bug affects the 8.5.x(LTS) versions. type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

2 participants