鎖:innodb_lock_wait_timeout和 innodb_rollback_on_timeout?
http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_lock_wait_timeout
innodb_lock_wait_timeout
Command-Line Format | --innodb_lock_wait_timeout=# | ||
System Variable | Name | innodb_lock_wait_timeout | |
Variable Scope | Global, Session | ||
Dynamic Variable | Yes | ||
Permitted Values | Type | numeric | |
Default | 50 | ||
Min Value | 1 | ||
Max Value | 1073741824 |
The length of time in seconds an InnoDB transaction waits for a row lock before giving up. The default value is 50 seconds. A transaction that tries to access a row that is locked by another InnoDB transaction waits at most this many seconds for write access to the row before issuing the following error:
ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
When a lock wait timeout occurs, the current statement is rolled back (not the entire transaction). To have the entire transaction roll back, start the server with the --innodb_rollback_on_timeout option. See also Section 14.21.4, “InnoDB Error Handling”.
You might decrease this value for highly interactive applications or OLTP systems, to display user feedback quickly or put the update into a queue for processing later. You might increase this value for long-running back-end operations, such as a transform step in a data warehouse that waits for other large insert or update operations to finish.
innodb_lock_wait_timeout applies to InnoDB row locks only. A MySQL table lock does not happen inside InnoDB and this timeout does not apply to waits for table locks.
The lock wait timeout value does not apply to deadlocks, because InnoDB detects them immediately and rolls back one of the deadlocked transactions.
As of MySQL 5.5, innodb_lock_wait_timeout can be set at runtime with the SET GLOBAL or SET SESSION statement. Changing the GLOBAL setting requires the SUPER privilege and affects the operation of all clients that subsequently connect. Any client can change the SESSION setting for innodb_lock_wait_timeout, which affects only that client.
http://dev.mysql.com/doc/refman/5.5/en/innodb-parameters.html#sysvar_innodb_rollback_on_timeout
innodb_rollback_on_timeout
Command-Line Format | --innodb_rollback_on_timeout | ||
System Variable | Name | innodb_rollback_on_timeout | |
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | Type | boolean | |
Default | OFF |
In MySQL 5.5, InnoDB rolls back only the last statement on a transaction timeout by default. If --innodb_rollback_on_timeout is specified, a transaction timeout causes InnoDB to abort and roll back the entire transaction (the same behavior as in MySQL 4.1).
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26250550/viewspace-1423334/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 設定mysql 事務鎖超時時間 innodb_lock_wait_timeoutMySqlAI
- mysql死鎖deadlock相關幾個系統變數innodb_lock_wait_timeoutMySql變數AI
- MySQL 死鎖和鎖等待MySql
- 全域性鎖和表鎖
- java重入鎖、公平鎖和非公平鎖Java
- Mysql鎖之行級鎖和表級意向鎖MySql
- MySQL 全域性鎖和表鎖MySql
- lock鎖和monitor.enter鎖
- 悲觀鎖和樂觀鎖
- mysql行鎖和死鎖檢測MySql
- 執行緒和鎖,鎖升級執行緒
- Mysql 兩階段鎖和死鎖MySql
- MySQL的共享鎖和獨佔鎖MySql
- laravel樂觀鎖和悲觀鎖Laravel
- 原子鎖和普通鎖的區別
- 理解樂觀鎖和悲觀鎖
- MySQL鎖(四)行鎖的加鎖規則和案例MySql
- 自旋鎖和互斥鎖區別 --- 經典
- Java中的公平鎖和非公平鎖Java
- 自旋鎖、阻塞鎖、可重入鎖、悲觀鎖、樂觀鎖、讀寫鎖、偏向所、輕量級鎖、重量級鎖、鎖膨脹、物件鎖和類鎖物件
- Go語言中的互斥鎖和讀寫鎖(Mutex和RWMutex)GoMutex
- 再說PHP檔案鎖,共享鎖和排它鎖注意點PHP
- [java][鎖]java鎖的膨脹和優化Java優化
- MySQL學習之全域性鎖和表鎖MySql
- Mysql中S 鎖和 X 鎖的區別MySql
- iOS指紋解鎖和手勢解鎖iOS
- iOS手勢解鎖和指紋解鎖iOS
- MySQL樂觀鎖和悲觀鎖介紹MySql
- 對TM鎖和TX鎖的簡單理解
- 【JavaSE】淺談偏向鎖、輕量級鎖和重量級鎖,如何獲取鎖,如何撤銷鎖。Java
- MySQL 事務和鎖MySql
- MySQL事務和鎖MySql
- 顯示卡鎖算力和不鎖算力的區別 顯示卡鎖算力和不鎖算力的哪個好
- ZooKeeper 分散式鎖 Curator 原始碼 02:可重入鎖重複加鎖和鎖釋放分散式原始碼
- 【JavaSE】Lock鎖和synchronized鎖的比較,lock鎖的特性,讀寫鎖的實現。Javasynchronized
- Redis的事務、樂觀鎖和悲觀鎖Redis
- 執行緒安全: 互斥鎖和自旋鎖(10種)執行緒
- Java多執行緒 -- 公平鎖和非公平鎖Java執行緒