auto stripe_iter = stripe->keys. find (key);
if (stripe_iter != stripe->keys. end ()) {
auto& txns = stripe_iter-> second .txn_ids;
auto txn_it = std:: find (txns. begin (), txns. end (), txn_id);
// Found the key we locked. unlock it.
if (txn_it != txns. end ()) {
if (txns. size () == 1) {
stripe->keys. erase (stripe_iter);
} else {
auto last_it = txns. end () - 1;
if (txn_it != last_it) {
*txn_it = *last_it;
}
txns.pop_back();
}
if (max_num_locks_ > 0) {
// Maintain lock count if there is a limit on the number of locks.
assert(lock_map->lock_cnt. load (std:: memory_order_relaxed ) > 0);
lock_map->lock_cnt--;
}
}
} else {
// This key is either not locked or locked by someone else. This should
// only hAppen if the unlocking transaction has expired.
assert(txn->GetExpirationTime() > 0 &&
txn->GetExpirationTime() < env->NowMicros());
}
}
推荐阅读
- 爱因斯坦的智商有多高答案
- 科学家对鬼魂的解释 爱因斯坦研究的神鬼论
- 为了揭开火星神秘的面纱决定利用探测器对火星 为了揭开火星神秘的面纱科学家们决定利用
- c盘就装个win10的系统,留多大合适?
- 暗物质存在的观测证据 尽管目前科学家对暗物质还了解不多
- 使用 Go 打造另一款简单实用的 ORM
- 白毫乌龙的功效与作用,凌云白毫茶的特征与功效
- 绿茶麻花粥的做法,茶树菇胡萝卜粥的做法
- 一文彻底读懂MySQL事务的四大隔离级别
- 绿茶和柠檬的功效,柠檬绿茶的做法