pingcap / pingcap/tidb

Query in transaction got stuck

Open
#69,874 3 comments 0 reactions 0 assignees View on GitHub
contribution may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major sig/transaction 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)
```sql
create table t0(c0 float);
create index i0 on t0(c0);
insert ignore into t0(c0) values (-1.79065138e8), (0.9634314192628589), (0.5916481635621268);

-- in session 1:
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN OPTIMISTIC;

--in session 2:
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
UPDATE t0 SET c0 = 683 WHERE ((t0.c0)=(false));
COMMIT;

-- in session 1:
UPDATE t0 SET c0 = c0 - 47 WHERE ((t0.c0) IS NOT NULL);
SELECT MAX(t0.c0) FROM t0 WHERE t0.c0;
```

### 2. What did you expect to see? (Required)
query executed successfully

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

query got stuck

### 4. What is your TiDB version? (Required)
```sql
mysql> select version();
+-----------------------------------------------------+
| version() |
+-----------------------------------------------------+
| 8.0.11-TiDB-v9.0.0-beta.1.pre-640-g24903d6b24-dirty |
+-----------------------------------------------------+
1 row in set (0.00 sec)

```

Contributor guide

Open the contributing guide

Research direction

Start by running the supplied SQL reproduction in two sessions on the reported TiDB version, including the READ COMMITTED and optimistic transaction steps. Trace where the final UPDATE or SELECT stops, and consider the issue done when the reproduction completes successfully instead of remaining stuck.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.