-
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
tikv: make region request can send to flash store #11652
tikv: make region request can send to flash store #11652
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11652 +/- ##
================================================
+ Coverage 80.9013% 81.1015% +0.2002%
================================================
Files 454 454
Lines 100138 98405 -1733
================================================
- Hits 81013 79808 -1205
+ Misses 13319 12847 -472
+ Partials 5806 5750 -56 |
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 take care #11347...
and take care fail retry logic:
- kv request fail should not switch and try to flash node
- flash request fail's retry should not switch to kv node(it seem current code works for this item :D)
- does tiflush has some return error logic like
onRegionError
?
@lysu
|
@lzmhhh123 |
It's ready for review. |
67ff8b3
to
f73853b
Compare
82f1f8c
to
598f889
Compare
…hhh123/tidb into dev/add_theflash_access_flag
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.
at last, maybe we should take care switchNextPeer
tidb/store/tikv/region_cache.go
Line 1064 in 534613f
func (c *RegionCache) switchNextPeer(r *Region, currentPeerIdx int, err error) { |
this method will be called after send request failure
tidb/store/tikv/region_request.go
Line 173 in 953ee8d
if e := s.onSendFail(bo, ctx, err); e != nil { |
A request to TiKV leader should not switch current work index to TiFish, if so maybe will lead write request to send to TiFlash.
and A req to TiFlash maybe better not trigger "switch current work"(e.g. one TiFlash node has crashed, but TiKV's leader is work well and keep handling oltp load).
store/tikv/region_cache.go
Outdated
s.storeType = TiKV | ||
for _, label := range store.Labels { | ||
if label.Key == "engine" && label.Value == "tiflash" { | ||
s.storeType = TiFlash |
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.
we can break
when label.Key == "engine"
even if label.Value != "tiflash"
store/tikv/region_cache.go
Outdated
storeType := TiKV | ||
for _, label := range store.Labels { | ||
if label.Key == "engine" && label.Value == "tiflash" { | ||
storeType = TiFlash |
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.
ditto
store/tikv/region_cache.go
Outdated
regionStore := cachedRegion.getStore() | ||
|
||
tikvCnt := 0 | ||
for i, store := range regionStore.stores { |
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.
Do we have the situation that 1 region have multiple TiFlash?
if so we should take care failure in one of TiFlash store and loadbalance between multiple TiFlash node.
for example, region1 has 3 TiFlash node: a, b, c.
we should give chance to use b and c; and send request to b and c when a is failured?
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
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
/run-all-tests |
What problem does this PR solve?
Make region request can send to flash store.
What is changed and how it works?
Add global config to reveal tiflash store labels and some flash mark in
tikv.Store
.Check List
Tests
Code changes
Side effects
Related changes