pingcap / pingcap/tiflash

Refine CoprocessorBlockInputStream's concurrency control and abort logic.

Open
#6,390 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type/enhancement
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Enhancement

Currently, DAGStorageInterpreter::buildRemoteStreams will create max_threads CoprocessorBlockInputStream, each stream has a CoprocessorReader, and each Reader will start only one thread, each thread will handle some tasks.

When one task failed, it won't affect other tasks, it just writes an error to the data buffer. And only after the TiRemoteBlockInputStream::readImpl is called, this error will be handled and then the whole mpp-task is canceled.

We should stop the coprocessorReader's other task early to reduce the waste of resources.

Refine suggestions

  1. merge multi CoprocessorBlockInputStream to one.
  2. use CoprocessorReader's concurrency.
  3. when one remote read task failed (can be checked in ResponseIter::handleTask), mark this CoprocessorReader canceled.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at DAGStorageInterpreter::buildRemoteStreams and trace how CoprocessorBlockInputStream, CoprocessorReader, and ResponseIter::handleTask coordinate remote reads. Inspect the existing cancellation and error propagation paths before deciding how the suggested stream merging and reader concurrency should interact. Done means failed remote reads cancel remaining work promptly without breaking result handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, databases, distributed-systems
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.