日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql update nowait_mysql innodb之select for update nowait

發布時間:2023/12/1 数据库 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql update nowait_mysql innodb之select for update nowait 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

作者: 弦樂之花 | 可以轉載, 但必須以超鏈接形式標明文章原始出處和作者信息及版權聲明

mysql innodb之select for update nowait

習慣了oracle數據庫的select for update nowait的同學,如果轉在mysql環境開發的話,也許會不太適應——目前builtin版本的innodb不支持nowait句法的。早在08年已經被作為bug提了出來(http://bugs.mysql.com/bug.php?id=36285)。還好innodb plugin1.0.2開始支持bug文章里提及的session級innodb_lock_wait_timeout控制(http://dev.mysql.com/doc/innodb-plugin/1.0/en/innodb-other-changes-innodb_lock_wait_timeout.html)

Before InnoDB Plugin 1.0.2, the only way to set this parameter was in the MySQL option file (my.cnf or my.ini), and changing it required shutting down and restarting the server. Beginning with the InnoDB Plugin 1.0.2, the configuration parameter innodb_lock_wait_timeout can be set at runtime with the SET GLOBAL or SET SESSION commands.

該問題的回復

[5 May 17:08] Bugs System

Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source

revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46)

(pib:16)[6 May 16:58] Paul DuBois

Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.

Re-closing.

看到該問題也是最終被close掉。值得一提的是目前看到的一些問題都說是5147做fix,mysql51系列啥時候是個頭??50系列目前主流的是508X系列吧,最近facebook發布了5084的補丁包,而percona則已經發布了5190-b21版本,oracle則磨刀霍霍向55系列。。。

btw,作為對select for update nowait的實現,其實如果數據庫實現不了,其實應用做個超時控制就可以了,把sql執行放到超時控制代碼里,具體情況要看開發語言了。

測試:

-- builtin innodb

user@test 10:14:37>set innodb_lock_wait_timeout=1;

ERROR 1238 (HY000): Variable 'innodb_lock_wait_timeout' is a read only variable

-- plugin innodb 1.0.7

user@sbtest 10:15:35>select @@innodb_version;

+------------------+

| @@innodb_version |

+------------------+

| 1.0.7 |

+------------------+

1 row in set (0.00 sec)

user@sbtest 10:15:43>set session innodb_lock_wait_timeout=1;

Query OK, 0 rows affected (0.00 sec)

user@sbtest 10:15:54>show variables like 'innodb_lock_wait_timeout';

+--------------------------+-------+

| Variable_name | Value |

+--------------------------+-------+

| innodb_lock_wait_timeout | 1 |

+--------------------------+-------+

1 row in set (0.01 sec)

user@sbtest 10:16:02>show global variables like 'innodb_lock_wait_timeout';

+--------------------------+-------+

| Variable_name | Value |

+--------------------------+-------+

| innodb_lock_wait_timeout | 15 |

+--------------------------+-------+

1 row in set (0.00 sec)

總結

以上是生活随笔為你收集整理的mysql update nowait_mysql innodb之select for update nowait的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。