@@ -22,11 +22,13 @@ namespace dingodb {
2222// lock_entry.rw_lock has already write locked
2323void ConcurrencyManager::LockKey (const std::string& key, LockEntryPtr lock_entry) {
2424 RWLockWriteGuard guard (&rw_lock_);
25+
2526 lock_table_[key] = lock_entry;
2627}
2728
2829void ConcurrencyManager::UnlockKeys (const std::vector<std::string>& keys) {
2930 RWLockWriteGuard guard (&rw_lock_);
31+
3032 for (auto const & key : keys) {
3133 auto it = lock_table_.find (key);
3234 if (it != lock_table_.end ()) {
@@ -42,6 +44,7 @@ bool ConcurrencyManager::CheckKeys(const std::vector<std::string>& keys, pb::sto
4244 std::vector<LockEntryPtr> lock_entrys;
4345 {
4446 RWLockReadGuard guard (&rw_lock_);
47+
4548 for (auto const & key : keys) {
4649 auto it = lock_table_.find (key);
4750 if (it != lock_table_.end ()) {
@@ -55,6 +58,7 @@ bool ConcurrencyManager::CheckKeys(const std::vector<std::string>& keys, pb::sto
5558 continue ;
5659 }
5760 RWLockReadGuard guard (&lock_entry->rw_lock );
61+
5862 if (TxnEngineHelper::CheckLockConflict (lock_entry->lock_info , isolation_level, start_ts, resolved_locks,
5963 txn_result_info)) {
6064 return true ;
@@ -71,9 +75,11 @@ bool ConcurrencyManager::CheckRange(const std::string& start_key, const std::str
7175 std::vector<LockEntryPtr> lock_entrys;
7276 {
7377 RWLockReadGuard guard (&rw_lock_);
78+
7479 auto it = lock_table_.lower_bound (start_key);
75- while (it != lock_table_.end () && it->first <= end_key) {
80+ while (it != lock_table_.end () && it->first < end_key) {
7681 lock_entrys.push_back (it->second );
82+ ++it;
7783 }
7884 }
7985
0 commit comments