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、加锁原理流程图