-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
planner: check index valid while forUpdateRead #21596
Conversation
🤔 Is it ok to fix it directly to release-4.0 without changing master? |
IMO, there should be a better solution in master. |
tpcc 1000 warehouses, 128 threads It's about 1.8% of regression. |
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
a651f42
to
9267958
Compare
@@ -1903,3 +1903,106 @@ func (s *testPessimisticSuite) TestResolveStalePessimisticPrimaryLock(c *C) { | |||
|
|||
c.Assert(tk2.ExecToErr("admin check table t1"), IsNil) | |||
} | |||
|
|||
func (s *testPessimisticSuite) TestIssue21498(c *C) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to add some unique key uk(varchar_column)
case using the IndexLookUp
executor fetching data from unique index and look up data in main table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added snapshot read and for update read cases for IndexLookUp
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the insert into table select from anothertable
, we have another issue #21506, what is the expecting behaviour for this case?
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
I wonder there will be a better solution for this issue in master and future release versions, do we need to cherry pick this hotfix to master? |
Yes, on master maybe we need a better mechanism to solve the concurrent ddl and dml problem so we won't meet this problem. |
Signed-off-by: you06 <you1474600@gmail.com>
@@ -1903,3 +1903,106 @@ func (s *testPessimisticSuite) TestResolveStalePessimisticPrimaryLock(c *C) { | |||
|
|||
c.Assert(tk2.ExecToErr("admin check table t1"), IsNil) | |||
} | |||
|
|||
func (s *testPessimisticSuite) TestIssue21498(c *C) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about the insert into table select from anothertable
, we have another issue #21506, what is the expecting behaviour for this case?
// amend transaction does not support partition table | ||
tk.MustExec("insert into t(id, v, v2) select 6, v + 20, v2 + 200 from t where id = 4") // insert ... select with index unchanged | ||
} | ||
err = tk.ExecToErr("insert into t(id, v, v2) select 7, v + 30, v2 + 300 from t use index (iv) where id = 4") // insert ... select with index changed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe need add more test: prepare plan cache (maybe have question) and plan binding (maybe have no question)
LGTM |
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 <you1474600@gmail.com>
LGTM |
/merge |
Sorry @cfzjywxk, this branch cannot be merged without an approval of release maintainers. |
/merge |
/run-all-tests |
@you06 merge failed. |
/run-unit-test |
/merge |
/run-all-tests |
Signed-off-by: you06 <you1474600@gmail.com>
Signed-off-by: you06 you1474600@gmail.com
What problem does this PR solve?
Issue Number: workaround for #21498
Problem Summary:
ForUpdateRead will read data using schema version of startTS, this may lead to incorrectness, the cases are listed in #21498
What is changed and how it works?
What's Changed:
For RC and forUpdateRead in RR, check if index's state is still
StatePublic
.How it Works:
This check confirms index between snapshotTS and forUpdateTS is not changed, otherwise, the index should not be used.
Check List
Tests
Side effects
Release note