-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
store: implement non-block reading for Get and BatchGet under the large transaction protocol #13599
Conversation
…ge transaction protocol
/run-all-tests |
Integration test fails, we also need to implement this in TiKV? @MyonKeminta @youjiali1995
|
tk.MustQuery("select * from t where id in (1)").Check(testkit.Rows("1 1")) | ||
|
||
// Cover PointGet. | ||
tk.MustQuery("select * from t where id = 1").Check(testkit.Rows("1 1")) |
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.
Does this query use MaxTS?
Then we need also to cover PointGet with real TS.
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.
Done
/integration-common-test |
Codecov Report
@@ Coverage Diff @@
## master #13599 +/- ##
===========================================
Coverage 80.2676% 80.2676%
===========================================
Files 475 475
Lines 117898 117898
===========================================
Hits 94634 94634
Misses 15846 15846
Partials 7418 7418 |
LGTM |
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.
LGTM
@@ -285,10 +298,17 @@ func (s *tikvSnapshot) get(bo *Backoffer, k kv.Key) ([]byte, error) { | |||
} | |||
|
|||
failpoint.Inject("snapshot-get-cache-fail", func(_ failpoint.Value) { | |||
panic("cache miss") | |||
if bo.ctx.Value("TestSnapshotCache") != nil { |
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 using exp like 1*return(true)->return(false)
like this
Line 601 in 2aa571b
c.Assert(failpoint.Enable("github.com/pingcap/tidb/session/keepHistory", `1*return(true)->return(false)`), IsNil) |
failpoint.Value == true
at here is more gofail idiom~
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.
In the concurrent test environment, that mock panic may affect other tests.
bo.ctx.Value("TestSnapshotCache")
is used to address that problem. @lysu
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.
Or we can pass a TS and panic on equal TS.
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.
In failpoint.Inject
it doesn't know which TS @coocood
@MyonKeminta PTAL |
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.
LGTM
/merge |
/run-all-tests |
…ge transaction protocol (pingcap#13599)
What problem does this PR solve?
Large transactions should not block the read operation.
We've handle the coprocessor reading in #11986, and this commit continues with snapshot reading.
What is changed and how it works?
Implement non-block read for
snapshot.Get()
andsnapshot.BatchGet()
function.When those operations meet lock,
ResolveLock
and retry.The
SendReqCtx
operation would not block in the retry as we pass theresolvedLocks
.Check List
Tests
Code changes