pingcap / pingcap/tidb

Make the error message reported while querying TABLE_STORAGE_STATS table more user friendly

Open
#62,646 0 comments 0 reactions 0 assignees View on GitHub
severity/minor sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
```
Set the execution time for the query in ms
set max_execution_time=200;
```

Check the storage consumption and it fails with the message:

```
select * from information_schema.TABLE_STORAGE_STATS where table_schema='schema';
ERROR 1105 (HY000): Get "https://infra-tidb-pd-schema-prod-0a03076e:2379/pd/api/v1/stats/region?start_key=t%80%00%00%00%00%00%00%FF%8E%00%00%00%00%00%00%00%F8&end_key=t%80%00%00%00%00%00%00%FF%8F%00%00%00%00%00%00%00%F8": context canceled
```

The error reported in the TiDB SQL log:

`{"level":"WARN","time":"2025/07/25 03:41:56.584 +00:00","caller":"expensivequery.go:96","message":"execution timeout, kill it","costTime":"286.803962ms","maxExecutionTime":"200ms","processInfo":"{id:1782250078, user:root, host:10.3.1.21:52204, db:, command:Query, time:0, state:autocommit, info:select * from information_schema.TABLE_STORAGE_STATS where table_schema='schema'}"}`

### 2. What did you expect to see? (Required)
`query max execution time has exceeded`

### 3. What did you see instead (Required)

`ERROR 1105 (HY000): Get "https://infra-tidb-pd-schema-prod-0a03076e:2379/pd/api/v1/stats/region?start_key=t%80%00%00%00%00%00%00%FF%8E%00%00%00%00%00%00%00%F8&end_key=t%80%00%00%00%00%00%00%FF%8F%00%00%00%00%00%00%00%F8": context canceled`

### 4. What is your TiDB version? (Required)

```
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v8.1.1
Edition: Community
Git Commit Hash: e829aa43c370cabdc21dfa2aa1c1ffb16cd1d727
Git Branch: HEAD
UTC Build Time: 2025-01-09 21:58:11
GoVersion: go1.21.1
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```

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.