Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

unlock row could not find a 4 mode lock on the record (2 replies)

$
0
0
Hi,

Following error message appears in the log file of my 5.1.48 MySQL database:
130723 14:09:26 InnoDB: Error: unlock row could not find a 4 mode lock on the record

The query generating this message is quite complicated. I reduced it to following code:

CREATE TABLE parent_table (
  ID bigint(20),
  ID2 bigint(20),
  STATUS bigint(20),
  PRIMARY KEY (ID, ID2)
) ENGINE=InnoDB;

CREATE TABLE child_table (
  ID bigint(20),
  PARENT_ID bigint(20),
  PARENT_ID2 bigint(20),
  PRIMARY KEY (ID),
  CONSTRAINT child_table_FK1_COL FOREIGN KEY (PARENT_ID, PARENT_ID2) REFERENCES parent_table (ID, ID2)
) ENGINE=InnoDB;

insert into parent_table(ID, ID2, STATUS) values (1, 2, 42);

insert into child_table(ID, PARENT_ID, PARENT_ID2) values (3, 1, 2);

delete from child_table
where (child_table.PARENT_ID) in
  (
    select ID from
    (
      select ID from parent_table
    ) as PARENT_ALIAS
  )
and 
(
  not
  (
    (
      child_table.PARENT_ID, child_table.PARENT_ID2
    )
    in
    (
      select parent_table.ID, parent_table.ID2 from parent_table where (parent_table.STATUS <> 42)
    )
  )
)

Any explanation please?

Viewing all articles
Browse latest Browse all 1954

Trending Articles