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

fast DDL may be broken when add UK of int handle tables #51954

Closed
lance6716 opened this issue Mar 20, 2024 · 1 comment · Fixed by #51955
Closed

fast DDL may be broken when add UK of int handle tables #51954

lance6716 opened this issue Mar 20, 2024 · 1 comment · Fixed by #51955
Assignees
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.0 component/ddl This issue is related to DDL of TiDB. severity/moderate type/bug The issue is confirmed as a bug.

Comments

@lance6716
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

func TestAddUKWithSmallIntHandles(t *testing.T) {
	store := realtikvtest.CreateMockStoreAndSetup(t)
	tk := testkit.NewTestKit(t, store)
	tk.MustExec("drop database if exists small;")
	tk.MustExec("create database small;")
	tk.MustExec("use small;")
	tk.MustExec(`set global tidb_ddl_enable_fast_reorg=1;`)
	tk.MustExec("create table t (a bigint, b int, primary key (a) clustered)")
	tk.MustExec("insert into t values (-9223372036854775808, 1),(-9223372036854775807, 1)")
	tk.MustExec("alter table t add unique index uk(b)")
	tk.MustExec("admin check table t")
}

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

duplicate entry

3. What did you see instead (Required)

        	            	[admin:8223]data inconsistency in table: t, index: uk, handle: -9223372036854775808, index-values:"" != record-values:"handle: -9223372036854775808, values: [KindInt64 1]"

4. What is your TiDB version? (Required)

@lance6716 lance6716 added the type/bug The issue is confirmed as a bug. label Mar 20, 2024
@lance6716
Copy link
Contributor Author

because MinRowID may be larger than IntHandle.Encoded()

MinRowID = EncodeIntRowID(math.MinInt64)

@lance6716 lance6716 added affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.0 and removed may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 labels Mar 20, 2024
@lance6716 lance6716 self-assigned this Mar 20, 2024
@jebter jebter added the component/ddl This issue is related to DDL of TiDB. label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.5 This bug affects the 6.5.x(LTS) versions. affects-7.1 This bug affects the 7.1.x(LTS) versions. affects-7.5 This bug affects the 7.5.x(LTS) versions. affects-8.0 component/ddl This issue is related to DDL of TiDB. severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants