mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
mvcc: protect tree clone with write lock
This commit is contained in:
parent
fc6936863a
commit
88922b0d08
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user