原創(chuàng):全文帶入了大量自我認(rèn)知和理解,可能錯誤,因?yàn)樗接邢?,但是代表我努力分析過。
一、問題提出
問題是由姜大師提出的、問題如下:
表:
MySQL> show create table c \G
*************************** 1. row ***************************
Table: c
Create Table: CREATE TABLE `c` (
`a` int(11) NOT NULL AUTO_INCREMENT,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `b` (`b`)
) ENGINE=InnoDB
1 row in set (0.01 sec)
開啟兩個(gè)會話不斷的執(zhí)行
replace into c values(NULL,1);
會觸發(fā)死鎖。問死鎖觸發(fā)的原因。
我使用的環(huán)境:
MYSQL 5.7.14 debug版本、隔離級別RR、自動提交,很顯然這里的c表中的可以select出來的記錄始終是1條
只是a列不斷的增大,但是這里實(shí)際存儲空間確不止1條,因?yàn)閺膆eap no來看二級索引中,heap no 已經(jīng)到了
7,也就是有至少7(7-1)條記錄,只是其他記錄標(biāo)記為del并且被purge線程放到了page free_list中。
二、準(zhǔn)備工作和使用方法
1、稍微修改了源碼關(guān)于鎖的打印部分,我們知道每個(gè)事物下顯示鎖內(nèi)存結(jié)構(gòu)lock
struct會連接成一個(gè)鏈表,只要按照順序打印出內(nèi)存lock struct就打印出了
所有關(guān)于這個(gè)事物顯示鎖全部信息和加鎖順序如下:
點(diǎn)擊(此處)折疊或打開
10年積累的做網(wǎng)站、成都網(wǎng)站設(shè)計(jì)經(jīng)驗(yàn),可以快速應(yīng)對客戶對網(wǎng)站的新想法和需求。提供各種問題對應(yīng)的解決方案。讓選擇我們的客戶得到更好、更有力的網(wǎng)絡(luò)服務(wù)。我雖然不認(rèn)識你,你也不認(rèn)識我。但先網(wǎng)站設(shè)計(jì)后付款的網(wǎng)站建設(shè)流程,更有邳州免費(fèi)網(wǎng)站建設(shè)讓你可以放心的選擇與我們合作。
-
---TRANSACTION 184771, ACTIVE 45 sec
-
4 lock struct(s), heap size 1160, 3 row lock(s)
-
MySQL thread id 2, OS thread handle 140737154311936, query id 642 localhost root cleaning up
-
---lock strcut(1):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK for this Trx
-
TABLE LOCK table `test`.`c4` trx id 184771 lock mode IX
-
---lock strcut(2):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK for this Trx
-
RECORD LOCKS space id 413 page no 4 n bits 72 index id2 of table `test`.`c4` trx id 184771 lock_mode X(LOCK_X)
-
Record lock, heap no 4 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
-
0: len 4; hex 80000014; asc ;;
-
1: len 4; hex 80000014; asc ;;
-
---lock strcut(3):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK for this Trx
-
RECORD LOCKS space id 413 page no 3 n bits 72 index PRIMARY of table `test`.`c4` trx id 184771 lock_mode X(LOCK_X) locks rec but not gap(LOCK_REC_NOT_GAP)
-
Record lock, heap no 4 PHYSICAL RECORD: n_fields 4; compact format; info bits 0
-
0: len 4; hex 80000014; asc ;;
-
1: len 6; hex 00000002d1bd; asc ;;
-
2: len 7; hex a600000e230110; asc # ;;
-
3: len 4; hex 80000014; asc ;;
-
---lock strcut(4):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK for this Trx
-
RECORD LOCKS space id 413 page no 4 n bits 72 index id2 of table `test`.`c4` trx id 184771 lock_mode X(LOCK_X) locks gap before rec(LOCK_GAP)
-
Record lock, heap no 5 PHYSICAL RECORD: n_fields 2; compact format; info bits 0
-
0: len 4; hex 8000001e; asc ;;
-
1: len 4; hex 8000001e; asc ;;
正常的版本只有
-
---TRANSACTION 184771, ACTIVE 45 sec
-
4 lock struct(s), heap size 1160, 3 row lock(s)
-
MySQL thread id 2, OS thread handle 140737154311936, query id 642 localhost root cleaning up
部分后面的都是我加上的,其實(shí)修改很簡單,innodb其實(shí)自己寫好了只是沒有開啟,我開啟后加上了序號來表示順序。
上面是一個(gè) select * from c where id2= 20 for update; b列為輔助索引的所有4 lock struct(s),可以看到有了這些信息分析
不那么難了。
這里稍微分析一下
表結(jié)構(gòu)為:
mysql> show create table c4;
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| c4 | CREATE TABLE `c4` (
`id1` int(11) NOT NULL,
`id2` int(11) DEFAULT NULL,
PRIMARY KEY (`id1`),
KEY `id2` (`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
數(shù)據(jù)為:
mysql> select * from c4;
+-----+------+
| id1 | id2 |
+-----+------+
| 1 | 1 |
| 10 | 10 |
| 20 | 20 |
| 30 | 30 |
+-----+------+
4 rows in set (0.00 sec)
語句為:
select * from c where id2= 20 for update;
RR模式
從鎖結(jié)構(gòu)鏈表來看,這個(gè)語句在輔助索引分別鎖定了
id2:20 id1:20 LOCK_X|LOCK_ORDINARY 也就是NEXT KEY LOCK
同時(shí)鎖定了
id2:30 id1:30 LOCK_X|LOCK_GAP也就是gap lock不包含這一列
那么畫個(gè)圖容易理解黃色部分為鎖定部分:

是不是一目了然?如果是rc那么鎖定的只有記錄了兩個(gè)黃色箭頭
表示gap沒有了就不在畫圖了
2、在死鎖檢測回滾前調(diào)用這個(gè)打印函數(shù)打印到err日志文件中,打印出全部的事物的顯示內(nèi)存lock struct如下,這里就
不給出了,后面會有replace觸發(fā)死鎖千事物鎖結(jié)構(gòu)的一個(gè)輸出
3、使用MYSQL TRACE SQL語句得到大部分的函數(shù)調(diào)用來分析replace的過程
修改出現(xiàn)的問題:修改源碼打印出所有l(wèi)ock struct 在線上顯然是不能用的。因?yàn)榇蛴〕鰜砗髎how engine innodb status 會非常
長,甚至引發(fā)其他問題,但是測試是可以,其次修改了打印死鎖事物鎖鏈表到日志后,每次只要遇到死鎖信息可以打印
到日志,但是每次MYSQLD都會掛掉,但是不影響分析了。
三、預(yù)備知識(自我理解)
1、
Precise modes:
#define LOCK_ORDINARY 0 /*!< this flag denotes an ordinary
next-key lock in contrast to LOCK_GAP
or LOCK_REC_NOT_GAP */
默認(rèn)是LOCK_ORDINARY及普通的next_key_lock,鎖住行及以前的間隙
#define LOCK_GAP 512 /*!< when this bit is set, it means that the
lock holds only on the gap before the record;
for instance, an x-lock on the gap does not
give permission to modify the record on which
the bit is set; locks of this type are created
when records are removed from the index chain
of records */
間隙鎖,鎖住行以前的間隙,不鎖住本行
#define LOCK_REC_NOT_GAP 1024 /*!< this bit means that the lock is only on
the index record and does NOT block inserts
to the gap before the index record; this is
used in the case when we retrieve a record
with a unique key, and is also used in
locking plain SELECTs (not part of UPDATE
or DELETE) when the user has set the READ
COMMITTED isolation level */
行鎖,鎖住行而不鎖住任何間隙
#define LOCK_INSERT_INTENTION 2048 /*!< this bit is set when we place a waiting
gap type record lock request in order to let
an insert of an index record to wait until
there are no conflicting locks by other
transactions on the gap; note that this flag
remains set when the waiting lock is granted,
or if the lock is inherited record */
插入意向鎖,如果插入的記錄在某個(gè)已經(jīng)鎖定的間隙內(nèi)為這個(gè)鎖
2、參數(shù)innodb_autoinc_lock_mode的值為1,也許不能保證replace into的順序。
3、infimum和supremum
一個(gè)page中包含這兩個(gè)偽列,頁中所有的行未刪除(刪除未purge)的行都連接到這兩個(gè)虛列之間,其中
supremum偽列的鎖始終為next_key_lock。
4、heap no
此行在page中的heap no heap no存儲在fixed_extrasize 中,heap no 為物理存儲填充的序號,頁的空閑空間掛載在page free鏈表中(頭插法)可以重用,
但是重用此heap no不變,如果一直是insert 則heap no 不斷增加,并非按照KEY大小排序的邏輯鏈表順序,而是物理填充順序
5、n bits
和這個(gè)page相關(guān)的鎖位圖的大小如果我的表有9條數(shù)據(jù) 還包含2個(gè)infimum和supremum虛擬列 及 64+11 bits,及75bits但是必須被8整除為一個(gè)字節(jié)就是
80 bits
6、隱含鎖(Implicit lock)和顯示鎖(explict)
鎖有隱含和顯示之分。隱含鎖通常發(fā)生在 insert 的時(shí)候?qū)luster index和second index 都加隱含鎖,如果是UPDATE(DELETE)對cluster index加顯示鎖 輔助
索引加隱含鎖。目的在于減少鎖結(jié)構(gòu)的內(nèi)存開銷,如果有事務(wù)需要和這個(gè)隱含鎖而不兼容,這個(gè)事務(wù)需要幫助 insert或者update(delete)事物將隱含
鎖變?yōu)轱@示鎖,然后給自己加鎖,通常insert主鍵檢查會給自己加上S鎖,REPLACE、delete、update通常會給自己加上X鎖。
四、replace過程分析
通過replace的trace找到了這些步驟的大概調(diào)用:
首先我們假設(shè)
TRX1:replace 不提交
TRX2:replace 堵塞
TRX1:replace 提交
TRX2:replace 繼續(xù)執(zhí)行直到完成
這樣做的目的在于通過trace找到TRX2在哪里等待,確實(shí)如我所愿我找到了。
1、檢查是否沖突,插入主鍵
-
569 T@4: | | | | | | | | >row_ins
-
570 T@4: | | | | | | | | | row_ins: table: test/c
-
571 T@4: | | | | | | | | | >row_ins_index_entry_step
-
572 T@4: | | | | | | | | | | >row_ins_clust_index_entry
-
573 T@4: | | | | | | | | | | | >row_ins_clust_index_entry_low
-
574 T@4: | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
575 T@4: | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
576 T@4: | | | | | | | | | | | | ib_cur: insert PRIMARY (366) by 183808: TUPLE (info_bits=0, 4 fields): {[4] %(0x00000005),[6] (0x000000020E00),[7] (0x 0A000001010100),[4] (0x00000001)}
-
577 T@4: | | | | | | | | | | | <row_ins_clust_index_entry_low 2649
-
578 T@4: | | | | | | | | | | <row_ins_clust_index_entry 3313
-
579 T@4: | | | | | | | | | <row_ins_index_entry_step 3589
2、檢查是否沖突,插入輔助索引,這里實(shí)際上就是會話2被堵塞的地方,如下解釋
(如果沖突回滾先前插入的主鍵內(nèi)容)
-
580 T@4: | | | | | | | | | >row_ins_index_entry_step 3589
-
581 T@4: | | | | | | | | | | >row_ins_sec_index_entry_low
-
582 T@4: | | | | | | | | | | | >btr_cur_search_to_nth_level
-
583 T@4: | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
584 T@4: | | | | | | | | | | | >row_ins_scan_sec_index_for_duplicate
-
585 T@4: | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
586 T@4: | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
587 T@4: | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
588 T@4: | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
589 T@4: | | | | | | | | | | | | >row_vers_impl_x_locked_low
-
590 T@4: | | | | | | | | | | | | | info: Implicit lock is held by trx:183803
-
591 T@4: | | | | | | | | | | | | <row_vers_impl_x_locked_low 329
-
592 T@4: | | | | | | | | | | | | >thd_report_row_lock_wait
-
593 T@4: | | | | | | | | | | | | <thd_report_row_lock_wait 4246
-
594 T@4: | | | | | | | | | | | <row_ins_scan_sec_index_for_duplicate 2148
-
595 T@4: | | | | | | | | | | <row_ins_sec_index_entry_low 3043
-
596 T@4: | | | | | | | | | <row_ins_index_entry_step 3589
-
597 T@4: | | | | | | | | <row_ins 3758
-
598 //wait here
-
這里我做trace的時(shí)候事物的trace停止在了這里我特意加上了598//wait here從下面的輸出
-
我們也能肯定確實(shí)這里觸發(fā)了鎖等待
-
>row_vers_impl_x_locked_low
-
| info: Implicit lock is held by trx:183803
-
<row_vers_impl_x_locked_low 329
-
>thd_report_row_lock_wait
-
<thd_report_row_lock_wait 4246
-
等待獲得鎖過后重新檢查:
-
599 T@4: | | | | | | | | >row_ins
-
600 T@4: | | | | | | | | | row_ins: table: test/c
-
601 T@4: | | | | | | | | | >row_ins_index_entry_step
-
602 T@4: | | | | | | | | | | >row_ins_sec_index_entry_low
-
603 T@4: | | | | | | | | | | | >btr_cur_search_to_nth_level
-
604 T@4: | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
605 T@4: | | | | | | | | | | | >row_ins_scan_sec_index_for_duplicate
-
606 T@4: | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
607 T@4: | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
608 T@4: | | | | | | | | | | | <row_ins_scan_sec_index_for_duplicate 2148
-
609 T@4: | | | | | | | | | | <row_ins_sec_index_entry_low 3043
-
610 T@4: | | | | | | | | | <row_ins_index_entry_step 3589
-
611 T@4: | | | | | | | | <row_ins 3810
我們可以隱隱約約看到row_ins_sec_index_entry_low和row_ins_clust_index_entry_low回檢查是否有重復(fù)的行
分別代表是二級索引和聚集索引的相關(guān)檢查,因?yàn)榫瓦@個(gè)案例主鍵不可能出現(xiàn)重復(fù)值,而二級索引這個(gè)例子中肯定是
重復(fù)的,索引row_ins_sec_index_entry_low觸發(fā)了等待,其實(shí)我們知道這里的鎖方式如下列子:
---lock strcut(2):(Add by gaopeng) In modify Version I force check all REC_LOCK/TAB_LOCK chain! for this Trx
RECORD LOCKS space id 406 page no 4 n bits 72 index b of table `test`.`c` trx id 177891 lock_mode X(LOCK_X) waiting(LOCK_WAIT)
Record lock, heap no 3 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
0: len 4; hex 80000001; asc ;;
1: len 4; hex 80000006; asc ;;
LOCK_X|LOCK_ORDINARY|LOCK_WAIT:需要X的next_key lock處于等待狀態(tài)他需要鎖定(infimum,{1,6}]這個(gè)區(qū)間。
這也是死鎖發(fā)生的關(guān)鍵一個(gè)環(huán)節(jié)。
3、這里涉及到了回滾操作,從下面的trace輸出我們也能看到確實(shí)做了回滾
實(shí)際上事物2會堵塞在這里,因?yàn)槲易鰐race的時(shí)候他一直停在
這里不動了。為此我還加上598行說明在這里wait了
-
612 T@4: | | | | | | | | ib_que: Execute 9 (QUERY THREAD) at 0x7fffe804b7d8
-
613 T@4: | | | | | | | | ib_que: Execute 12 (ROLLBACK) at 0x7fffe804b6b0
-
614 T@4: | | | | | | | | ib_que: Execute 12 (ROLLBACK) at 0x7fffe804b6b0
-
615 T@4: | | | | | | | | ib_que: Execute 9 (QUERY THREAD) at 0x7fffe804b7d8
-
616 T@4: | | | | | | | | ib_que: Execute 9 (QUERY THREAD) at 0x7fffe800eec8
-
617 T@4: | | | | | | | | ib_que: Execute 10 (UNDO ROW) at 0x7fffe801b090
-
618 T@4: | | | | | | | | >btr_cur_search_to_nth_level
-
619 T@4: | | | | | | | | <btr_cur_search_to_nth_level 2005
-
620 T@4: | | | | | | | | >btr_cur_search_to_nth_level
-
621 T@4: | | | | | | | | <btr_cur_search_to_nth_level 2005
-
622 T@4: | | | | | | | | ib_que: Execute 10 (UNDO ROW) at 0x7fffe801b090
-
623 T@4: | | | | | | | | ib_que: Execute 9 (QUERY THREAD) at 0x7fffe800eec8
4、這個(gè)重復(fù)key會傳遞給SERVER層次,并且貌似重新初始化了事物(只是從trace猜測)
-
639 T@4: | | | | | | >handler::get_dup_key
-
640 T@4: | | | | | | | >info
-
641 T@4: | | | | | | | | >ha_innobase::update_thd
-
642 T@4: | | | | | | | | | ha_innobase::update_thd: user_thd: 0x7fffe8000b90 -> 0x7fffe8000b90
-
643 T@4: | | | | | | | | | >innobase_trx_init
-
644 T@4: | | | | | | | | | <innobase_trx_init 2765
-
645 T@4: | | | | | | | | <ha_innobase::update_thd 3073
-
646 T@4: | | | | | | | <info 14717
-
647 T@4: | | | | | | <handler::get_dup_key 4550
-
648 T@4: | | | | | | >column_bitmaps_signal
-
649 T@4: | | | | | | | info: read_set: 0x7fffc8941da0 write_set: 0x7fffc8941da0
-
650 T@4: | | | | | | <column_bitmaps_signal 3846
-
651 T@4: | | | | | | >innobase_trx_init
-
652 T@4: | | | | | | <innobase_trx_init 2765
-
653 T@4: | | | | | | >index_init
-
654 T@4: | | | | | | <index_init 8864
5、接下就是真正刪除插入主鍵
-
689 T@4: | | | | | | | | >row_update_for_mysql_using_upd_graph
-
690 T@4: | | | | | | | | | >row_upd_step
-
691 T@4: | | | | | | | | | | >row_upd
-
692 T@4: | | | | | | | | | | | row_upd: table: test/c
-
693 T@4: | | | | | | | | | | | row_upd: info bits in update vector: 0x0
-
694 T@4: | | | | | | | | | | | row_upd: foreign_id: NULL
-
695 T@4: | | | | | | | | | | | ib_cur: delete-mark clust test/c (366) by 183808: COMPACT RECORD(info_bits=32, 4 fields): {[4] $(0x00000004),[6] (0x000000020D 0B),[7] (0x00000001090100),[4] (0x00000001)}
-
696 T@4: | | | | | | | | | | | >row_ins_clust_index_entry
-
697 T@4: | | | | | | | | | | | | >row_ins_clust_index_entry_low
-
698 T@4: | | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
699 T@4: | | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
700 T@4: | | | | | | | | | | | | | ib_cur: insert PRIMARY (366) by 183808: TUPLE (info_bits=0, 4 fields): {[4] %(0x00000005),[6](0x000000020E00),[7] ( 0x00000001090100),[4] (0x00000001)}
-
701 T@4: | | | | | | | | | | | | <row_ins_clust_index_entry_low 2649
-
702 T@4: | | | | | | | | | | | <row_ins_clust_index_entry 3313
-
703 T@4: | | | | | | | | | | | >btr_cur_search_to_nth_level
-
704 T@4: | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
705 T@4: | | | | | | | | | | | ib_cur: delete-mark=1 sec 406:4:2 in b(367) by 183808
6、接下就是真正插入輔助索引
-
706 T@4: | | | | | | | | | | | >row_ins_sec_index_entry_low
-
707 T@4: | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
708 T@4: | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
709 T@4: | | | | | | | | | | | | >row_ins_scan_sec_index_for_duplicate
-
710 T@4: | | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
711 T@4: | | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
712 T@4: | | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
713 T@4: | | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
714 T@4: | | | | | | | | | | | | | >row_vers_impl_x_locked_low
-
715 T@4: | | | | | | | | | | | | | <row_vers_impl_x_locked_low 123
-
716 T@4: | | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
717 T@4: | | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
718 T@4: | | | | | | | | | | | | | >row_vers_impl_x_locked_low
-
719 T@4: | | | | | | | | | | | | | | info: Implicit lock is held by trx:183808
-
720 T@4: | | | | | | | | | | | | | <row_vers_impl_x_locked_low 329
-
721 T@4: | | | | | | | | | | | | <row_ins_scan_sec_index_for_duplicate 2148
-
722 T@4: | | | | | | | | | | | | >btr_cur_search_to_nth_level
-
723 T@4: | | | | | | | | | | | | <btr_cur_search_to_nth_level 2005
-
724 T@4: | | | | | | | | | | | | ib_cur: insert b (367) by 183808: TUPLE (info_bits=0, 2 fields): {[4] (0x00000001),[4] %(0x00000005)}
-
725 T@4: | | | | | | | | | | | <row_ins_sec_index_entry_low 3194
-
726 T@4: | | | | | | | | | | <row_upd 3066
-
727 T@4: | | | | | | | | | <row_upd_step 3181
-
728 T@4: | | | | | | | | <row_update_for_mysql_using_upd_graph 2670
-
729 T@4: | | | | | | | <ha_innobase::update_row 8656
注意:上面只是看trace出來的過程,很多是根據(jù)函數(shù)調(diào)用進(jìn)行的猜測。
五、死鎖前事物鎖信息打印分析
打印出死鎖前事物的全部信息
-
------------------------
-
LATEST DETECTED DEADLOCK
-
------------------------
-
2017-06-29 14:10:30 0x7fa48148b700
-
*** (1) TRANSACTION:
-
TRANSACTION 4912797, ACTIVE 0 sec inserting
-
mysql tables in use 1, locked 1
-
LOCK WAIT 2 lock struct(s), heap size 1136, 1 row lock(s), undo log entries 1
-
MySQL thread id 2, OS thread handle 140344520656640, query id 3371 localhost root update
-
replace into c values(num,1)
-
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
-
RECORD LOCKS space id 598 page no 4 n bits 80 index b of table `test`.`c` trx id 4912797 lock_mode X waiting
-
Record lock, heap no 3 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
-
0: len 4; hex 80000001; asc ;;
-
1: len 4; hex 800007d5; asc ;;
-
-
*** (2) TRANSACTION:
-
TRANSACTION 4912793, ACTIVE 0 sec updating or deleting
-
mysql tables in use 1, locked 1
-
6 lock struct(s), heap size 1136, 6 row lock(s), undo log entries 2
-
MySQL thread id 3, OS thread handle 140344520390400, query id 3365 localhost root update
-
replace into c values(num,1)
-
*** (2) HOLDS THE LOCK(S):
-
RECORD LOCKS space id 598 page no 4 n bits 80 index b of table `test`.`c` trx id 4912793 lock_mode X
-
Record lock, heap no 3 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
-
0: len 4; hex 80000001; asc ;;
-
1: len 4; hex 800007d5; asc ;;
-
-
*** (2) WAITING FOR THIS LOCK TO BE GRANTED:
-
RECORD LOCKS space id 598 page no 4 n bits 80 index b of table `test`.`c` trx id 4912793 lock_mode X locks gap before rec insert intention waiting
-
Record lock, heap no 3 PHYSICAL RECORD: n_fields 2; compact format; info bits 32
-
0: len 4; hex 80000001; asc ;;
-
1: len 4; hex 800007d5; asc ;;
-
-
**
網(wǎng)站欄目:MYSQLINNODBreplaceinto死鎖及nextkeylock淺析
URL鏈接:http://jinyejixie.com/article42/ipehec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、微信公眾號、云服務(wù)器、網(wǎng)站建設(shè)、網(wǎng)站收錄、網(wǎng)頁設(shè)計(jì)公司
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源:
創(chuàng)新互聯(lián)