Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: after insert transaction, truncate table not wait lock release #14633

Open
1 task done
heni02 opened this issue Feb 22, 2024 · 59 comments
Open
1 task done

[Bug]: after insert transaction, truncate table not wait lock release #14633

heni02 opened this issue Feb 22, 2024 · 59 comments
Assignees
Labels
kind/bug Something isn't working severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Milestone

Comments

@heni02
Copy link
Contributor

heni02 commented Feb 22, 2024

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

90ee283

Other Environment Information

- Hardware parameters:
- OS type:
- Others:

Actual Behavior

mo :
企业微信截图_aa76d4e0-d578-41a7-9de9-451d05ecdee3
企业微信截图_f2f2c901-b591-42a7-898f-7474c1c1463a

but mysql rr and rc isolation ,truncate table wait lock release
企业微信截图_88fc32dc-786c-43a9-8548-5f938f56e3cc
企业微信截图_243ce9dc-7ee8-4480-9b7f-fba95661cdb1
企业微信截图_90c4e98a-cd8c-498b-9929-b0100b0a07d6

Expected Behavior

No response

Steps to Reproduce

create table t1(a int);
begin;
insert into t1 values (1);
select * from t1;
-- @session:id=1{
use drop_table_truncate;
truncate table t1;
select * from t1;
-- @session}
select * from t1;
commit;

Additional information

No response

@heni02 heni02 added kind/bug Something isn't working severity/s0 Extreme impact: Cause the application to break down and seriously affect the use labels Feb 22, 2024
@heni02 heni02 added this to the 1.2.0 milestone Feb 22, 2024
@ouyuanning
Copy link
Contributor

create table t1(a int); // table without pk, can not lock
create table t1(a int primary key); // table with pk, that will be fine

@iamlinjunhong
Copy link
Contributor

正常处理

@iamlinjunhong
Copy link
Contributor

暂无进度

11 similar comments
@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@aressu1985 aressu1985 modified the milestones: 1.2.0, 1.3.0-Backlog Apr 24, 2024
@iamlinjunhong
Copy link
Contributor

暂无进度

7 similar comments
@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

11 similar comments
@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@iamlinjunhong
Copy link
Contributor

暂无进度

@aressu1985
Copy link
Contributor

@iamlinjunhong 这个目前什么进展?

@iamlinjunhong
Copy link
Contributor

已知问题,正在处理

@iamlinjunhong
Copy link
Contributor

正在处理

@iamlinjunhong
Copy link
Contributor

符合预期, 事务隔离级别为 rc,事务 a insert 1,实际上在 事务a 提交之前 事务b是看不到的,所以 truncate 不需要等待。

@ouyuanning
Copy link
Contributor

ouyuanning commented Oct 24, 2024

感觉这个本质是 truncate 是否是DDL类语句的问题。
也就是 truncate是 delete from t1还是 drop table t1, create table t1的问题。

如果是 delete from t1的语义,那么新insert的本来就看不到,不需要锁等待。
如果是drop table t1... 的话,那么要上排它锁也无可厚非。

感觉可以让田博士和高老师看看

@heni02
Copy link
Contributor Author

heni02 commented Oct 24, 2024

需确实是否修改该行为

@heni02 heni02 assigned aressu1985 and unassigned heni02 Oct 24, 2024
@aressu1985 aressu1985 modified the milestones: 2.0.0, 2.0.1 Oct 28, 2024
@xzxiong
Copy link
Contributor

xzxiong commented Nov 7, 2024

note: 当做 drop table 等同加锁。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working severity/s0 Extreme impact: Cause the application to break down and seriously affect the use
Projects
None yet
Development

No branches or pull requests

7 participants