中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

關于innodb_rollback_on_timeout測試

發布時間:2020-08-07 12:07:24 來源:ITPUB博客 閱讀:251 作者:yangjustins 欄目:MySQL數據庫

 

innodb_rollback_on_timeout 
innodb_lock_wait_timeout
最開始看到innodb_rollback_on_timeout 時,沒有好好理解transaction timeout的意思.以為只要是連接超時就會觸發,今天研究了一下.只能說巨坑;
以下測試.隔離級別皆為RR模式.測試過程.

 
實驗一:
innodb_rollback_on_timeout =on
innodb_lock_wait_timeout=20    
---------------------------------------|----------------------------------------|------------------------------------------------
session 1                             |            session 2                   |         session  3   
---------------------------------------|----------------------------------------|------------------------------------------------
 begin;                               |                                        |select * from information_schema.innodb_trx
                                       |                                        |      order by trx_started;   
---------------------------------------|----------------------------------------|------------------------------------------------
insert into t8 values (20,'ddd');      |                                        |       1   
---------------------------------------|----------------------------------------|------------------------------------------------
                                       |            begin;                     |      2   
---------------------------------------|----------------------------------------|------------------------------------------------
                                       | update t8 set test1='yyy' where id =19;|           2   
---------------------------------------|----------------------------------------|------------------------------------------------
                                       |                                        |       2   
update t8 set test1='xxx' where id =19;|                                        |
---------------------------------------|----------------------------------------|------------------------------------------------
               堵塞                    |                                        |          2 
---------------------------------------|----------------------------------------|------------------------------------------------
20s后超時                              |                                        |       1   
事務結束;                              |    commit;                             |     0
---------------------------------------|----------------------------------------|------------------------------------------------     
 

select * from t8;    
20這個id沒有;19被改為yyy;    
  
  
實驗二:
innodb_rollback_on_timeout =off
innodb_lock_wait_timeout=20   
---------------------------------------|---------------------------------------|-----------------------------------------------
                 session 1             |                   session 2          |          session  3   
---------------------------------------|---------------------------------------|-----------------------------------------------
 begin;                               |                                       | select * from information_schema.innodb_trx
                                       |                                       |        order by trx_started;   
---------------------------------------|---------------------------------------|-----------------------------------------------
insert into t8 values (20,'ddd');      |                                       |              1   
---------------------------------------|---------------------------------------|-----------------------------------------------
                                       |                   begin;              |             2   
                                       |update t8 set test1='yyy' where id =19;|
---------------------------------------|---------------------------------------|-----------------------------------------------
update t8 set test1='xxx' where id =19;|                                       |               2
---------------------------------------|---------------------------------------|-----------------------------------------------
堵塞                                   |                                       |               2     
---------------------------------------|---------------------------------------|-----------------------------------------------
20s后超時                              |                                       |              2   
事務未結束                           |                                       |
---------------------------------------|---------------------------------------|-----------------------------------------------
    commit;                            |                       commit;         |               0   
---------------------------------------|---------------------------------------|-----------------------------------------------
  
select * from t8;    
20這個id存在;19被改為yyy;  

 

結果就是:如果innodb_rollback_on_timeout 為on,事務在innodb_lock_wait_timeout超時后,當前sql會報超時,并使整個事務都回滾,然后結束事務;
         如果innodb_rollback_on_timeout 為off(默認值),事務在innodb_lock_wait_timeout超時后,當前sql會超時,并終止,回滾當前sql,但整個事務不回滾,事務不結束,必須顯示的回滾或提交;
 一句話:innodb_rollback_on_timeout 沒什么卵用.純碎就是坑;

向AI問一下細節
推薦閱讀:
  1. MySQL測試
  2. PHP測試

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

蓬溪县| 辽宁省| 容城县| 阳西县| 左权县| 石嘴山市| 峨眉山市| 蚌埠市| 石林| 湖州市| 江都市| 拜泉县| 阿拉尔市| 西和县| 台州市| 邵阳县| 四川省| 泰顺县| 利辛县| 荆门市| 肥城市| 佛冈县| 抚松县| 桐乡市| 永康市| 南通市| 那坡县| 丰顺县| 措勤县| 颍上县| 长汀县| 合江县| 长乐市| 周至县| 兴国县| 扎鲁特旗| 工布江达县| 敖汉旗| 类乌齐县| 镇坪县| 牡丹江市|