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

*: inconsistency between prepare execute and normal sql in rc or for update read when infoSchema is changed #34974

Closed
SpadeA-Tang opened this issue May 26, 2022 · 0 comments · Fixed by #34957
Labels
severity/moderate type/bug The issue is confirmed as a bug.

Comments

@SpadeA-Tang
Copy link
Contributor

Bug Report

In Rc or For-update-read, when information schema is changed, there may be some inconsistencies between prepare-execute and normal sql.

1. Minimal reproduce step (Required)

func TestInconsistency(t *testing.T) {
	store, clean := testkit.CreateMockStore(t)
	defer clean()

	tk1 := testkit.NewTestKit(t, store)
	tk2 := testkit.NewTestKit(t, store)
	tk1.MustExec("use test")
	tk2.MustExec("use test")

	tk1.MustExec("drop table if exists t1")
	tk1.MustExec("create table t1(id int primary key, c int)")
	tk1.MustExec("insert into t1 values(1, 1), (2, 2)")

	tk1.MustExec("prepare s from 'select * from t1'")

	tk1.MustExec("set tx_isolation='READ-COMMITTED'")
	tk1.MustExec("begin pessimistic")

	tk1.MustQuery("execute s").Check(testkit.Rows("1 1", "2 2"))

	// Change infoSchema
	tk2.MustExec("alter table t1 drop column c")

	tk1.MustQuery("select * from t1").Check(testkit.Rows("1 1", "2 2"))
	// It should be consistent with above
	tk1.MustQuery("execute s").Check(testkit.Rows("1", "2"))
}

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

The results of execute s and select * from t1 are different even though they should be the same.

3. What did you see instead (Required)

4. What is your TiDB version? (Required)

dce5064

@SpadeA-Tang SpadeA-Tang added the type/bug The issue is confirmed as a bug. label May 26, 2022
@SpadeA-Tang SpadeA-Tang changed the title *: inconsistency between prepare execute and normal sql in rc or for update read when inforSchema is changed *: inconsistency between prepare execute and normal sql in rc or for update read when infoSchema is changed Aug 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant