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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL:Innodb 讓MDL LOCK和ROW LOCK 記錄到errlogMySql
- Fatal error: Uncaught PDOException: could not find driverErrorException
- ERROR | [iOS] unknown: Encountered an unknown error (Could not find a `ios` simulator (valid values:ErroriOS
- cmake報錯CMake Error: Could not find CMAKE_ROOTError
- AQS相關(lock、unlock、await、signal)AQSAI
- ORACLE LOCK MODE 1.2.3.4.5.6Oracle
- enq: TX - row lock contentionENQ
- MySQL 8.0.26 bug ERROR 1064(42000) -master-data is deprecated and will be removeMySqlErrorASTREM
- apt could not get lockAPT
- Innodb:為什麼lock in share mode在show engine看不到行鎖資訊
- MySQL自增列鎖模式 innodb_autoinc_lock_mode不同引數下效能測試MySql模式
- 等待事件enq: TX - row lock contention事件ENQ
- InnoDB從內分析之Row(一)
- mysql innodb lock鎖之record lock之一MySql
- Could not find a version that satisfies the requirement py4j (from versions: ) No matching distributUIREM
- 501-Find Mode in Binary Search Tree
- 奇異的enq: TX - row lock contentionENQ
- 515-Find Largest Value in Each Tree Row
- InnoDB LOCK檢視變化
- ubuntu解決Could not get lock /var/lib/dpkg/lock-frontendUbuntu
- Linux報錯:Could not get lock /var/lib/dpkg/lock-frontendLinux
- [LeetCode] 501. Find Mode in Binary Search TreeLeetCode
- LeetCode 501. Find Mode in Binary Search TreeLeetCode
- 關於 ReentrantLock 中鎖 lock() 和解鎖 unlock() 的底層原理淺析ReentrantLock
- MySQL 共享鎖 (lock in share mode),排他鎖 (for update)MySql
- vue3 Could not find a declaration file for moduleVue
- Oracle Enqueues Wait Events 三 enq: TX - row lock contentionOracleENQAI
- WebLogic啟動報Could not get the server file lockWebServer
- 詳細瞭解INNODB_TRX、INNODB_LOCKs、INNODB_LOCK_waits、PROCESSLIST表AI
- 深入理解SELECT ... LOCK IN SHARE MODE和SELECT ... FOR UPDATE
- VueX Vue: Could not find a declaration file for module vuex.Vue
- psql: error: could not connect to server: No such file or directorySQLErrorServer
- ORACLE基礎之oracle鎖(oracle lock mode)詳解Oracle
- 關於 artisan migrants Could not find drive 解決方法
- 解決CocoaPods could not find compatible versions for pod "React/Core"React
- git push origin master 時出現報錯 error: src refspec master does not match any error: failed to push someGitASTErrorAI
- Error: Cannot find configuration directory: /etc/hadoopErrorHadoop
- LPDDR4 byte mode
- This application failed to start because it could not find or load the Qt platform plugin “windows“APPAIQTPlatformPluginWindows