master bug InnoDB Error unlock row could not find a 4 mode lock
OS:RHEL5u4_X64
VER:MYSQL5.1.40
MASTER_ERROR.LOG 報錯:
100722 11:56:19 InnoDB: Error: unlock row could not find a 4 mode lock on the record
100722 11:56:19 InnoDB: Error: unlock row could not find a 4 mode lock on the record
100722 11:56:19 InnoDB: Error: unlock row could not find a 4 mode lock on the record
從錯誤看,非常像BUG 41756 :
但條件場景不太像,我們系統變數 innodb_locks_unsafe_for_binlog=OFF,而以上BUG innodb_locks_unsafe_for_binlog=ON 才出現。
但在我們的版本中可以用以下語句重現錯誤:
drop table if exists tb1,tb2;
create table `tb2` (`a` int,`b` int) engine=innodb;
insert into `tb2` values (1,2),(1,2) ;
create table `tb1` (`a` int,`b` int primary key) engine=innodb;
insert into `tb1` values (1,1),(null,2),(1,3),(1,4);
select 1 from `tb1` natural join (select * from `tb2`) as `d` for update;
#報: 100722 12:13:11 InnoDB: Error: unlock row could not find a 5 mode lock on the record
select 1 from `tb1` natural join (select * from `tb2`) as `d` lock in share mode;
#報 :100722 12:17:39 InnoDB: Error: unlock row could not find a 4 mode lock on the record
MYSQL 解釋: 出現這個錯誤的主要原因是:
In JT_EQ_REF (join_read_key()) access method,
MySQL is calling unlock_row twice for the first table (tb1) for each SELECT.
The error message is displayed on the second call.
The MySQL layer is breaking the protocol by invoking unlock_row twice for the same row.
這種情況主要是發生在需要多表關聯並加鎖的SQL中;
鷹眼應用中,需要加鎖的select只有類似於 insert .... select 這樣的語句。 詢問開發後有這樣的語句:
insert opsnodegroup
(nodegroup_id, nodegroup_name, modify_time) select
b.nodegroup_id,
b.nodegroup_name,
b.modify_time
from
ops_nodegroup b
left outer join
opsnodegroup a
on a.nodegroup_id = b.nodegroup_id
where
a.nodegroup_id is null
and b.nodegroup_type =39 ;
但這個語句的執行時間與報錯時間不符 ;手動執行也沒有報錯;
鷹眼應用中,還有update tab1 ,tab2 這樣的語句。 但這樣的語句比較多,也無法追查;
這個BUG如果是按以上原理分析,對應用沒有影響,只是在日誌裡報一個錯誤。
我也測試了,SQL語句只要有1行匹配住,就不會報錯;
在以下場景下,類似以下語句會報錯 ;
透過全表掃描搜尋tb1(驅動表) , 但在tb1中0行匹配;
select 1 from `tb1` natural join (select * from `tb2`) as `d` for update;
select 1 from `tb1` inner join (select * from `tb2`) as `d` on tb1.a=d.a and tb1.b=d.b for update;
update tb1 ,tb2 set tb1.a=5 where tb1.a=tb2.a and tb1.b=tb2.b;
報:InnoDB: Error: unlock row could not find a 5 mode lock on the record
以上BUG 在VERSION 5.1.41有修復;
後續繼續觀察。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/703656/viewspace-1035477/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- innodb_autoinc_lock_mode
- Fatal error: Uncaught PDOException: could not find driverErrorException
- MySQL:Innodb 讓MDL LOCK和ROW LOCK 記錄到errlogMySql
- [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11Error
- OGG-00446 ERROR: Could not find archived logErrorHive
- InnoDBd的auto_increment以及innodb_autoinc_lock_modeREM
- ogg GGS ERROR 500 Could not find archived logErrorHive
- SQL error 2812: Could not find stored procedure.docSQLError
- cmake報錯CMake Error: Could not find CMAKE_ROOTError
- mysql之 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 11MySqlError
- mysql innodb_autoinc_lock_mode 的與資料庫行為MySql資料庫
- ERROR | [iOS] unknown: Encountered an unknown error (Could not find a `ios` simulator (valid values:ErroriOS
- TM LOCK MODE
- FATAL ERROR: Could not find ./bin/my_print_defaults 解決方法Error
- MySQL自增鎖模式innodb_autoinc_lock_mode引數詳解MySql模式
- AQS相關(lock、unlock、await、signal)AQSAI
- Error:Could not find com.android.tools.build:gradle:2.2.2.ErrorAndroidUIGradle
- ORACLE LOCK MODE 1.2.3.4.5.6Oracle
- MySQL 表的自增欄位 預判功能innodb_autoinc_lock_modeMySql
- apt could not get lockAPT
- Innodb:為什麼lock in share mode在show engine看不到行鎖資訊
- 解決Error (1133): Can’t find any matching row in the user tableError
- Innodb Read Only Mode
- 使用oradebug dump processstate 來診斷enq: TX - row lock contentionENQ
- Java高階-執行緒同步lock與unlock使用Java執行緒
- MySQL 5.5 LOCK TABLES 和 UNLOCK TABLES 語句介紹MySql
- java編譯 Error: Could not find or load main class java執行包main方法Java編譯ErrorAI
- MySQL自增列鎖模式 innodb_autoinc_lock_mode不同引數下效能測試MySql模式
- 【MySQL】Could not initialize master info structureMySqlASTStruct
- mysql [ERROR] InnoDB: ./ibdata1 can't be opened in read-write modeMySqlError
- enq: TX - row lock contentionENQ
- 等待事件之Row Cache Lock事件
- 【MySQL】select for update 的Row Lock 與Table LockMySql
- mysql innodb lock鎖之record lock之一MySql
- InnoDB從內分析之Row(一)
- Could not find the main class. Program will exitAI
- Could not find *.apk!解決辦法APK
- How to find Master Node in Oracle RAC(zt)ASTOracle