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

unexpected assertion failed during replace/insert into statement #55313

Closed
wjhuang2016 opened this issue Aug 8, 2024 · 1 comment · Fixed by #55314
Closed

unexpected assertion failed during replace/insert into statement #55313

wjhuang2016 opened this issue Aug 8, 2024 · 1 comment · Fixed by #55314
Labels

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

It's found by the internal random test schrddl.

2024/08/08 20:16:22 ddl_ops.go:642: [info] [ddl] [instance 0] ALTER TABLE `f7c7796a` CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin', err: <nil>, elapsed time:0.084977625
2024/08/08 20:16:24 ddl_ops.go:642: [info] [ddl] [instance 5] ALTER TABLE `d3d5bc0b` ADD unique INDEX `3dad1332` (`a7be9cc8`), err: <nil>, elapsed time:13.112145666
2024/08/08 20:16:24 util.go:78: [error] error: Error when executing SQL: insert ignore into `d3d5bc0b` (`a7be9cc8`) values ( '1983' ) ,( '2034' ) ,( '1992' ) ,( '2024' ) on duplicate key update `a7be9cc8` = '2004', `35cf0156` = 8180.722824047234, `b1fb387b` = '1972'
%!s(MISSING): Error 8141: assertion failed: key: 7480000000000001d45f6980000000000000020380000000000007bf, assertion: Exist, start_ts: 451705408030769209, existing start ts: 451705407965233203, existing commit ts: 451705407965233236
2024/08/08 20:16:25 ddl_ops.go:642: [info] [ddl] [instance 5] ALTER TABLE `d3d5bc0b` DROP INDEX `a08e9657`, err: <nil>, elapsed time:0.324238084
2024/08/08 20:16:25 ddl_ops.go:642: [info] [ddl] [instance 8] ALTER TABLE `1073c6f4` ADD unique INDEX `5ffdb67c` (`8fc0cf19`, `16267fdd`), err: <nil>, elapsed time:13.998262417
2024/08/08 20:16:25 ddl_ops.go:642: [info] [ddl] [instance 8] DROP TABLE `6bfce703`, err: <nil>, elapsed time:0.182675292
2024/08/08 20:16:27 ddl_ops.go:642: [info] [ddl] [instance 1] ALTER TABLE `007f55c4` ADD  INDEX `bfb51c8f` (`40c73323`, `3fe68d89`), err: <nil>, elapsed time:13.626399708
2024/08/08 20:16:27 ddl_ops.go:642: [info] [ddl] [instance 1] ALTER TABLE `2621b653` DROP INDEX `84aee0d5`, err: <nil>, elapsed time:0.368877083
2024/08/08 20:16:27 ddl_ops.go:642: [info] [ddl] [instance 1] alter table `2621b653` change column `f46348b8` `6a24291c` MEDIUMINT NULL DEFAULT '-4122057', err: Error 8200: Unsupported modify charset from gbk to binary, elapsed time:0.000424583

As you can see, insert ignore gets "assertion failed".

It's basically verified that introduced by #55125

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

N/A

3. What did you see instead (Required)

N/A

4. What is your TiDB version? (Required)

master

@lcwangchao
Copy link
Collaborator

It is caused by PR: https://github.com/pingcap/tidb/pull/55125/files#diff-f54ca7cfb9ecd930b5c97629080db334e26bf95774c677cf2a7c3d7c16f00590R166 because the opt is passed as an argument instead of computed by options.

And the opt will be modified here:

opt.IgnoreAssertion = opt.IgnoreAssertion || c.idxInfo.State != model.StatePublic

So, it is corrupted after this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants