Select Stmt return slowly during retrieving metadata inside TiDB in some edge cases
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
### 1. Minimal reproduce step (Required)
1.1 Deploy a cluster like the yaml file. Ensure that the tidb server and the tikv server are in different machines.
```
pd_servers:
- host: 10.6.6.1
name: pd
tidb_servers:
- host: 10.6.6.1
tikv_servers:
- host: 10.6.6.2
```
1.2 Then use iptables to cut the port for tikv_server( in the 10.6.6.2 machine):
```
iptables -I INPUT -s 10.6.6.2 -ptcp --dport 20180 -j DROP
```
1.3 Connect to the TiDB server and send the query:
```
mysql> select * from information_schema.cluster_config;
```
### 2. What did you expect to see? (Required)
Return quickly, like 5 or 10 seconds with a warning.
### 3. What did you see instead (Required)
Usually, this would cause 2 minutes of waiting.

In some case, it may be much longer:
```
mysql> show processlist;
+------+------+----------------+------+---------+------+------------+-------------------------------------------------+
| Id | User | Host | db | Command | Time | State | Info
|
+------+------+----------------+------+---------+------+------------+-------------------------------------------------+
| 7 | root | 10.6.6.1:36000 | NULL | Query | 488 | autocommit | select * from information_schema.cluster_config |
```
### 4. What is your TiDB version? (Required)
v5.2.1 and can be reproduced in the master.
Contributor guide
Assessment
This issue has not been assessed yet.