MySQL死锁场景【多表】

mysql> SELECT cc.* FROM t_channel_chatbot cc LEFT JOIN t_channel c ON cc.manage_id = c.id WHERE acct_id = '1' AND channel_name = '北京电信' FOR UPDATE;
---TRANSACTION 2564179, ACTIVE 9 sec
8 LOCK struct(s), heap SIZE 1136, 10 ROW LOCK(s)
MySQL thread id 451036, OS thread handle 140481624741632, query id 9707877 10.10.133.115 root starting
SHOW engine innodb STATUS
TABLE LOCK TABLE `lock_test`.`t_channel` trx id 2564179 LOCK mode IX
RECORD LOCKS SPACE id 7958 page no 5 n bits 80 INDEX idx_name OF TABLE `lock_test`.`t_channel` trx id 2564179 lock_mode X
Record LOCK, heap no 7 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 12; hex e58c97e4baace794b5e4bfa1; ASC             ;;
 1: len 4; hex 80000008; ASC     ;;
 
RECORD LOCKS SPACE id 7958 page no 3 n bits 80 INDEX PRIMARY OF TABLE `lock_test`.`t_channel` trx id 2564179 lock_mode X locks rec but NOT gap
Record LOCK, heap no 9 PHYSICAL RECORD: n_fields 10; compact format; info bits 0
 0: len 4; hex 80000008; ASC     ;;
 1: len 6; hex 0000002496f0; ASC    $  ;;
 2: len 7; hex a300000419016b; ASC       k;;
 3: len 12; hex 6368696e6174656c65636f6d; ASC chinatelecom;;
 4: len 12; hex e58c97e4baace794b5e4bfa1; ASC             ;;
 5: len 4; hex 80000000; ASC     ;;
 6: len 4; hex 80000000; ASC     ;;
 7: len 5; hex 99a934e86b; ASC   4 k;;
 8: len 5; hex 99a934e86d; ASC   4 m;;
 9: SQL NULL;
 
TABLE LOCK TABLE `lock_test`.`t_channel_chatbot` trx id 2564179 LOCK mode IX
RECORD LOCKS SPACE id 7970 page no 4 n bits 152 INDEX idx_chatbot OF TABLE `lock_test`.`t_channel_chatbot` trx id 2564179 lock_mode X
Record LOCK, heap no 38 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 8; hex 8000000000000008; ASC         ;;
 1: len 15; hex 313235323030343031313131303237; ASC 125200401111027;;
 2: len 8; hex 8000000000000008; ASC         ;;
 
Record LOCK, heap no 83 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 8; hex 8000000000000008; ASC         ;;
 1: len 30; hex 336432613336333966303964343436353936346337616164333437653131; ASC 3d2a3639f09d4465964c7aad347e11; (total 32 bytes);
 2: len 8; hex 800000000000000b; ASC         ;;
 
Record LOCK, heap no 84 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 8; hex 8000000000000008; ASC         ;;
 1: len 16; hex 31323532303034303131313131383134; ASC 1252004011111814;;
 2: len 8; hex 8000000000000005; ASC         ;;
 
RECORD LOCKS SPACE id 7970 page no 3 n bits 168 INDEX PRIMARY OF TABLE `lock_test`.`t_channel_chatbot` trx id 2564179 lock_mode X locks rec but NOT gap
Record LOCK, heap no 93 PHYSICAL RECORD: n_fields 14; compact format; info bits 0
 0: len 8; hex 8000000000000005; ASC         ;;
 1: len 6; hex 000000271d9d; ASC    '  ;;
 2: len 7; hex 23000004311fce; asc #   1  ;;
 3: len 8; hex 8000000000000008; asc         ;;
 4: len 1; hex 31; asc 1;;
 5: len 16; hex 31323532303034303131313131383134; asc 1252004011111814;;
 6: len 30; hex e4b8ade59bbde993b6e8a18ce6a087e58786e68ea5e58fa32d6874747020; asc                         -http ; (total 36 bytes);
 7: len 4; hex 48545450; asc HTTP;;
 8: len 7; hex 74656c65636f6d; asc telecom;;
 9: len 4; hex 80000009; asc     ;;
 10: len 4; hex 80000000; asc     ;;
 11: len 5; hex 99a8acfc36; asc     6;;
 12: len 5; hex 99acb30a90; asc      ;;
 13: len 1; hex 80; asc  ;;
 
Record lock, heap no 94 PHYSICAL RECORD: n_fields 14; compact format; info bits 0
 0: len 8; hex 8000000000000008; asc         ;;
 1: len 6; hex 000000271da3; asc    '  ;;
 2: len 7; hex 260000040d2ce4; ASC &    , ;;
 3: len 8; hex 8000000000000008; ASC         ;;
 4: len 1; hex 32; ASC 2;;
 5: len 15; hex 313235323030343031313131303237; ASC 125200401111027;;
 6: len 30; hex e5b7a5e993b6e7919ee4bfa1e6a087e58786e68ea5e58fa32d6874747020; ASC                         -http ; (total 36 bytes);
 7: len 4; hex 48545450; ASC HTTP;;
 8: len 7; hex 74656c65636f6d; ASC telecom;;
 9: len 4; hex 80000009; ASC     ;;
 10: len 4; hex 80000001; ASC     ;;
 11: len 5; hex 99a8acfc35; ASC     5;;
 12: len 5; hex 99acb30a9c; ASC      ;;
 13: len 1; hex 80; ASC  ;;
 
Record LOCK, heap no 95 PHYSICAL RECORD: n_fields 14; compact format; info bits 0
 0: len 8; hex 800000000000000b; ASC         ;;
 1: len 6; hex 000000271d98; ASC    '  ;;
 2: len 7; hex 0000000f3c2e68; asc     <.h;;
 3: len 8; hex 8000000000000008; asc         ;;
 4: len 1; hex 33; asc 3;;
 5: len 30; hex 336432613336333966303964343436353936346337616164333437653131; asc 3d2a3639f09d4465964c7aad347e11; (total 32 bytes);
 6: len 30; hex e68b9be59586e993b6e8a18ce6a087e58786e68ea5e58fa32d6874747020; asc                         -http ; (total 36 bytes);
 7: len 4; hex 48545450; asc HTTP;;
 8: len 7; hex 74656c65636f6d; asc telecom;;
 9: len 4; hex 80000009; asc     ;;
 10: len 4; hex 80000000; asc     ;;
 11: len 5; hex 99a830bed5; asc   0  ;;
 12: len 5; hex 99acb30a6d; asc     m;;
 13: len 1; hex 80; asc  ;;
 
RECORD LOCKS space id 7970 page no 4 n bits 152 index idx_chatbot of table `lock_test`.`t_channel_chatbot` trx id 2564179 lock_mode X locks gap before rec
Record lock, heap no 51 PHYSICAL RECORD: n_fields 3; compact format; info bits 0
 0: len 8; hex 8000000000000009; asc         ;;
 1: len 15; hex 313235323030343031313131303330; asc 125200401111030;;
 2: len 8; hex 800000000000000e; asc         ;;
 
RECORD LOCKS space id 7958 page no 5 n bits 80 index idx_name of table `lock_test`.`t_channel` trx id 2564179 lock_mode X locks gap before rec
Record lock, heap no 8 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
 0: len 12; hex e59b9be5b79de88194e9809a; asc             ;;
 1: len 4; hex 80000003; asc     ;;