[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Deadlock happens when sink to mysql

Hi Experts,
I use the following sql, and sink to mysql, 
    album_id, date
group by
    album_id, date;

when sink to mysql, the following SQL is executed: insert into xxx (c1,c2,c3) values (?,?,?) on duplicate key update c1=VALUES(c1),c2=VALUES(c2), c3=VALUES(c3)
        The engine is InnoDB, column c1,c2 is unique key, the isolation level is READ COMMITTED. But in the log a deadlock exception happens.
As I know, because the unique key exists, only the line lock will be applied, no gap lock will be applied. And due to a group by sentence, the same unique key should be written by the same thread. So in this case, why the dead lock should happened? Could anyone help me? Thanks a lot.