Skip to content

Commit

Permalink
remove splitTasks (pingcap#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
birdstorm authored and zhexuany committed Jun 28, 2019
1 parent 97512b6 commit 2aa7320
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,31 +300,6 @@ case class RegionTaskExec(child: SparkPlan,
completionService.submit(task)
}

// If one task's ranges list exceeds some threshold, we split it into two sub tasks and
// each has half of the original ranges.
def splitTasks(task: RegionTask): mutable.Seq[RegionTask] = {
val finalTasks = mutable.ListBuffer[RegionTask]()
val queue = mutable.Queue[RegionTask]()
queue += task
while (queue.nonEmpty) {
val front = queue.dequeue
if (isTaskRangeSizeInvalid(front)) {
// use (size + 1) / 2 here rather than size / 2
// to avoid extra single task generated by odd list
front.getRanges
.grouped((front.getRanges.size() + 1) / 2)
.foreach(range => {
queue += RegionTask.newInstance(front.getRegion, front.getStore, range)
})
} else {
// add all ranges satisfying task range size to final task list
finalTasks += front
}
}
logger.debug(s"Split $task into ${finalTasks.size} tasks.")
finalTasks
}

def feedBatch(): TLongArrayList = {
val handles = new array.TLongArrayList(512)
while (handleIterator.hasNext &&
Expand All @@ -344,7 +319,7 @@ case class RegionTaskExec(child: SparkPlan,

indexTasks.foreach { task =>
val taskRange = task.getRanges
val tasks = splitTasks(task)
val tasks = Seq(task)
numIndexScanTasks += tasks.size

if (logger.isDebugEnabled) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
public abstract class CoprocessIterator<T> implements Iterator<T> {
protected final TiSession session;
protected final List<RegionTask> regionTasks;
protected DAGRequest dagRequest;
protected final DAGRequest dagRequest;
protected final DataType[] handleTypes;
// protected final ExecutorCompletionService<Iterator<SelectResponse>> completionService;
protected RowReader rowReader;
Expand Down

0 comments on commit 2aa7320

Please sign in to comment.