Skip to content

Commit

Permalink
store/copr: fix building cop task for global kill (#37484)
Browse files Browse the repository at this point in the history
ref #36108, ref #37420
  • Loading branch information
xuyifangreeneyes authored Aug 31, 2022
1 parent 7c312d0 commit 8473f27
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@ func (c *CopClient) Send(ctx context.Context, req *kv.Request, variables interfa
tasks []*copTask
err error
)
if len(req.KeyRanges) > 0 {
ranges := NewKeyRanges(req.KeyRanges)
tasks, err = buildCopTasks(bo, c.store.GetRegionCache(), ranges, req, eventCb)
} else {
if len(req.KeyRangesWithPartition) > 0 {
// Here we build the task by partition, not directly by region.
// This is because it's possible that TiDB merge multiple small partition into one region which break some assumption.
// Keep it split by partition would be more safe.
Expand All @@ -107,6 +104,9 @@ func (c *CopClient) Send(ctx context.Context, req *kv.Request, variables interfa
}
tasks = append(tasks, tasksInPartition...)
}
} else {
ranges := NewKeyRanges(req.KeyRanges)
tasks, err = buildCopTasks(bo, c.store.GetRegionCache(), ranges, req, eventCb)
}
if err != nil {
return copErrorResponse{err}
Expand Down

0 comments on commit 8473f27

Please sign in to comment.