mvcc: protect tree clone with write lock

release-3.4
Jingyi Hu 2019-05-01 12:34:09 -07:00
parent fc6936863a
commit 88922b0d08
1 changed files with 2 additions and 2 deletions

View File

@ -91,9 +91,9 @@ func (ti *treeIndex) keyIndex(keyi *keyIndex) *keyIndex {
func (ti *treeIndex) visit(key, end []byte, f func(ki *keyIndex)) {
keyi, endi := &keyIndex{key: key}, &keyIndex{key: end}
ti.RLock()
ti.Lock()
clone := ti.tree.Clone()
ti.RUnlock()
ti.Unlock()
clone.AscendGreaterOrEqual(keyi, func(item btree.Item) bool {
if len(endi.key) > 0 && !item.Less(endi) {