Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#44623
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
windtalker authored and ti-chi-bot committed Jun 13, 2023
1 parent 71e6696 commit 1345487
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions store/copr/batch_coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,15 @@ func (b *batchCopIterator) retryBatchCopTask(ctx context.Context, bo *backoff.Ba
ranges = append(ranges, *ran)
})
}
<<<<<<< HEAD
ret, err := buildBatchCopTasksForNonPartitionedTable(bo, b.store, NewKeyRanges(ranges), b.req.StoreType, false, 0, false, 0)
=======
// need to make sure the key ranges is sorted
slices.SortFunc(ranges, func(i, j kv.KeyRange) bool {
return bytes.Compare(i.StartKey, j.StartKey) < 0
})
ret, err := buildBatchCopTasksForNonPartitionedTable(ctx, bo, b.store, NewKeyRanges(ranges), b.req.StoreType, false, 0, false, 0, tiflashcompute.DispatchPolicyInvalid)
>>>>>>> d934ef8d627 (store: key ranges should be sorted in batch cop retry (#44623))
return ret, err
}
// Retry Partition Table Scan
Expand All @@ -834,6 +842,10 @@ func (b *batchCopIterator) retryBatchCopTask(ctx context.Context, bo *backoff.Ba
})
}
}
// need to make sure the key ranges is sorted
slices.SortFunc(ranges, func(i, j kv.KeyRange) bool {
return bytes.Compare(i.StartKey, j.StartKey) < 0
})
keyRanges = append(keyRanges, NewKeyRanges(ranges))
}
ret, err := buildBatchCopTasksForPartitionedTable(bo, b.store, keyRanges, b.req.StoreType, false, 0, false, 0, pid)
Expand Down

0 comments on commit 1345487

Please sign in to comment.