Retry on BatchCoprocessor request may fail randomly #44622
Labels
affects-4.0
This bug affects 4.0.x versions.
affects-5.0
This bug affects 5.0.x versions.
affects-5.1
This bug affects 5.1.x versions.
affects-5.2
This bug affects 5.2.x versions.
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.0
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.2
affects-6.3
affects-6.4
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-6.6
affects-7.0
affects-7.1
This bug affects the 7.1.x(LTS) versions.
severity/major
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
The root cause is when retry a batch coprocessor request, we just collect the key ranges in the failed batch coprocessor request:
tidb/store/copr/batch_coprocessor.go
Lines 1094 to 1123 in 1837efe
But, for
buildBatchCopTasksForNonPartitionedTable
andbuildBatchCopTasksForPartitionedTable
, it actually assumes that the input key ranges is sorted. So an unsorted input may cause wrong result inSplitKeyRangesByLocations
, and TiFlash may throw errors likeError 1105 (HY000): [FLASH:Coprocessor:BadRequest] Income key ranges is illegal for region: 326: (while doing learner read for table, logical table_id: 2593)
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: