Skip to content

[Bug]: Pessimistic mode:drop primary key, then commit, insert into table failed. #11213

Closed

Description

@Ariznawlll

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Environment

- Version or commit-id (e.g. v0.1.0 or 8b23a93): 3194798c98fd5775a5f2b3b66457757bea9595db
- Hardware parameters:
- OS type:
- Others:

Actual Behavior

not wait for lock

Expected Behavior

No response

Steps to Reproduce

drop table if exists alter01;
create table alter01(col1 int not null ,col2 varchar(25));
insert into alter01 values (3,"a"),(4,"b"),(5,"c");
begin;
alter table alter01 modify col1 float;
-- @session:id=1{
-- @wait:0:commit
use transaction_enhance;
insert into alter01 values (8,"h");
select * from alter01;
-- @session
insert into alter01 values (6,"h");
commit;
select * from alter01;

Additional information

No response

Activity

  1. added
    kind/bug
    severity/s0
    on Aug 14, 2023
  2. added this to the 1.0.0 milestone on Aug 14, 2023
  3. ouyuanning commented on Aug 15, 2023

    @ouyuanning
    Contributor

    not working on it

  4. ouyuanning commented on Aug 16, 2023

    @ouyuanning
    Contributor

    same as #11217

  5. Ariznawlll commented on Aug 17, 2023

    @Ariznawlll
    CollaboratorAuthor

    the same problem:
    drop table if exists rename01;
    create table rename01 (c int primary key,d int);
    insert into rename01 values(1,1);
    insert into rename01 values(2,2);
    begin;
    insert into rename01 values(3,1);
    insert into rename01 values(4,2);
    alter table rename01 rename column c to newCCCC;
    select * from rename01;
    -- @session:id=1{
    use isolation;
    -- @wait:0:commit
    insert into rename01 (c, d) values (5,7);
    insert into rename01 (newCCCC, d) values (5,7);
    select * from rename01;
    -- @session}
    select * from rename01;
    drop table rename01;

  6. qingxinhome commented on Aug 23, 2023

    @qingxinhome
    Contributor

    Processing

  7. qingxinhome commented on Aug 24, 2023

    @qingxinhome
    Contributor

    Currently, in MO, if a table does not have a primary key defined, it is not locked in real transactions @Ariznawlll @domingozhang @ouyuanning

  8. 3 remaining items

  9. ouyuanning commented on Sep 3, 2023

    @ouyuanning
    Contributor

    not working on it

  10. ouyuanning commented on Sep 5, 2023

    @ouyuanning
    Contributor

    same as #11217

  11. ouyuanning commented on Sep 8, 2023

    @ouyuanning
    Contributor

    待11217合并。应该是同样的问题

  12. ouyuanning commented on Sep 12, 2023

    @ouyuanning
    Contributor

    待11217合并再检查看看

  13. Ariznawlll commented on Sep 14, 2023

    @Ariznawlll
    CollaboratorAuthor

    drop table if exists alter01;
    create table alter01(col1 int primary key,col2 varchar(25));
    insert into alter01 values (3,"a"),(4,"b"),(5,"c");
    begin;
    alter table alter01 drop primary key;
    -- @session:id=1{
    -- @wait:0:commit
    use transaction_enhance;
    insert into alter01 values (5,"h");
    select * from alter01;
    -- @session
    insert into alter01 values (6,"h");
    select * from alter01;
    drop table alter01;

    Actual behavior:
    image

    Expect behavior:
    session 1: alter table drop primary key, session 2: insert into alter01 values (5,"h"), session1: commit, session2: insert into alter01 values (5,"h") execute success!

  14. changed the title [-][Bug]: Pessimistic mode:alter table does not wait for lock in alter table modify column sql.[/-] [+][Bug]: Pessimistic mode:drop primary key, then commit, insert into table failed.[/+] on Sep 14, 2023
  15. ouyuanning commented on Sep 15, 2023

    @ouyuanning
    Contributor

    session 2等到session 1 free lock之后。并没有执行retry,因为去重的错误覆盖掉 retry 的错误了。于是没有进入retry流程。
    下周修

  16. ouyuanning commented on Sep 19, 2023

    @ouyuanning
    Contributor

    还没时间看

  17. jensenojs commented on Oct 7, 2023

    @jensenojs
    Contributor

    相关pr已合入

  18. Ariznawlll commented on Oct 8, 2023

    @Ariznawlll
    CollaboratorAuthor

    verified!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions