关于InnoDB事务的一个“诡异”现象:RR隔离级别下的幻读现象(补充)

版权声明:本文为博主原创文章,转载请标明出处。让学习成为一种习惯! https://blog.csdn.net/yanzongshuai/article/details/55683665

row_search_for_mysql:
    if(prebuilt->select_lock_type != LOCK_NONE) {//锁读,不会读取老版本
    ……
    }else{//一致性非锁定读
         if (trx->isolation_level ==TRX_ISO_READ_UNCOMMITTED) {//脏读、幻读等
                   nothing to do
         }else if (index == clust_index){
                 //检查该记录是否本事务可见
         if(UNIV_LIKELY(srv_force_recovery < 5) &&!lock_clust_rec_cons_read_sees(
rec, index, offsets, trx->read_view){
                 rec_t*      old_vers;
                 //不可见则找上一个版本
                 err = row_sel_build_prev_vers_for_mysql( trx->read_view,clust_index,
prebuilt, rec, &offsets, &heap,&old_vers,&mtr);
                  //上一个版本没有这个记录,放弃
                  if (old_vers == NULL) {
                         /*The row did not exist yet in the read view */
                         gotonext_rec;
                  }
                   rec =old_vers;
         }
    }
}

mysql_update-> rr_quick->QUICK_RANGE_SELECT::get_next->ha_innobase::multi_range_read_next-> DsMrr_impl::dsmrr_next->handler::multi_range_read_next->
handler::read_range_first->handler::ha_index_read_map-> handler::index_read_map->ha_innobase::index_read-> row_search_for_mysql
mysql_update->handler::ha_update_row->a_innobase::update_row-> row_update_for_mysql-> row_upd_step


展开阅读全文

没有更多推荐了,返回首页