Skip to content

Commit 42d2f9f

Browse files
authored
store: key ranges should be sorted in batch cop retry (pingcap#44623) (pingcap#44634)
close pingcap#44622
1 parent 3368fbf commit 42d2f9f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

store/copr/batch_coprocessor.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,10 @@ func (b *batchCopIterator) retryBatchCopTask(ctx context.Context, bo *backoff.Ba
768768
ranges = append(ranges, *ran)
769769
})
770770
}
771+
// need to make sure the key ranges is sorted
772+
sort.Slice(ranges, func(i, j int) bool {
773+
return bytes.Compare(ranges[i].StartKey, ranges[j].StartKey) < 0
774+
})
771775
return buildBatchCopTasks(bo, b.store, NewKeyRanges(ranges), b.req.StoreType, nil, 0, false, 0)
772776
}
773777

0 commit comments

Comments
 (0)