pingcap / pingcap/tidb

Select Stmt return slowly during retrieving metadata inside TiDB in some edge cases

Open
#37,099 1 comment 1 reaction 1 assignee Assigned to @onlyacat View on GitHub
severity/moderate sig/sql-infra type/bug
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.

![image](https://user-images.githubusercontent.com/29370032/184604912-e0de3ce4-cf80-4ef6-87e0-cf9645f437d8.png)

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

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.