Skip to content

Commit 53c72d6

Browse files
authored
修复 Frame 被同一线程多次加读锁后锁无法释放的 BUG (#458)
### What problem were solved in this pull request? 在 Frame 类中,开启 DEBUG 模式下,如果同一个线程对同一个页面多次加读锁,read_lockers_ 中的计数就无法被清除了,这会导致 ASSERT 失败。 ### What is changed and how it works? 我添加了以下逻辑: 在 Frame::read_unlatch 方法中,当 recursive_count != 1 时,将 read_lockers_ 中该线程的计数减一
1 parent 8d1188d commit 53c72d6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/observer/storage/buffer/frame.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ void Frame::read_unlatch(intptr_t xid)
195195

196196
if (1 == recursive_count) {
197197
read_lockers_.erase(xid);
198+
} else {
199+
read_lockers_[xid] = recursive_count - 1;
198200
}
199201
#endif
200202
}

0 commit comments

Comments
 (0)