Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port tidb#17568 to reduce the region error possibility when reading data using coprocessor #65

Merged
merged 1 commit into from
Feb 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/coprocessor/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,16 @@ std::vector<copTask> ResponseIter::handle_task_impl(kv::Backoffer & bo, const co

void ResponseIter::handle_task(const copTask & task)
{
kv::Backoffer bo(kv::copNextMaxBackoff);
std::unordered_map<uint64_t, kv::Backoffer> bo_maps;
std::vector<copTask> remain_tasks({task});
size_t idx = 0;
while (idx < remain_tasks.size())
{
try
{
auto new_tasks = handle_task_impl(bo, remain_tasks[idx]);
auto & current_task = remain_tasks[idx];
auto new_tasks
= handle_task_impl(bo_maps.try_emplace(current_task.region_id.id, kv::copNextMaxBackoff).first->second, current_task);
if (new_tasks.size() > 0)
{
remain_tasks.insert(remain_tasks.end(), new_tasks.begin(), new_tasks.end());
Expand Down