Skip to content

Follower read target selection should consult PD for store recovery, not only TiKV's self-reported slow score #2012

Description

@AndreMouche

Background

When a TiKV store hits a transient problem (e.g. a faulty/jittery disk), PD marks it as a slow store and evicts its leaders. Follower stale-read traffic, however, can still be routed to that store while it is recovering.

Current Behavior

When client-go selects the target replica for a follower read, it relies on the slow score that the TiKV store reports about itself to decide whether the store has recovered and is eligible to serve reads again.

The problem is that a recovered self-reported slow score does not guarantee the store is actually ready to take traffic:

  • The signal is local to the store and can be noisy/flapping
  • It is not coordinated with PD's view of the store's recovery / leader-eviction state.

As a result, follower reads can be sent back to a not-yet-recovered store too early, hotspotting it.

Expected Behavior

Before routing a follower (stale) read to a store that was recently slow/recovering, client-go should consult PD to confirm the store has fully recovered (e.g. that PD no longer considers it a slow store / has stopped evicting its leaders), rather than relying solely on the store's self-reported slow score.

Proposed Direction

  • Treat PD's store recovery state as the authoritative signal for "is this store ready to serve reads again," and gate follower-read target selection on it.
  • Keep the TiKV self-reported slow score as a fast local hint, but require agreement with PD's view before sending traffic back to a recently-slow store.
  • Consider a hysteresis / cool-down so a flapping slow score cannot repeatedly re-add a store as a follower-read target.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    type/enhancementThe issue or PR belongs to an enhancement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions