pingcap / pingcap/tidb

TiFlash: Handle duplicate MPP task dispatch, ignore "task is already registered"

Open
#65,864 0 comments 0 reactions 0 assignees View on GitHub
affects-8.5 report/customer type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement: Ignore TiFlash MPP dispatch "task is already registered" (idempotent success)

### Motivation
In MPP execution, TiDB dispatches tasks to TiFlash. In some cases (e.g. coordinator retry caused by RPC timeout / transient network issues), TiDB may dispatch the same MPP task more than once. TiFlash can then return an error message like **"task is already registered"**.

Today this can cause TiDB to treat the dispatch as failed and abort the whole query, even though the task is already accepted and running on TiFlash.

### What we want
Treat **"task is already registered"** from TiFlash dispatch response as **idempotent success**:
- Do not fail the query for this specific case.
- Emit a warning log to help diagnose unexpected duplicate dispatches.
- Keep other errors unchanged (still returned as before).

### Scope
- Only affects handling of TiFlash MPP dispatch responses.
- No new retry/cancel behavior is introduced.

### Acceptance criteria
- Queries do not fail when TiFlash replies "task is already registered" during MPP task dispatch.
- Warning log is emitted when this path is taken.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.