mirror of https://github.com/tikv/client-go.git
set the request source at the last section (#960)
Signed-off-by: you06 <you1474600@gmail.com>
This commit is contained in:
parent
5dd12b06bc
commit
89493ff985
|
|
@ -2337,9 +2337,10 @@ func (s *replicaSelector) replicaType(rpcCtx *RPCContext) string {
|
|||
|
||||
func (s *replicaSelector) patchRequestSource(req *tikvrpc.Request, rpcCtx *RPCContext) {
|
||||
var sb strings.Builder
|
||||
sb.WriteString(req.InputRequestSource)
|
||||
sb.WriteByte('-')
|
||||
defer func() {
|
||||
// TiKV does the limit control by the last part of the request source.
|
||||
sb.WriteByte('_')
|
||||
sb.WriteString(req.InputRequestSource)
|
||||
req.RequestSource = sb.String()
|
||||
}()
|
||||
|
||||
|
|
|
|||
|
|
@ -1515,7 +1515,7 @@ func (s *testRegionRequestToThreeStoresSuite) TestRetryRequestSource() {
|
|||
rpcCtx, err := replicaSelector.buildRPCContext(bo)
|
||||
s.Nil(err)
|
||||
replicaSelector.patchRequestSource(req, rpcCtx)
|
||||
s.Equal("test-"+firstReplica, req.RequestSource)
|
||||
s.Equal(firstReplica+"_test", req.RequestSource)
|
||||
|
||||
// retry
|
||||
setReadType(req, retryReplica)
|
||||
|
|
@ -1526,7 +1526,7 @@ func (s *testRegionRequestToThreeStoresSuite) TestRetryRequestSource() {
|
|||
s.Nil(err)
|
||||
req.IsRetryRequest = true
|
||||
replicaSelector.patchRequestSource(req, rpcCtx)
|
||||
s.Equal("test-retry_"+firstReplica+"_"+retryReplica, req.RequestSource)
|
||||
s.Equal("retry_"+firstReplica+"_"+retryReplica+"_test", req.RequestSource)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue