Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: you06 <you1474600@gmail.com>
  • Loading branch information
you06 committed Mar 17, 2023
1 parent 67e463f commit b9d5044
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,9 +1147,6 @@ func (worker *copIteratorWorker) handleTaskOnce(bo *Backoffer, task *copTask, ch
cacheKey, cacheValue := worker.buildCacheKey(task, &copReq)

replicaRead := worker.req.ReplicaRead
if replicaRead == kv.ReplicaReadLeader && task.redirect2Replica != nil && len(task.batchTaskList) > 0 {
replicaRead = kv.ReplicaReadFollower
}
req := tikvrpc.NewReplicaReadRequest(task.cmdType, &copReq, options.GetTiKVReplicaReadType(replicaRead), &worker.replicaReadSeed, kvrpcpb.Context{
IsolationLevel: isolationLevelToPB(worker.req.IsolationLevel),
Priority: priorityToPB(worker.req.Priority),
Expand Down Expand Up @@ -1182,6 +1179,11 @@ func (worker *copIteratorWorker) handleTaskOnce(bo *Backoffer, task *copTask, ch
req.ReplicaRead = true
req.ReplicaReadType = options.GetTiKVReplicaReadType(kv.ReplicaReadFollower)
ops = append(ops, tikv.WithMatchStores([]uint64{*task.redirect2Replica}))
if replicaRead == kv.ReplicaReadLeader {
replicaRead = kv.ReplicaReadFollower
req.ReplicaRead = true
req.ReplicaReadType = options.GetTiKVReplicaReadType(replicaRead)
}
}
resp, rpcCtx, storeAddr, err := worker.kvclient.SendReqCtx(bo.TiKVBackoffer(), req, task.region, tikv.ReadTimeoutMedium, getEndPointType(task.storeType), task.storeAddr, ops...)
err = derr.ToTiDBErr(err)
Expand Down

0 comments on commit b9d5044

Please sign in to comment.