diff --git a/mutable_tree.go b/mutable_tree.go index ff7ef346d..54dcfd54a 100644 --- a/mutable_tree.go +++ b/mutable_tree.go @@ -792,7 +792,6 @@ func (tree *MutableTree) getUnsavedFastNodeRemovals() map[string]interface{} { func (tree *MutableTree) addUnsavedAddition(key []byte, node *FastNode) { delete(tree.unsavedFastNodeRemovals, string(key)) tree.unsavedFastNodeAdditions[string(key)] = node - tree.ndb.cacheFastNode(node) } func (tree *MutableTree) saveFastNodeAdditions() error { @@ -813,7 +812,6 @@ func (tree *MutableTree) saveFastNodeAdditions() error { func (tree *MutableTree) addUnsavedRemoval(key []byte) { delete(tree.unsavedFastNodeAdditions, string(key)) tree.unsavedFastNodeRemovals[string(key)] = true - tree.ndb.uncacheFastNode(key) } func (tree *MutableTree) saveFastNodeRemovals() error { diff --git a/nodedb.go b/nodedb.go index 7bee811c5..716b33257 100644 --- a/nodedb.go +++ b/nodedb.go @@ -559,6 +559,8 @@ func (ndb *nodeDB) DeleteVersionsRange(fromVersion, toVersion int64) error { } func (ndb *nodeDB) DeleteFastNode(key []byte) error { + ndb.mtx.Lock() + defer ndb.mtx.Unlock() if err := ndb.batch.Delete(ndb.fastNodeKey(key)); err != nil { return err }