iteye_17239 2009-12-24 15:05
浏览 245
已采纳

大家帮忙分析mysql的死锁问题[根据下面的innodb status信息]

mysql> show innodb status;


LATEST DETECTED DEADLOCK


090220 10:22:45

*** (1) TRANSACTION:

TRANSACTION 0 16339728, ACTIVE 1 sec, process no 9502, OS thread id 1081506112 starting index read

mysql tables in use 1, locked 1

LOCK WAIT 24 lock struct(s), heap size 3024, 12 row lock(s), undo log entries 14

MySQL thread id 12261700, query id 169722445 192.168.10.11 nowbesixi_writer Updating

UPDATE cns_mail_log_2 SET cns_mail_log_2.mail_from_user_type=3 WHERE cns_mail_log_2.mail_id IN (32224) AND cns_mail_log_2.type = 1

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

RECORD LOCKS space id 1525 page no 4 n bits 448 index PRIMARY of table nowbesixi.cns_mail_log_2 trx id 0 16339728 lock_mode X waiting

Record lock, heap no 2 PHYSICAL RECORD: n_fields 10; compact format; info bits 0

0: len 3; hex 000001; asc ;; 1: len 6; hex 000000608eb7; asc ` ;; 2: len 7; hex 80000000320137; asc 2 7;; 3: len 1; hex 00; asc ;; 4: len 4; hex 8000262b; asc &+;; 5: len 4; hex 8000f957; asc W;; 6: len 4; hex 80000002; asc ;; 7: len 1; hex 80; asc ;; 8: len 4; hex cb0b4d2b; asc M+;; 9: len 1; hex 80; asc ;;

*** (2) TRANSACTION:

TRANSACTION 0 16339725, ACTIVE 1 sec, process no 9502, OS thread id 1160436032 fetching rows, thread declared inside InnoDB 320

mysql tables in use 1, locked 1

1040 lock struct(s), heap size 145392, 384472 row lock(s), undo log entries 7

MySQL thread id 12262568, query id 169722418 192.168.10.12 nowbesixi_writer Updating

UPDATE cns_mail_log_2 SET cns_mail_log_2.mail_from_user_type=2 WHERE cns_mail_log_2.mail_id IN (32223) AND cns_mail_log_2.type = 1 AND cns_mail_log_2.mail_from_user_type = 1

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

RECORD LOCKS space id 1525 page no 4 n bits 448 index PRIMARY of table nowbesixi.cns_mail_log_2 trx id 0 16339725 lock_mode X

Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0

0: len 8; hex 73757072656d756d; asc supremum;;

  • 写回答

1条回答 默认 最新

  • 关键词㏄ 2009-12-24 16:37
    关注

    你看看你的事务里面
    UPDATE cns_mail_log_2 SET cns_mail_log_2.mail_from_user_type=3 WHERE cns_mail_log_2.mail_id IN (32224) AND cns_mail_log_2.type = 1
    这句话到事务提交这中间,是不是有比较大的查询,长时间无法运行完毕。
    只要不提交就会暂时锁住部分记录,这时有并发出现的话,就会出现等待。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图