Skip to content

tikv-client: stale Region cache may continue to be used after RegionNotFound #69197

Closed

Description

@ekexium

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

This is a tracking issue for the TiDB release-8.5 cherry-pick of the tikv/client-go fix.

Scenario summary from tikv/client-go#1892:

  1. Use TiDB v8.5 with replica read / closest replica behavior.
  2. A Region split happens while a replica is temporarily unavailable or lagging.
  3. A request sent to a stale replica returns RegionNotFound.
  4. The previous v8.5 client-go backport only scheduled an async Region cache reload, so concurrent requests could continue using the stale Region cache before the reload completed.

Related upstream/backport PRs:

2. What did you expect to see? (Required)

After RegionNotFound, stale Region cache entries should be invalidated immediately so concurrent requests stop using them. The current request may still retry on the leader safely.

3. What did you see instead (Required)

The previous v8.5 client-go behavior used async Region cache reload after RegionNotFound. During the async reload window, concurrent requests could keep using stale Region cache entries, which may cause repeated RegionNotFound errors and extra cross-AZ retries/traffic.

4. What is your TiDB version? (Required)

TiDB v8.5.x / release-8.5 before bumping github.com/tikv/client-go/v2 to a commit including tikv/client-go#2004 (a2b634d170d9b5ae8119d0322f807c755a56a23e).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions