pingcap / pingcap/tidb

tidb repeatable read isolation level does not allow phantom read

Open
#57,440 1 comment 0 reactions 0 assignees View on GitHub
type/question
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

### 1. Minimal reproduce step (Required)

Screenshot 2024-11-17 at 8 47 24 PM

### 2. What did you expect to see? (Required)
Per [definition](https://www.pingcap.com/article/exploring-read-committed-and-repeatable-read-isolation-levels):

**Repeatable Read**: Guarantees that if a transaction reads a row, it will see the same data throughout the transaction, preventing dirty reads and non-repeatable reads but allowing **phantom reads**.

The test case creates a phantom reads scenario, so the data inserted at *t2* should be seen at *t3*.

### 3. What did you see instead (Required)
In tidb, at *t3* transaction 1 can't see data inserted at *t2* by transaction 2.
This is incompatible with **Repeatable Read** definition. So it's also incompatible with mysql

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

```sql
mysql> select @@version;
+--------------------+
| @@version |
+--------------------+
| 8.0.11-TiDB-v7.5.3 |
+--------------------+
1 row in set (0.00 sec)
```

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.