Closed aytrack closed 1 month ago
Please answer these questions before submitting your issue. Thanks!
drop table if exists test1; CREATE TABLE test1 ( col1 bigint(20) NOT NULL , col2 varchar(36) NOT NULL , col3 int(11) DEFAULT NULL , col4 varchar(36) NOT NULL , col5 varchar(255) DEFAULT NULL , modify_time bigint(20) DEFAULT NULL, create_time bigint(20) DEFAULT NULL, col6 json DEFAULT NULL , col7 json DEFAULT NULL , col8 json GENERATED ALWAYS AS (json_merge_patch(ifnull(col6, _utf8mb4"{}"), ifnull(col7, _utf8mb4"{}"))) STORED, col9 varchar(36) GENERATED ALWAYS AS (left(json_unquote(json_extract(col8, _utf8mb4"$.col9[0]")), 36)) VIRTUAL, col10 varchar(30) GENERATED ALWAYS AS (left(json_unquote(json_extract(col8, _utf8mb4"$.col10")), 30)) VIRTUAL, KEY dev_idx1 (col4,col1,col10,col3,col5), KEY dev_idx2 (col3,col1,col9) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin; INSERT INTO test1 VALUES (-100000000, "123459789332", 1, "123459789332", "AAAAA", 1675871871, 1675760995, '{"col10": "CCCCC", "col9": ["ABCDEFG"]}', '{"col10": "DDDDD", "col9": ["abcdefg"]}', DEFAULT, DEFAULT, DEFAULT); INSERT INTO test1 VALUES (-100000000, "123459789332", 1, "123459789332", "BBBBB", 1675908861, 1675908861, '{"col10": "CCCCC", "col9": ["ABCDEFG"]}', NULL, DEFAULT, DEFAULT, DEFAULT); INSERT INTO test1 VALUES (0, "123459789332", 1, "123459789332", "AAAAA", 1675956409, 1675908882, '{"col10": "CCCCC", "col9": ["ABCDEFG"]}', '{"col10": "DDDDD","col9": ["abcdefg"]}', DEFAULT, DEFAULT, DEFAULT); INSERT INTO test1 VALUES (-100000000, "123459789332", 1, "123459789332", "BBBBB", 1675871896, 1675871896, '{"col10": "CCCCC","col9": ["ABCDEFG"]}', NULL, DEFAULT, DEFAULT, DEFAULT); INSERT INTO test1 VALUES (-100000000, "123459789332", 1, "123459789332", "AAAAA", 1675908836, 1675871916, '{"col10": "CCCCC","col9": ["ABCDEFG"]}', '{"col10": "DDDDD","col9": ["abcdefg"]}', DEFAULT, DEFAULT, DEFAULT); UPDATE test1 SET col7 = '{"col10":"DDDDD","col9":["abcdefg"]}' WHERE col2 = "123459789332"; UPDATE test1 SET col1 = -100000000 WHERE col4 = "123459789332"; DELETE FROM test1 WHERE col1 < 0;
execute delete sql success
[18:00:03]TiDB root:test> DELETE FROM test1 WHERE col1 < 0; (8141, 'assertion failed: key: 74800000000000006e5f698000000000000001013132333435393738ff3933333200000000fb037ffffffffa0a1f00014444444444000000fc038000000000000001014242424242000000fc038000000000000002, assertion: Exist, start_ts: 450412256536559619, existing start ts: 0, existing commit ts: 0')
[18:00:16]TiDB root:test> select tidb_version(); +-----------------------------------------------------------+ | tidb_version() | +-----------------------------------------------------------+ | Release Version: v8.2.0-alpha-170-g9da001d777 | | Edition: Community | | Git Commit Hash: 9da001d7772363a4ae836999150d5af75b2022ee | | Git Branch: HEAD | | UTC Build Time: 2024-05-16 03:50:13 | | GoVersion: go1.21.6 | | Race Enabled: false | | Check Table Before Drop: false | | Store: tikv | +-----------------------------------------------------------+ 1 row in set
The key is generated incorrectly so the assertion check fails, @wjhuang2016 @tangenta PTAL
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
execute delete sql success
3. What did you see instead (Required)
4. What is your TiDB version? (Required)