Skip to content

The mdl lock is not fully effective when multiple clients simultaneously truncate the table. #40484

@bob34007

Description

@bob34007

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> desc test.t1;
+-------+---------+------+------+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+------+---------+-------+
| id | int(11) | YES | | NULL | |
+-------+---------+------+------+---------+-------+
1 row in set (0.00 sec)
insert into test.t1 values (1),(2),(3);
session 1: begin; select * from test.t1 for update ;
session 2: truncate table test.t1;
session 3: truncate table test.t1;

2. What did you expect to see? (Required)

session 2 and session 3 are both blocked by metadata lock

3. What did you see instead (Required)

session3 truncated data successfully

4. What is your TiDB version? (Required)

| Release Version: v6.5.0
Edition: Community
Git Commit Hash: 706c3fa
Git Branch: heads/refs/tags/v6.5.0
UTC Build Time: 2022-12-27 03:50:44
GoVersion: go1.19.3
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv |

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions