From 76db8bbb09e8df9884e9933bb300e51a8cc93b2e Mon Sep 17 00:00:00 2001 From: zhiqiangxu <652732310@qq.com> Date: Sat, 6 Jan 2024 21:33:58 +0800 Subject: [PATCH] hole the rlock while reading WriteCell --- core/blockstm/mvhashmap.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/blockstm/mvhashmap.go b/core/blockstm/mvhashmap.go index 38b075b0d8..003de91e70 100644 --- a/core/blockstm/mvhashmap.go +++ b/core/blockstm/mvhashmap.go @@ -222,8 +222,8 @@ func (mv *MVHashMap) Read(k Key, txIdx int) (res MVReadResult) { } cells.rw.RLock() + fk, fv := cells.tm.Floor(txIdx - 1) - cells.rw.RUnlock() if fk != nil && fv != nil { c := fv.(*WriteCell) @@ -242,6 +242,8 @@ func (mv *MVHashMap) Read(k Key, txIdx int) (res MVReadResult) { } } + cells.rw.RUnlock() + return }