mysql innodb 死锁_MySQL Innodb的死锁问题

引用

100528 14:16:03

*** (1) TRANSACTION:

TRANSACTION 1 720592357, ACTIVE 0 sec, process no 3588, OS thread id 1337043264 inserting

mysql tables in use 1, locked 1

LOCK WAIT 3 lock struct(s), heap size 1216, undo log entries 1

MySQL thread id 4380151, query id 549555384 192.168.0.98 root update

insert into by_useronline(byid,logintime,nickname,sex,birthday,area) values(31936074,now(),'????',1,'1989-11-14',119)

*** (1) WAITING FOR THIS LOCK TO BE GRANTED:

RECORD LOCKS space id 0 page no 827664 n bits 1056 index `byid` of table `byread/by_useronline` trx id 1 720592357 lock_mode X locks gap before rec insert intention waiting

Record lock, heap no 400 PHYSICAL RECORD: n_fields 2; 1-byte offs TRUE; info bits 0

0: len 4; hex 01e74ed9; asc   N ;; 1: len 4; hex 16d9283d; asc   (=;;

*** (2) TRANSACTION:

TRANSACTION 1 720592355, ACTIVE 0 sec, process no 3588, OS thread id 1178097984 setting auto-inc lock, thread declared inside InnoDB 500

mysql tables in use 1, locked 1

3 lock struct(s), heap size 1216

MySQL thread id 4380129, query id 549555386 192.168.0.98 root update

insert into by_useronline(byid,logintime,nickname,sex,birthday,area) values(35707122,now(),'?,1,'1991-06-22',1)

*** (2) HOLDS THE LOCK(S):

RECORD LOCKS space id 0 page no 827664 n bits 1056 index `byid` of table `byread/by_useronline` trx id 1 720592355 lock_mode X locks gap before rec

Record lock, heap no 400 PHYSICAL RECORD: n_fields 2; 1-byte offs TRUE; info bits 0

0: len 4; hex 01e74ed9; asc   N ;; 1: len 4; hex 16d9283d; asc   (=;;

*** (2) WAITING FOR THIS LOCK TO BE GRANTED:

TABLE LOCK table `byread/by_useronline` trx id 1 720592355 lock mode AUTO-INC waiting

*** WE ROLL BACK TRANSACTION (2)

InnoDB会自动的检测死锁进行回滚,或者终止死锁的情况。

引用

InnoDB automatically detects transaction deadlocks and rolls back a transaction or transactions to break the deadlock. InnoDB tries to pick small transactions to roll back, where the size of a transaction is determined by the number of rows inserted, updated, or deleted.

如果参数innodb_table_locks=1并且autocommit=0时,InnoDB会留意表的死锁,和MySQL层面的行级锁。另外,InnoDB不会检测MySQL的Lock Tables命令和其他存储引擎死锁。

你应该设置innodb_lock_wait_timeout来解决这种情况。

innodb_lock_wait_timeout是Innodb放弃行级锁的超时时间。

引用

InnoDB is aware of table locks if innodb_table_locks = 1 (the default) and autocommit = 0, and the MySQL layer above it knows about row-level locks. Otherwise, InnoDB cannot detect deadlocks where a table lock set by a MySQL LOCK TABLES  statement or a lock set by a storage engine other than InnoDB is involved. You must resolve these situations by setting the value of the innodb_lock_wait_timeout system variable.

分享到:

18e900b8666ce6f233d25ec02f95ee59.png

72dd548719f0ace4d5f9bca64e1d7715.png

2010-05-28 14:30

浏览 3764

分类:数据库

评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值