pingcap / pingcap/tidb

The resultSet closes particularly late causing the Query_time of slow query log to be in inaccurate

Open
#33,932 1 comment 0 reactions 0 assignees 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

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

The simple Java code looks something like this:
```
String preSql = "select * from t where a = ?";
PreparedStatement ps = conn.prepareStatement(preSql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
ps.setFetchSize(1);
ps.setLong(1, 0);
ResultSet rs = ps.executeQuery();

System.out.println("wait IO");
Thread.sleep(24000L);

rs.close(); // Or exit the process in another way.
```

### 2. What did you expect to see? (Required)
Maybe only the executed time of ComExec.

### 3. What did you see instead (Required)
`Query_time` in the slow query log is sleep time(here is 24s).

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

```
Release Version: v6.1.0-alpha-97-gb35b30bbd-dirty
Edition: Community
Git Commit Hash: b35b30bbd59cb9f0a199deba71e2ea15e1ad1d19
Git Branch: 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.