Skip to content

Commit

Permalink
retry once
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyuhang0 committed Mar 20, 2024
1 parent dda4d17 commit eec9a08
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ private SelectResponse process(RegionTask regionTask) {

// In case of one region task spilt into several others, we ues a queue to properly handle all
// the remaining tasks.
int retryCount = 0;
while (!remainTasks.isEmpty()) {
RegionTask task = remainTasks.poll();
if (task == null) {
Expand Down Expand Up @@ -286,15 +287,25 @@ private SelectResponse process(RegionTask regionTask) {
String regionSt = Arrays.toString(region.getStartKey().toByteArray());
String regionEd = Arrays.toString(region.getEndKey().toByteArray());
Long storeId = store == null ? 0 : store.getId();
logger.warn(String.format("region task failed. host:%s region:%s, store: %d. region start key: %s, region end key: %s",
task.getHost(),region.getId(), storeId,regionSt, regionEd));
logger.warn(
String.format(
"region task failed. host:%s region:%s, store: %d. region start key: %s, region end key: %s",
task.getHost(), region.getId(), storeId, regionSt, regionEd));
logger.warn("start to print range");
for (Coprocessor.KeyRange range : ranges) {
logger.warn(
"Sending DAG request with range "
+ Arrays.toString(range.getStart().toByteArray())
+ " to "
+ Arrays.toString(range.getEnd().toByteArray()));
"Sending DAG request with range "
+ Arrays.toString(range.getStart().toByteArray())
+ " to "
+ Arrays.toString(range.getEnd().toByteArray()));
}
if (e.getCause().getMessage().contains("range exceeds bound") && retryCount < 1) {
retryCount++;
logger.info("Re-splitting region task and retry once");
remainTasks.addAll(
RangeSplitter.newSplitter(clientSession.getTiKVSession().getRegionManager())
.splitRangeByRegion(ranges, storeType));
continue;
}
// Rethrow to upper levels
throw new RegionTaskException("Handle region task failed:", e);
Expand Down

0 comments on commit eec9a08

Please sign in to comment.