-
Notifications
You must be signed in to change notification settings - Fork 225
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
Support load-based replica read #675
Conversation
fb2f1cf
to
6e2bfd8
Compare
6e2bfd8
to
d3c5cfc
Compare
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
d3c5cfc
to
38d5bc8
Compare
txnkv/txnsnapshot/scan.go
Outdated
@@ -233,6 +233,7 @@ func (s *Scanner) getData(bo *retry.Backoffer) error { | |||
ResourceGroupTag: s.snapshot.mu.resourceGroupTag, | |||
RequestSource: s.snapshot.GetRequestSource(), | |||
ResourceGroupName: s.snapshot.mu.resourceGroupName, | |||
BusyThresholdMs: uint32(s.snapshot.mu.busyThreshold.Milliseconds()), |
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.
I don't understand why it is not protected by the RWLock?
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.
Sorry, I think the code before was actually incorrect. Context
should not be set here. It should be set below in L243 instead.
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
internal/locate/region_request.go
Outdated
// exceeding maxReplicaAttempt | ||
// +-------------------+ || RPC failure && unreachable && no forwarding | ||
// exceeding maxReplicaAttempt | ||
// +-------------------+ || RPC failure && unreachable && no forwarding | ||
// |
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.
Unexpected formats?
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.
I don't find how to let go fmt
ignore it. I add a bar at the line beginning to work around it.
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.
You can leave an empty line after the graph and before the following code, so that the formatter won't break the indents.
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
if ctx != nil && ctx.Store != nil { | ||
ctx.Store.markAlreadySlow() | ||
if serverIsBusy := regionErr.GetServerIsBusy(); serverIsBusy != nil { | ||
if s.replicaSelector != 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.
If the replicaSelector
is nil would the markAlreadySlow
be skipped unexpectedly?
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.
Actually, this is impossible for TiKV requests. RegionRequestSender
always creates a new replicaSelector
if not exists.
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
A question about |
Yes, it's a future plan. It's not implemented it in TiKV now because I haven't found a good way to get it efficiently. The gRPC threads don't have access to the engine Maybe it's possible to move local reader to gRPC threads, but there do have a lot to consider. |
Refers to tikv/rfcs#105.
Corresponding TiDB PR: pingcap/tidb#40742