1、介绍
delete流程分search和update两个阶段。在search阶段对聚集索引记录加锁,参考上一篇文章。在update阶段会对聚集索引记录打上delete标签,然后search二级索引记录,对二级索引记录加隐式锁,即不加锁,最后将二级索引记录打上delete标签点击(此处)折叠或打开
- mysql_delete::
- //rr_quick->...->row_search_for_mysql
- while (!(error=info.read_record(&info)) && !thd->killed &&! thd->is_error()){
- ...
- //...->row_update_for_mysql
- error= table->file->ha_delete_row(table->record[0]);
- ...
- }
2、加锁原理流程图
![](http://img.blog.itpub.net/blog/attachment/201802/2/31493717_1517581683LZY1.png?x-oss-process=style/bb)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31493717/viewspace-2150807/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/31493717/viewspace-2150807/