Skip to content

Commit

Permalink
store: key ranges should be sorted in batch cop retry (pingcap#44623) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jun 25, 2023
1 parent 3368fbf commit 42d2f9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions store/copr/batch_coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,10 @@ func (b *batchCopIterator) retryBatchCopTask(ctx context.Context, bo *backoff.Ba
ranges = append(ranges, *ran)
})
}
// need to make sure the key ranges is sorted
sort.Slice(ranges, func(i, j int) bool {
return bytes.Compare(ranges[i].StartKey, ranges[j].StartKey) < 0
})
return buildBatchCopTasks(bo, b.store, NewKeyRanges(ranges), b.req.StoreType, nil, 0, false, 0)
}

Expand Down

0 comments on commit 42d2f9f

Please sign in to comment.