UNIV_INLINEulintbtr_cur_upd_lock_and_undo====================== ulint flags ! in undo logging and locking flags btr_cur_t cursor ! in cursor on record to update const upd_t update ! in update vecto
函数btr_cur_upd_lock_and_undo用于对记录进行更新时的锁定和撤销日志记录。具体步骤如下:
1.获取待更新的记录和索引信息。
2.如果索引不是聚簇索引,则调用lock_sec_rec_modify_check_and_lock函数对记录进行锁定和检查,返回锁定结果。
3.如果索引是聚簇索引,则判断是否需要等待锁定,如果需要则将锁定请求加入等待队列中。
4.调用trx_undo_report_row_operation函数将更新操作信息添加到撤销日志中。
5.返回撤销日志记录结果。
值得注意的是,如果flags参数中包含BTR_NO_LOCKING_FLAG标志位,则不进行锁定操作。
原文地址: https://www.cveoy.top/t/topic/eF4z 著作权归作者所有。请勿转载和采集!