pingcap / pingcap/tidb

statistics are not available in rolling upgrade

Open
#39,523 0 comments 0 reactions 0 assignees View on GitHub
component/statistics sig/planner type/enhancement
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Enhancement

When TiDB server restarts, it needs to load statistics of all tables from TiKV to TiDB memory(the corresponding code is `initStats`). The loading procedure takes several minutes. In some extreme cases(for example, the pressure of TiDB and/or TiKV is already very high), it takes half an hour or even fails. When `initStats` is not finished, no statistics are available in memory so the optimizer uses pseudo statistics and may choose wrong plans, which may bring much pressure to the cluster. It seems that the feature of stats sync load can solve the problem. We need some experiments to verify that.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the initStats path and locating the existing stats sync load implementation across TiDB and TiKV. Run rolling-upgrade experiments under the high-load conditions described in the issue, comparing statistics availability and query plans before and after synchronization. Done is not defined beyond verifying whether stats sync load solves the problem, so the experiment and acceptance criteria need clarification.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.