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

data inconsistency after adding indexes with multi-schema optimization in partition table #52080

Closed
wjhuang2016 opened this issue Mar 25, 2024 · 0 comments · Fixed by #52109
Closed
Assignees
Labels

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

func TestMultiSchemaAddIndexMerge(t *testing.T) {
	store := testkit.CreateMockStore(t)
	defer ingesttestutil.InjectMockBackendMgr(t, store)()
	tk := testkit.NewTestKit(t, store)
	tk.MustExec("use test")
	tk2 := testkit.NewTestKit(t, store)
	tk2.MustExec("use test")

	tk.MustExec("create table t (a int, b int) PARTITION BY HASH (`a`) PARTITIONS 4;")
	tk.MustExec("insert into t values (1, 1), (2, 2), (3, 3);")

	first := true
	var tk2Err error
	ingest.MockExecAfterWriteRow = func() {
		if !first {
			return
		}
		_, tk2Err = tk2.Exec("insert into t values (4, 4), (5, 5);")
		first = false
	}

	tk.MustExec("alter table t add index idx1(a), add index idx2(b);")
	require.False(t, first)
	require.NoError(t, tk2Err)
	tk.MustExec("admin check table t;")
}

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

Test pass

3. What did you see instead (Required)

Messages:   	sql:admin check table t;, [], error stack [admin:8223]data inconsistency in table: t, index: idx2, handle: 5, index-values:"" != record-values:"handle: 5, values: [KindInt64 5]"

4. What is your TiDB version? (Required)

master

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.

4 participants