# 先用 for update 锁住该条数据
begin;
select * from xxx_db.xxxx_tab where a = '107' for update;
update xxx_db.xxxx_tab set current_version = '5' where a = '107';
# 等代码的事务执行一半卡住时,再commit => 让代码的乐观锁生效,回滚事务
# commit;
# 先用 for update 锁住该条数据
begin;
select * from xxx_db.xxxx_tab where a = '107' for update;
update xxx_db.xxxx_tab set current_version = '5' where a = '107';
# 等代码的事务执行一半卡住时,再commit => 让代码的乐观锁生效,回滚事务
# commit;